Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760422AbcDFDXv (ORCPT ); Tue, 5 Apr 2016 23:23:51 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:16673 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752812AbcDFDXt convert rfc822-to-8bit (ORCPT ); Tue, 5 Apr 2016 23:23:49 -0400 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'208";a="208540588" 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 12/12] usb: host: xhci-plat: Add otg device to platform data Thread-Topic: [PATCH v6 12/12] usb: host: xhci-plat: Add otg device to platform data Thread-Index: AQHRj0RsXEIi9Lkv7EeF/K1zU41mxZ98Rv+Q Date: Wed, 6 Apr 2016 03:23:42 +0000 Message-ID: References: <1459865117-7032-1-git-send-email-rogerq@ti.com> <1459865117-7032-13-git-send-email-rogerq@ti.com> In-Reply-To: <1459865117-7032-13-git-send-email-rogerq@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: 3b9ca109-53f4-4fef-2c67-08d35dcadb31 x-microsoft-exchange-diagnostics: 1;SG2PR06MB0917;5:pxJxKGjpdOZFyVVSwUK4IAQPBCK+RMyR7HuSoYH6wfgIy2ScZzL3iU1YqIqTTWcacNYKBR1EOhLxejcBGxUnbE60N7yOeywkLQqcwI0a6SHP7w7l08Wj5UrU952cDVQtinJnACxoAqe3HCLzsvmDSA==;24:7MVQ+cy3BmI9wO3FEACUYZhVR4XXub8STr/dXVAxJVLtLwQIghfN5qmG3eLkZ65OOqxwDIXevjLLNm4re7eDxqS14zikexepHQ2YIooLJlU=;20:J03hNq1Lv6/tsa4rE7rAAJrB2VxM2njKYSaOfZwJ7EraHDugh0112yoDsQpb/kwUi/N9PSuaR7kYMFXAyHjJptO/ar7uwS5TdKw7g26Vy2HLEpPnLwHLqwi9XugUBmdGRFwLrctVRinZs4LVIOKblX1HIoC0Hvw/YWoZnfSSCHY= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB0917; 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)(3002001)(10201501046)(6055026);SRVR:SG2PR06MB0917;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB0917; x-forefront-prvs: 0904004ECB x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(377454003)(51444003)(1096002)(2501003)(4326007)(2906002)(6116002)(1220700001)(189998001)(92566002)(81166005)(66066001)(106116001)(5002640100001)(11100500001)(102836003)(122556002)(74316001)(3660700001)(3280700002)(5001770100001)(2950100001)(86362001)(77096005)(5008740100001)(15975445007)(2900100001)(586003)(76176999)(5003600100002)(2171001)(87936001)(50986999)(54356999)(2201001)(575784001)(19580395003)(76576001)(33656002)(19580405001)(7059030)(422495003);DIR:OUT;SFP:1102;SCL:1;SRVR:SG2PR06MB0917;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: 06 Apr 2016 03:23:43.0175 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB0917 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3428 Lines: 131 Hi, > Sent: Tuesday, April 05, 2016 11:05 PM > > Host controllers that are part of an OTG/dual-role instance > need to somehow pass the OTG controller device information > to the HCD core. > > We use platform data to pass the OTG controller device. > > Signed-off-by: Roger Quadros > --- > drivers/usb/host/xhci-plat.c | 35 ++++++++++++++++++++++++++++------- > include/linux/usb/xhci_pdriver.h | 3 +++ > 2 files changed, 31 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c > index 5c15e9b..3d0f597 100644 > --- a/drivers/usb/host/xhci-plat.c > +++ b/drivers/usb/host/xhci-plat.c > @@ -230,11 +230,20 @@ static int xhci_plat_probe(struct platform_device *pdev) > goto put_usb3_hcd; > } > > - ret = usb_add_hcd(hcd, irq, IRQF_SHARED); > + if (pdata->otg_dev) I think that this should be changed like below: if (pdata && pdata->otg_dev) Otherwise, panic happened on my environment (arm64 / r8a7795 board) because the pdata was NULL. > + ret = usb_otg_add_hcd(hcd, irq, IRQF_SHARED, pdata->otg_dev); > + else > + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); > + > if (ret) > goto disable_usb_phy; > > - ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); > + if (pdata->otg_dev) Ditto. > + ret = usb_otg_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED, > + pdata->otg_dev); > + else > + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); > + > if (ret) > goto dealloc_usb2_hcd; > > @@ -242,7 +251,10 @@ static int xhci_plat_probe(struct platform_device *pdev) > > > dealloc_usb2_hcd: > - usb_remove_hcd(hcd); > + if (pdata->otg_dev) Ditto. > + usb_otg_remove_hcd(hcd); > + else > + usb_remove_hcd(hcd); > > disable_usb_phy: > usb_phy_shutdown(hcd->usb_phy); > @@ -260,16 +272,25 @@ put_hcd: > return ret; > } > > -static int xhci_plat_remove(struct platform_device *dev) > +static int xhci_plat_remove(struct platform_device *pdev) > { > - struct usb_hcd *hcd = platform_get_drvdata(dev); > + struct usb_hcd *hcd = platform_get_drvdata(pdev); > struct xhci_hcd *xhci = hcd_to_xhci(hcd); > struct clk *clk = xhci->clk; > + struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev); > + > + if (pdata->otg_dev) Ditto. > + usb_otg_remove_hcd(xhci->shared_hcd); > + else > + usb_remove_hcd(xhci->shared_hcd); > > - usb_remove_hcd(xhci->shared_hcd); > usb_phy_shutdown(hcd->usb_phy); > > - usb_remove_hcd(hcd); > + if (pdata->otg_dev) Ditto. Best regards, Yoshihiro Shimoda > + usb_otg_remove_hcd(hcd); > + else > + usb_remove_hcd(hcd); > + > usb_put_hcd(xhci->shared_hcd); > > if (!IS_ERR(clk)) > diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h > index 376654b..5c68b83 100644 > --- a/include/linux/usb/xhci_pdriver.h > +++ b/include/linux/usb/xhci_pdriver.h > @@ -18,10 +18,13 @@ > * > * @usb3_lpm_capable: determines if this xhci platform supports USB3 > * LPM capability > + * @otg_dev: OTG controller device. Only requied if part of > + * OTG/dual-role. > * > */ > struct usb_xhci_pdata { > unsigned usb3_lpm_capable:1; > + struct device *otg_dev; > }; > > #endif /* __USB_CORE_XHCI_PDRIVER_H */ > -- > 2.5.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html