From: Peter Chen <hzpeterchen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Cc: Jun Li <jun.li-3arQi8VN3Tc@public.gmane.org>,
"peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
<peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
"balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org"
<tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
"gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org"
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
"dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org"
<mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
"Joao.Pinto-HKixBCOQz3hWk0Htik3J/w@public.gmane.org"
<Joao.Pinto-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>,
"sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org"
<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>,
"jun.li-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
<jun.li-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
"grygorii.strashko-l0cyMroinI0@public.gmane.org"
<grygorii.strashko-l0cyMroinI0@public.gmane.org>,
"yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org"
<yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>,
"robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"nsekhar-l0cyMroinI0@public.gmane.org"
<nsekhar-l0cyMroinI0@public.gmane.org>,
"b-liu-l0cyMroinI0@public.gmane.org"
<b-liu-l0cyMroinI0@public.gmane.org>,
"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-kernel-fy+rA21nqHI@public.gmane.org
Subject: Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core
Date: Sat, 21 May 2016 10:29:40 +0800 [thread overview]
Message-ID: <20160521022940.GA15088@shlinux2> (raw)
In-Reply-To: <573D6C1C.4090600-l0cyMroinI0@public.gmane.org>
On Thu, May 19, 2016 at 10:32:44AM +0300, Roger Quadros wrote:
> On 18/05/16 17:46, Jun Li wrote:
> >
> >
> >>>>
> >>>> I didn't want to have complex Kconfig so decided to have otg as
> >>>> built-in only.
> >>>> What do you want me to change in existing code? and why?
> >>>
> >>> Remove those stuff which only for pass diff driver config Like every
> >>> controller driver need a duplicated
> >>>
> >>> static struct otg_hcd_ops ci_hcd_ops = {
> >>> ...
> >>> }
> >>
> >> This is an exception only. Every controller driver doesn't need to
> >> implement hcd_ops. It is implemented in the hcd core.
> >>
> >>>
> >>> And here is another example, for gadget connect, otg driver can
> >>> directly call to usb_udc_vbus_handler() in drd state machine, but you
> >>> create another interface:
> >>>
> >>> .connect_control = usb_gadget_connect_control,
> >>>
> >>> If the symbol is defined in one driver which is 'm', another driver
> >>> reference it should be 'm' as well, then there is no this kind of
> >>> problem as my understanding.
> >>
> >> That is fine as long as all are 'm'. but how do you solve the case when
> >> Gadget is built in and host is 'm'? OTG has to be built-in and you will
> >> need an hcd to gadget interface.
> >
> > Hcd to gadget interface? Or you want to say otg to host interface?
>
> Sorry, I meant to say host to otg interface.
>
> >
> > I think hcd and gadget are independent each other, now
> >
> > Hcd --> otg; and gadget --> otg, (hcd and gadget use otg's symbol)
>
> It is actually a circular dependency for both.
> hcd <--> otg and gadget <--> otg
>
> hcd -> otg for usb_otg_register/unregister_hcd
> otg -> hcd for usb_add/remove_hcd, usb_bus_start_enum, usb_control_msg, usb_hub_find_child
>
> gadget -> otg for usb_otg_register/unregister_gadget
> otg -> gadget for usb_gadget_start/stop, usb_udc_vbus_handler
>
> Now consider what will happen if I get rid of the otg_hcd and otg_gadget interfaces.
> 'y' means built-in, 'm' means module.
>
> 1) hcd 'y', gadget 'y'
> otg has to be 'y' for proper build.
>
> 2) hcd 'm', gadget 'm'
> otg has to be 'm' for proper build.
>
> 3) hcd 'y', gadget 'm'
> Build will fail always.
> If otg is 'y', otg build will fail due to dependency on gadget.
> If otg is 'm', hcd build will fail due to dependency on otg.
>
> 4) hcd 'm', gadget 'y'
> Build will fail always.
> If otg is 'y', otg build will fail due to dependency on hcd.
> If otg is 'm', gadget build will fails due to dependency on otg.
>
> So I solve this problem by adding the otg_hcd_ops and otg_gadget_ops
> to remove otg->hcd and otg->gadget dependency.
>
> Now we can address 3) and 4) like so
>
> 3) hcd 'y', gadget 'm'
> otg has to be 'y' for proper build.
>
> 4) hcd 'm', gadget 'y'
> otg has to be 'y' for proper build.
>
How about this:
Moving usb_otg_register/unregister_hcd to host driver to remove
dependency hcd->otg. And moving usb_otg_get_data to common.c.
Delete the wait queue at usb-otg.c, and if calling usb_otg_get_data
returns NULL, the host/device driver's probe return -EPROBE_DEFER.
When the otg driver is probed successfully, the host/device will be
re-probed again, and usb_otg_register_hcd will be called again.
And let OTG depends on HCD && GADGET, and delete otg_hcd_ops and
otg_gadget_ops. Below build dependency issues can be fixed.
What do you think?
> 1) hcd 'y', gadget 'y'
> otg has to be 'y' for proper build.
>
> 2) hcd 'm', gadget 'm'
> otg has to be 'm' for proper build.
>
> 3) hcd 'y', gadget 'm'
> Build will fail always.
> If otg is 'y', otg build will fail due to dependency on gadget.
> If otg is 'm', hcd build will fail due to dependency on otg.
>
> 4) hcd 'm', gadget 'y'
> Build will fail always.
> If otg is 'y', otg build will fail due to dependency on hcd.
> If otg is 'm', gadget build will fails due to dependency on otg.
--
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-05-21 2:29 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 10:03 [PATCH v8 00/14] USB OTG/dual-role framework Roger Quadros
2016-05-13 10:03 ` [PATCH v8 01/14] usb: hcd: Initialize hcd->flags to 0 Roger Quadros
2016-05-13 10:03 ` [PATCH v8 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined Roger Quadros
2016-05-13 10:03 ` [PATCH v8 03/14] usb: hcd.h: Add OTG to HCD interface Roger Quadros
2016-05-13 10:03 ` [PATCH v8 04/14] usb: otg-fsm: use usb_otg wherever possible Roger Quadros
2016-05-13 10:03 ` [PATCH v8 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros
2016-05-13 10:03 ` [PATCH v8 06/14] usb: gadget.h: Add OTG to gadget interface Roger Quadros
2016-05-13 10:03 ` [PATCH v8 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG Roger Quadros
2016-05-13 10:03 ` [PATCH v8 09/14] usb: of: add an API to get OTG device from USB controller node Roger Quadros
2016-05-20 9:29 ` [PATCH v9 " Roger Quadros
2016-05-23 21:06 ` Rob Herring
2016-05-13 10:03 ` [PATCH v8 10/14] usb: otg: add hcd companion support Roger Quadros
[not found] ` <1463133808-10630-11-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2016-05-13 18:13 ` Rob Herring
2016-05-16 8:12 ` Roger Quadros
2016-05-20 9:32 ` [PATCH v9 " Roger Quadros
2016-05-23 21:07 ` Rob Herring
2016-05-13 10:03 ` [PATCH v8 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros
2016-05-13 10:03 ` [PATCH v8 12/14] usb: hcd: Adapt to OTG core Roger Quadros
2016-05-13 10:03 ` [PATCH v8 13/14] usb: gadget: udc: adapt " Roger Quadros
2016-05-16 7:02 ` Peter Chen
2016-05-16 8:26 ` Roger Quadros
[not found] ` <57398451.2060103-l0cyMroinI0@public.gmane.org>
2016-05-16 9:23 ` Peter Chen
[not found] ` <20160516092323.GD24609-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2016-05-16 9:51 ` Roger Quadros
2016-05-17 7:38 ` Jun Li
[not found] ` <AM4PR04MB2130E149700361CBA3F6863389480-WOempg8NbQQzjTQnahXoOs9NdZoXdze2vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-17 8:08 ` Roger Quadros
2016-05-17 8:28 ` Jun Li
2016-05-18 12:42 ` Roger Quadros
[not found] ` <573C6347.6080705-l0cyMroinI0@public.gmane.org>
2016-05-18 13:12 ` Jun Li
2016-05-18 13:43 ` Roger Quadros
2016-05-18 14:46 ` Jun Li
[not found] ` <AM4PR04MB2130926F9AE8EBFC0D19447689490-WOempg8NbQQzjTQnahXoOs9NdZoXdze2vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-19 7:32 ` Roger Quadros
[not found] ` <573D6C1C.4090600-l0cyMroinI0@public.gmane.org>
2016-05-21 2:29 ` Peter Chen [this message]
2016-05-23 3:21 ` Peter Chen
2016-05-23 10:11 ` Roger Quadros
2016-05-23 10:34 ` Jun Li
2016-05-23 10:36 ` Roger Quadros
2016-05-24 2:53 ` Peter Chen
2016-06-08 7:32 ` Roger Quadros
2016-06-08 9:05 ` Peter Chen
2016-05-18 3:18 ` Peter Chen
[not found] ` <20160518031829.GA4244-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2016-05-18 12:45 ` Roger Quadros
[not found] ` <573C63D7.9050200-l0cyMroinI0@public.gmane.org>
2016-05-20 1:39 ` Peter Chen
2016-05-20 7:26 ` Roger Quadros
[not found] ` <573EBC0B.7030204-l0cyMroinI0@public.gmane.org>
2016-05-21 2:44 ` Peter Chen
2016-06-01 7:38 ` Peter Chen
2016-06-02 11:07 ` Roger Quadros
[not found] ` <1463133808-10630-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2016-05-13 10:03 ` [PATCH v8 08/14] usb: otg: add OTG/dual-role core Roger Quadros
2016-05-16 9:00 ` Roger Quadros
2016-05-18 7:45 ` Peter Chen
2016-05-18 12:59 ` Roger Quadros
2016-05-20 8:31 ` Roger Quadros
2016-05-20 9:19 ` Roger Quadros
[not found] ` <573ED68B.60907-l0cyMroinI0@public.gmane.org>
2016-05-20 9:53 ` Peter Chen
2016-05-23 10:06 ` Roger Quadros
2016-05-24 9:45 ` Roger Quadros
2016-05-25 2:44 ` Peter Chen
2016-05-25 3:19 ` Jun Li
2016-05-25 12:26 ` Roger Quadros
2016-05-25 12:21 ` Roger Quadros
2016-05-25 14:44 ` Jun Li
2016-05-27 8:03 ` Peter Chen
2016-05-27 8:12 ` Peter Chen
2016-05-13 10:03 ` [PATCH v8 14/14] usb: host: xhci-plat: Add otg device to platform data Roger Quadros
2016-05-30 9:29 ` [PATCH v8 00/14] USB OTG/dual-role framework Peter Chen
2016-05-30 14:04 ` Roger Quadros
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=20160521022940.GA15088@shlinux2 \
--to=hzpeterchen-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=Joao.Pinto-HKixBCOQz3hWk0Htik3J/w@public.gmane.org \
--cc=b-liu-l0cyMroinI0@public.gmane.org \
--cc=balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
--cc=jun.li-3arQi8VN3Tc@public.gmane.org \
--cc=jun.li-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=linux-kernel-fy+rA21nqHI@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=nsekhar-l0cyMroinI0@public.gmane.org \
--cc=peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=rogerq-l0cyMroinI0@public.gmane.org \
--cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
--cc=yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).