Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378698

RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

From Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Newsgroups linux.kernel
Subject RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core
Date 2016-04-14 13:20 +0200
Message-ID <rnNtw-MQ-19@gated-at.bofh.it> (permalink)
References (3 earlier) <rlgBI-3br-11@gated-at.bofh.it> <rlCLU-30J-13@gated-at.bofh.it> <rmHJw-4qq-9@gated-at.bofh.it> <rnKYF-7jf-1@gated-at.bofh.it> <rnNjQ-J5-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

> From: Roger Quadros
> Sent: Thursday, April 14, 2016 8:00 PM
> 
> On 14/04/16 11:36, Yoshihiro Shimoda wrote:
> > Hi,
> >
< snip >
> > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > index e3d0161..8b74715 100644
> > --- a/drivers/usb/common/common.c
> > +++ b/drivers/usb/common/common.c
> > @@ -233,6 +233,8 @@ int of_usb_update_otg_caps(struct device_node *np,
> >  	if (of_find_property(np, "adp-disable", NULL) ||
> >  				(otg_caps->otg_rev < 0x0200))
> >  		otg_caps->adp_support = false;
> > +	if (of_find_property(np, "hcd-needs-companion", NULL))
> > +		otg_caps->needs_companion = true;
> 
> I'm not sure if otg_caps structure is a right place for this. Maybe Peter can confirm
> if this is OK or not.
> 
> I was thinking more about adding this bit in the otg_config structure.

I see. I also think the otg_config is more suitable.

> >
> >  	return 0;
> >  }
> > diff --git a/drivers/usb/common/usb-otg.c b/drivers/usb/common/usb-otg.c
> > index 41e762a..e0df839 100644
> > --- a/drivers/usb/common/usb-otg.c
> > +++ b/drivers/usb/common/usb-otg.c
> > @@ -823,13 +823,15 @@ int usb_otg_register_hcd(struct usb_hcd *hcd, unsigned int irqnum,
> >  	/* HCD will be started by OTG fsm when needed */
> >  	mutex_lock(&otg->fsm.lock);
> >  	if (otg->primary_hcd.hcd) {
> > -		/* probably a shared HCD ? */
> > -		if (usb_otg_hcd_is_primary_hcd(hcd)) {
> > +		/* probably a shared HCD or a companion OHCI HCD ? */
> > +		if (!otg->caps->needs_companion &&
> > +		    usb_otg_hcd_is_primary_hcd(hcd)) {
> >  			dev_err(otg_dev, "otg: primary host already registered\n");
> >  			goto err;
> >  		}
> >
> > -		if (hcd->shared_hcd == otg->primary_hcd.hcd) {
> > +		if (otg->caps->needs_companion ||
> > +		    (hcd->shared_hcd == otg->primary_hcd.hcd)) {
> >  			if (otg->shared_hcd.hcd) {
> >  				dev_err(otg_dev, "otg: shared host already registered\n");
> >  				goto err;
> > @@ -865,7 +867,8 @@ int usb_otg_register_hcd(struct usb_hcd *hcd, unsigned int irqnum,
> >  	 * we're ready only if we have shared HCD
> >  	 * or we don't need shared HCD.
> >  	 */
> > -	if (otg->shared_hcd.hcd || !otg->primary_hcd.hcd->shared_hcd) {
> > +	if (otg->shared_hcd.hcd || (!otg->caps->needs_companion &&
> > +				    !otg->primary_hcd.hcd->shared_hcd)) {
> >  		otg->host = hcd_to_bus(hcd);
> >  		/* FIXME: set bus->otg_port if this is true OTG port with HNP */
> >
> 
> These changes look good to me. Thanks.

Thank you for the comment.
If we change the "needs_companion" place to the otg_config,
do we need to add a flag into the otg, instead of otg->caps?

> > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > index b094352..64a7db8 100644
> > --- a/include/linux/usb/otg.h
> > +++ b/include/linux/usb/otg.h
> > @@ -112,12 +112,14 @@ struct usb_otg {
> >   * @hnp_support: Indicates if the device supports HNP.
> >   * @srp_support: Indicates if the device supports SRP.
> >   * @adp_support: Indicates if the device supports ADP.
> > + * @needs_companion: Indicates if the device needs a companion controller.
> 
> Description is not exact. How about this.
> "Indicates if host controller needs a companion controller"
> 
> Is hcd_needs_companion is better than just needs_companion?

I agree with you.

So, I will modify my local patch and test it tomorrow.

Best regards,
Yoshihiro Shimoda

> 
> >   */
> >  struct usb_otg_caps {
> >  	u16 otg_rev;
> >  	bool hnp_support;
> >  	bool srp_support;
> >  	bool adp_support;
> > +	bool needs_companion;
> >  };
> >
> >  /**
> >
> 
> cheers,
> -roger

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 00/12] USB OTG/dual-role framework Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 10/12] usb: doc: dt-binding: Add otg-controller property Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 09/12] usb: gadget: udc: adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 12/12] usb: host: xhci-plat: Add otg device to platform data Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
    RE: [PATCH v6 12/12] usb: host: xhci-plat: Add otg device to platform  data Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-04-06 05:30 +0200
      Re: [PATCH v6 12/12] usb: host: xhci-plat: Add otg device to platform  data Roger Quadros <rogerq@ti.com> - 2016-04-06 08:40 +0200
  [PATCH v6 06/12] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 07/12] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
    RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-04-07 11:00 +0200
      Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-04-07 13:50 +0200
        RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-04-08 13:30 +0200
          Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-04-11 13:00 +0200
            RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-04-14 10:40 +0200
              Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-04-14 13:10 +0200
                RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-04-14 13:20 +0200
                Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-04-14 13:40 +0200
                RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-04-15 12:00 +0200
                Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-04-15 13:00 +0200
                RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-04-15 12:10 +0200
    Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Peter Chen <hzpeterchen@gmail.com> - 2016-04-15 11:40 +0200
      Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-04-15 13:10 +0200
  [PATCH v6 05/12] usb: gadget.h: Add OTG to gadget interface Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 02/12] usb: hcd.h: Add OTG to HCD interface Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 04/12] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 11/12] usb: core: hub: Notify OTG fsm when A device sets b_hnp_enable Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
  [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Roger Quadros <rogerq@ti.com> - 2016-04-05 16:10 +0200
    Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Felipe Balbi <balbi@kernel.org> - 2016-04-06 08:20 +0200
      Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Roger Quadros <rogerq@ti.com> - 2016-04-06 08:40 +0200
        Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Peter Chen <hzpeterchen@gmail.com> - 2016-04-07 11:50 +0200
          Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Roger Quadros <rogerq@ti.com> - 2016-04-07 12:50 +0200
            Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Peter Chen <hzpeterchen@gmail.com> - 2016-04-08 03:10 +0200
              Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Roger Quadros <rogerq@ti.com> - 2016-04-08 09:20 +0200
                Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 Peter Chen <hzpeterchen@gmail.com> - 2016-04-08 10:00 +0200
  [PATCH v6 08/12] usb: hcd: Adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-04-05 16:20 +0200

csiph-web