mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Vivek Gautam <gautamvivek1987@gmail.com>
Cc: <balbi@ti.com>, Vivek Gautam <gautam.vivek@samsung.com>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>, <gregkh@linuxfoundation.org>,
	Doug Anderson <dianders@chromium.org>
Subject: Re: [PATCH RFC] usb: dwc3: Remove dwc3 dependency on gadget.
Date: Mon, 14 Jan 2013 09:57:40 +0200	[thread overview]
Message-ID: <20130114075740.GC10176@arwen.pp.htv.fi> (raw)
In-Reply-To: <CAFp+6iEvO2z=bWF7awN4vxN5W1YT0eXcpwarXoB8Mf_=BsQBpQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3818 bytes --]

On Fri, Jan 11, 2013 at 07:58:23PM +0530, Vivek Gautam wrote:
> Hi,
> 
> 
> On Fri, Jan 11, 2013 at 7:29 PM, Felipe Balbi <balbi@ti.com> wrote:
> > Hi,
> >
> > On Fri, Jan 11, 2013 at 07:13:55PM +0530, Vivek Gautam wrote:
> >> On Thu, Jan 10, 2013 at 6:32 PM, Felipe Balbi <balbi@ti.com> wrote:
> >> > Hi,
> >> >
> >> > On Mon, Dec 24, 2012 at 07:28:33PM +0530, Vivek Gautam wrote:
> >> >> DWC3 controller curretly depends on CONFIG_USB and CONFIG_USB_GADGET.
> >> >> Some hardware may like to use only host feature on dwc3.
> >> >> So, removing the dependency of USB_DWC3 on USB_GADGET
> >> >> and further modulating the dwc3 core to enable gadget features
> >> >> only with USB_GADGET.
> >> >>
> >> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> >> >> CC: Doug Anderson <dianders@chromium.org>
> >> >
> >> > right, right... Eventually we need to do it, but you're only making
> >> > gadget side optional. Host side should be optional too, but then you
> >> > need to make sure we don't build dwc3 without gadget and host.
> >> >
> >>
> >> Yes, true we need to make host side also optional, build dwc3 only when
> >> either of host or gadget are built.
> >
> > btw, make the default Dual-Role, if user/defconfig doesn't select
> > anything we want to build with all features.
> >
> 
> Yes we can try something like this ?
> 
>          if (USB || USB_GADGET)

no need for this if, actually...

>          menuconfig USB_DWC3
>                  tristate "DesignWare USB3 DRD Core Support"

make it a "depends on (USB || USB_GAGDGET)" here

other than that, it looks correct. Just make sure to compile test in all
options.

>           if USB_DWC3
>           choice
>           default USB_DWC3_DUAL_ROLE_MODE
>           ...
> 
>           config USB_DWC3_HOST_MODE

this one should depend on USB

>           ...
> 
>           config USB_DWC3_DEVICE_MODE

this one should depend on USB_GADGET

>           ...
> 
>           config USB_DWC3_DUAL_ROLE_MODE

should depend on USB && USB_GADGET

> >> >>  int dwc3_gadget_init(struct dwc3 *dwc);
> >> >>  void dwc3_gadget_exit(struct dwc3 *dwc);
> >> >> +#else
> >> >> +static inline int dwc3_gadget_init(struct dwc3 *dwc)
> >> >> +{ return -EINVAL; }
> >> >> +static inline void dwc3_gadget_exit(struct dwc3 *dwc)
> >> >> +{ }
> >> >> +#endif
> >> >>
> >> >>  #endif /* __DRIVERS_USB_DWC3_CORE_H */
> >> >> diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
> >> >> index d4a30f1..553bbaa 100644
> >> >> --- a/drivers/usb/dwc3/debugfs.c
> >> >> +++ b/drivers/usb/dwc3/debugfs.c
> >> >> @@ -535,7 +535,8 @@ static ssize_t dwc3_testmode_write(struct file *file,
> >> >>               testmode = 0;
> >> >>
> >> >>       spin_lock_irqsave(&dwc->lock, flags);
> >> >> -     dwc3_gadget_set_test_mode(dwc, testmode);
> >> >> +     if (dwc3_gadget_set_test_mode(dwc, testmode))
> >> >> +             dev_dbg(dwc->dev, "host: Invalid request\n");
> >> >>       spin_unlock_irqrestore(&dwc->lock, flags);
> >> >>
> >> >>       return count;
> >> >
> >> > wrong, if you don't have gadget mode, you just don't create this file.
> >> >
> >>
> >> dwc3-core makes call to dwc3_debugfs_init() invariably depending on DEBUG_FS.
> >> Will this not go ahead and create this file ?
> >> I think i am missing here something.  :-(
> >
> > right, you can change dwc3_debugfs_init() to take into account the fact
> > that you're a gadget/drd or host-only.
> >
> > In case of host only, you stil want regdump to be available :-)
> >
> 
> So in dwc3_debugfs_init() we shall actually create just 'regdump' file
> in case of host only mode, otherwise keep the dwc3_debugfs_init() happy
> with creating other files too.
> Right ?

right.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-01-14  7:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-24 13:58 Vivek Gautam
2013-01-10 13:02 ` Felipe Balbi
2013-01-11 13:43   ` Vivek Gautam
2013-01-11 13:59     ` Felipe Balbi
2013-01-11 14:28       ` Vivek Gautam
2013-01-14  7:57         ` Felipe Balbi [this message]
2013-01-14  9:12           ` Vivek Gautam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130114075740.GC10176@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=dianders@chromium.org \
    --cc=gautam.vivek@samsung.com \
    --cc=gautamvivek1987@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®