Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752118AbbHTFhV (ORCPT ); Thu, 20 Aug 2015 01:37:21 -0400 Received: from mail-bl2on0144.outbound.protection.outlook.com ([65.55.169.144]:6013 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751284AbbHTFhS convert rfc822-to-8bit (ORCPT ); Thu, 20 Aug 2015 01:37:18 -0400 From: Ramneek Mehresh To: Alan Stern CC: "linux-kernel@vger.kernel.org" , "balbi@ti.com" , "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , Li Leo Subject: RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host driver Thread-Topic: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host driver Thread-Index: AQHQ1fOLHEZ3GswMtUS/GfcJ3NrDb54KRRoAgAohELA= Date: Thu, 20 Aug 2015 05:37:12 +0000 Message-ID: References: <1439490305-29215-4-git-send-email-ramneek.mehresh@freescale.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ramneek.mehresh@freescale.com; x-originating-ip: [192.88.169.1] x-microsoft-exchange-diagnostics: 1;BY2PR0301MB0725;5:hDZVo0w1CdBivjmp4TngjParaP/iRqm0iakdFQoIubOTvS1P3uCW5wzbqU6UT1O9QXVnMQnH/+yheewfI6VlXfTXrlo6rkdVKtTw5Oy6c4yFKiXMLdxoxEPvufuJXXXE/2mgpAXCtJ329sO9fDGHrg==;24:hlNrophB3XLnl54bYLm32Jpwrv3RJj3emBvxGCswtEX/aWN1urUzhQo6a55ytBnrwrLKS2yqvIKbRzSJ7NX6k7txhvMglbqTPbC+YtBXqJA=;20:9gm7Ze+/JsV98qvUH8aubM7UKBI8zphbc9xTobsljBrH3f3B9zdcL1jNjgxmrF9+4Xkwnt55p1L8UAWoF/rocQ== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0725;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1542; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:BY2PR0301MB0725;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0725; x-forefront-prvs: 0674DC6DD3 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(13464003)(24454002)(189002)(199003)(377454003)(54356999)(81156007)(92566002)(19580395003)(189998001)(87936001)(2656002)(50986999)(105586002)(5002640100001)(62966003)(33656002)(74316001)(5003600100002)(77156002)(77096005)(107886002)(76576001)(122556002)(76176999)(86362001)(106356001)(46102003)(40100003)(5001860100001)(99286002)(97736004)(101416001)(2950100001)(2171001)(19580405001)(102836002)(2900100001)(64706001)(10400500002)(4001540100001)(110136002)(5001960100002)(66066001)(106116001)(5007970100001)(68736005)(5001830100001)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0301MB0725;H:SN1PR0301MB1583.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Aug 2015 05:37:12.1624 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0725 X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB1542;2:defemsax0ZI7Ica2xxeoJOCtp0Hnr1N0hvbDDw1EoXxsPy4+nRYIMGSDsIeWBbVZE1JUMF14Sndc1JrWN+xI8gHTRCCApXBY7rtQNrjqlqSrCuxcZ8V8195Xf7c5q5wmQFF7J3+lav6MCwE8IAJROgd/ZtvsSdHQGEw+4fq2hW0=;3:TZ7F8tEuIgJCuco0ZSxfPYtBWL9r9PeGsSJ1+S/Ay8k9qW/gj1XZEt62//6H4nscLghtDhgUQAf0oyyhqIuCxX93udwqcWX3nb1KvegFWQA6Cm8tfr5V43EEHvXoeB3gCTAPBIeLkd5cqOAgddHKlQ==;25:rykD8fDwT+qoQ1UukOBC8m2pxqIEkLJfzQdcW7UR0w7zaK7KtKTp8yki6zLtpEs2TJMG7QtjWEFDCa8p1WnXmoQVYr7me516DhW4hba4FpdodE5gt6nU8qFBeTJLZkgL2dGCSrJUpS7g3IkX4IDMyek5XlZTIuaWC95OuXVk9cRhFf+RPEk2vhMBXRtdmK1lQc8yX43R0ts8kiALAB/XZxmJV+Ng8beJebwdkI/c3vOGdSp7S30crZAA39QFCFfIO7t3Fh733cie3k9tNORT1A==;23:bAs5Ap2dYRaIz1OkPZ+6ohgaoZPlHGBFJ1L6dgFK2sKDfZn5vmuY/JDdFbnsz3opw9EFKysNxAba3Eda9mTIkOPDghckt1uVWzWcX7XDiuWfsxdRnOpRgVHnGpY6Lof25japDVEXh5maW2pJQq+qciI+VX3xUqvK5dLqCwbAxssLpvpKHc9YJ7mHHNFQqynV X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3648 Lines: 107 > -----Original Message----- > From: Alan Stern [mailto:stern@rowland.harvard.edu] > Sent: Friday, August 14, 2015 12:17 AM > To: Mehresh Ramneek-B31383 > Cc: linux-kernel@vger.kernel.org; balbi@ti.com; > gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; Li Yang-Leo-R58472 > > Subject: Re: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb > host driver > > On Thu, 13 Aug 2015, Ramneek Mehresh wrote: > > > Add workqueue to add/remove host driver (outside > > interrupt context) upon each id change. > > > > Signed-off-by: Li Yang > > Signed-off-by: Ramneek Mehresh > > --- > > Changes for v3: > > - removed CONFIG_FSL_USB2_OTG and > CONFIG_FSL_USB2_OTG_MODULE > > macros > > - removed call to usb_hcd_resume_root_hub(hcd) from > > ehci_fsl_drv_resume() > > > > drivers/usb/host/ehci-fsl.c | 71 ++++++++++++++++++++++++++++++++- > ------------ > > drivers/usb/host/ehci-fsl.h | 18 ++++++++++++ > > 2 files changed, 69 insertions(+), 20 deletions(-) > > > > static int ehci_fsl_drv_suspend(struct device *dev) > > { > > struct usb_hcd *hcd = dev_get_drvdata(dev); > > - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > > void __iomem *non_ehci = hcd->regs; > > + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > > + struct usb_bus host = hcd->self; > > I just noticed this line. It does not look right at all; it does a > structure copy instead of copying a pointer. my bad...will change to struct usb_bus *host = &hcd->self; > > > > > if (of_device_is_compatible(dev->parent->of_node, > > "fsl,mpc5121-usb2-dr")) { > > return ehci_fsl_mpc512x_drv_suspend(dev); > > } > > > > + if (host.is_otg) { > > + /* remove hcd */ > > + ehci_fsl->hcd_add = 0; > > + schedule_work(&ehci_fsl->change_hcd_work); > > + host.is_otg = 0; > > And here you turn off the flag in the local copy of the structure, > which accomplishes nothing. > agree...will change to host->is_otg = 0; > > + return 0; > > + } > > + > > ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd), > > device_may_wakeup(dev)); > > if (!fsl_deep_sleep()) > > @@ -557,15 +579,24 @@ static int ehci_fsl_drv_suspend(struct device > *dev) > > static int ehci_fsl_drv_resume(struct device *dev) > > { > > struct usb_hcd *hcd = dev_get_drvdata(dev); > > - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > > struct ehci_hcd *ehci = hcd_to_ehci(hcd); > > void __iomem *non_ehci = hcd->regs; > > + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > > + struct usb_bus host = hcd->self; > > Same here. agree > > > --- a/drivers/usb/host/ehci-fsl.h > > +++ b/drivers/usb/host/ehci-fsl.h > > @@ -63,4 +63,22 @@ > > #define UTMI_PHY_EN (1<<9) > > #define ULPI_PHY_CLK_SEL (1<<10) > > #define PHY_CLK_VALID (1<<17) > > + > > +struct ehci_fsl { > > +#ifdef CONFIG_PM > > + /* Saved USB PHY settings, need to restore after deep sleep. */ > > + u32 usb_ctrl; > > +#endif > > Do you need this #ifdef? > Yes, this is required for deep-sleep support...we need to save/restore controller registers during deep-sleep when usb controller power is shut-off. Don't need this during normal usb operation...saving/restoring usb controller registers in non deep-sleep scenario will add unnecessary delays > Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/