Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754243AbcDNLPZ (ORCPT ); Thu, 14 Apr 2016 07:15:25 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:63754 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751737AbcDNLPX convert rfc822-to-8bit (ORCPT ); Thu, 14 Apr 2016 07:15:23 -0400 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'208";a="209346611" From: Yoshihiro Shimoda To: Roger Quadros , "stern@rowland.harvard.edu" , "balbi@kernel.org" , "gregkh@linuxfoundation.org" , "peter.chen@freescale.com" CC: "dan.j.williams@intel.com" , "jun.li@freescale.com" , "mathias.nyman@linux.intel.com" , "tony@atomide.com" , "Joao.Pinto@synopsys.com" , "abrestic@chromium.org" , "r.baldyga@samsung.com" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-omap@vger.kernel.org" Subject: RE: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Thread-Topic: [PATCH v6 07/12] usb: otg: add OTG/dual-role core Thread-Index: AQHRj0Tb371d8JP1IUix4M6r6OgSS59+LbDwgAA5sgCAAYajwIAEtH8AgASOAyCAACp4gIAAAhUA Date: Thu, 14 Apr 2016 11:15:16 +0000 Message-ID: References: <1459865117-7032-1-git-send-email-rogerq@ti.com> <1459865117-7032-8-git-send-email-rogerq@ti.com> <57064850.3060405@ti.com> <570B8268.6090700@ti.com> <570F7827.8050707@ti.com> In-Reply-To: <570F7827.8050707@ti.com> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=renesas.com; x-originating-ip: [211.11.155.144] x-ms-office365-filtering-correlation-id: c29f91b4-3b5c-424b-8dd5-08d364560ebf x-microsoft-exchange-diagnostics: 1;SG2PR06MB0918;5:EXJ0JKUU8ryGe5XfdvcPmJ/JAnggDo+SrYFTJUZTUGXOhrn0V3r2PoCCb+uPPSdrmr6BBVjibfGrC8DK+NS/Gr8ps1AduA9QEmfPURtd3Stgjvmi37EM1zQyGP1VY7E4vPJ6XVySEEtJE1PXor3XXw==;24:rfAUIrQYyyw6CmMjBMs3ssGy+kOoF6Al6dxvdvK1D2tNEKsURcLSs6THWLpWnbHwbJv10NH66wSKN+6h+ju5OK6qSSRWo4Z4yXH+cAtNHhI=;20:L3mKPAJKS+VFU+2qyWkHpjVhKB4lQ8C88380N1ssa4Y4B1UJEXEDDaFs7nItAt/qwtEJWUCwf/eVDpvzDOIwschlVMJdmOPzfOxeVQAbBPXZ4BN4SpfkEeE+X8LCC2+WM38yCY7BpteBn6erNsNNT6OGaItPNFplr1IP1OdCt3E= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB0918; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:SG2PR06MB0918;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB0918; x-forefront-prvs: 0912297777 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(377454003)(57704003)(5001770100001)(81166005)(92566002)(2900100001)(2950100001)(1220700001)(76576001)(189998001)(77096005)(2171001)(87936001)(74316001)(2906002)(93886004)(10400500002)(19580395003)(4326007)(2501003)(66066001)(6116002)(33656002)(1096002)(86362001)(3280700002)(3660700001)(345774005)(586003)(102836003)(3846002)(9686002)(575784001)(5003600100002)(122556002)(2201001)(11100500001)(76176999)(5004730100002)(106116001)(54356999)(5002640100001)(50986999)(5008740100001)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:SG2PR06MB0918;H:SG2PR06MB0919.apcprd06.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2016 11:15:16.5677 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB0918 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3553 Lines: 107 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