Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752133AbbKKDRN (ORCPT ); Tue, 10 Nov 2015 22:17:13 -0500 Received: from mail-by2on0123.outbound.protection.outlook.com ([207.46.100.123]:24800 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751972AbbKKDRK (ORCPT ); Tue, 10 Nov 2015 22:17:10 -0500 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=freescale.com; Date: Wed, 11 Nov 2015 11:14:46 +0800 From: Peter Chen To: Tim Bird CC: , , , , , , , , , , Subject: Re: [PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port Message-ID: <20151111031445.GA8826@shlinux2> References: <1447202811-3429-1-git-send-email-tim.bird@sonymobile.com> <1447202811-3429-2-git-send-email-tim.bird@sonymobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1447202811-3429-2-git-send-email-tim.bird@sonymobile.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD020;1:3Kyxk0pkFNDE9aJ2sqZ9BtsbJm1OJw34KH+UdKb3/IT+VvRvNGaIop51zx+Vk34ih63eTOUMOP64JQQC8j+K0APPokN0YOmIAvSbhOV4JEPBG8pHLIDYx9sPTJeZK1/uM1l0gZTi+kgc7SabmJvMKx00vnWddEWSlA2P94QqEgSZGRtMY2akPbMCu5jHuwRTPYWCk+XsiwUNHnN/2kIkjLQbC2lp+Bl4tCmSAEPt8BOC6uTD8UjrAz0w7aHYtFV+WBg1pANpr+ZGP4ptvYPvKNzDnadWiqhJlfoKWmm07pXvdyDkA27DEK14ZqHZTylWgM+VMNXsNK4Aol5ShwWFrHyv5YQXAh4b3g9S4t1KHL/Gk5sRG8TXvAMyNeAfmlY0 X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(24454002)(46406003)(104016004)(6806005)(54356999)(86362001)(5007970100001)(189998001)(575784001)(5008740100001)(2950100001)(50986999)(19580405001)(69596002)(19580395003)(105606002)(76176999)(92566002)(11100500001)(83506001)(5001960100002)(47776003)(23726002)(85426001)(87936001)(33716001)(77096005)(97756001)(50466002)(110136002)(4001350100001)(81156007)(97736004)(33656002)(106466001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB555;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB555;2:oIm1ep1xQbIpc8PHYRC+4VRUuAqROPv7E4mLfaHOlbSkItrVWbRUh86tj3PE3qmMHOWgSS6LSGUzpRU+4nDed+U39vHTS/42A+15v5WUbirXL/dtS5UGDtXceCud31tirI1jbS9D6TeyWeUkEZAGyZr9iB3cdHt84IOgiYTymVg=;3:tia+m2IFEWNyrV+83/y+3DhSqBh9Ic6HF7GUq4sfv+/gqDc5aQ5n7vwRn1uKGVg3+k6cMzuotq8ekwfTals5yvrNwyKertsd7BPdBUZ/6JcuTLkyd7TN1cEL6zGVf5Abq/S9wNVp/g+K7SlHe1KRTh4REP5jZqYC9BOA17sPTPlbF6bk+3/HOixybWvtee/bCoRWDkGQ6KnFWMyY+WLQ5jUtsTGdTryHbiJ+od5husE=;25:Rhkes5wvm0891KgG/sHIXITclop+zGn6y2xJBkWViHRRTi9S97uIyNpKp8hSCdahuTBZLtvvF01iUTmxU7BRqqxEUVgCWloCkAVK/CLIx6GVbt7qfChU+b+6YNb+quzBjT77XwigU95SoORqJrqtsRv7MVdqNCCcEMd/Xv/3G/YJrzNTqhGj7XpdoTWCoykUCkmB9atheZx4gQeU2dyx8S+kDrShKfk4hXrXekSTb59hcBY39GeUfXSYdfRgpyze X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB555; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB555;20:ZpClJy4Lka5wgoF8QEeBcP6HB46O1/XehXKQUKZIczYQQuwuCYK8OFeS9yi/ui4DxiuonO+GM2uTJpoVYpHBRW8W7PIkpybKT+yXGprVSO3im/5q36Cu+mOTFfRLZEd4JrZq886ZMozumkxuTE5Mf5G7DkJtcwD0N1RRPSJBEfGjMhteJ6mtxZvh5eVpSmrOiOuhkHGY2Hzhdn8MZT9QGyDomEDKCl2F/IUY5K/3afLqAyE6a6u1DNSwaA53bNhjRVgZ2sEvMmgCRrn55nxTymALMNkrPVuITfqdDEDtHRKOTES9SUrl1C8bRB+YON7zlfnA+sChsoAu3fgL7s2a1b7f1NE1NaQpsYIe9YWhrI8=;4:JcPyPPiHEMQOKD5Y/wNoNIVezfO3o9M5zUMSTqJHga+lI21fJKYhi7Mr3dzHbrKx++fRhr7bT4jQ94dIrzml+8rJ8x+sn5+NkaVfVUCI4X0YblU+6cYpGqFdGMMciPyFjiAd9oyInr+DhhKXabrcUECY7ZdBVhpxjR0i4q5Xhg6NLusyGs9RhEyUy8S30VlU3IE7oe2Efs+EmPnHdzDWKb6QHGOw7hvVhqn7NFjCg4Mnr17EkhCWqHQ8UL8B8Ah8k9ZS4+TDbQW7NMtzUsplHvQFdTq5JX5/DHjyxVKHfIZG8Yl8Q8AF0Q+aoIGKbVmIhPgPQ/rchFSGOKEn9+bGRwf/kd7h7rz3Fk5941/9716heGJv9cXsYNKaiG90dBju X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(10201501046);SRVR:BY2PR03MB555;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB555; X-Forefront-PR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?GnQPqEs5itvZNWtPAr3QzhNasUY1IntH1NsMM0ZHOReN/x8Wy5ibZ/tgL2U8?= =?us-ascii?Q?QIWuKVXmNO56FCkHbgqjmxxoC06VO37EshOD/jgundo3UKmxU5hnRY/mEL9h?= =?us-ascii?Q?S9FjsvoPlLS+vBSRMSAi0ncz2n6GjboHS2i9Ldartay4EbXNF401XOm0+Bjc?= =?us-ascii?Q?0RcLx8YkGj/VFVGceaRBXS2+5cTfa1Ym4VN3E/eVdLH3dLXLb6BJZVrlEdpY?= =?us-ascii?Q?3tVfYbJbx5jSMLSnSI4+IOOAfqnNsYPoh3mmushqHgLZccEcqHaA73mDFWwy?= =?us-ascii?Q?KgV/j/c+8=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB555;5:5j9qtHxBGVGvL+jTwEQ8b+UdgXk2lSmeNu7SyJ2pIxjMSLTiaqsrjAAX6xyBJnrY1rU7T0WqxrDl3H2g6IhdRe3xpTqT+PQ0GfI+/80fyiHcYuMa1uc62V+mID77db7bqTnH3kHRk7okA9dAw+c8ZA==;24:JvZS5aRmm1MV64cCvDzYazxcnJQRsXXaW1dcHkePoS4ogMsVNmN/hbO9zl6N02yKG7zHpNMgPE8xuu1oIQnbNJ+8mBU3M021V21G8Dmfn2U=;20:IQSqip936MHiVC8lTCB7hSHDasY/nhyDQ5ycLNKouwfrUbkKLJKvrCwmTVcnVrsSuSdLca8ZQAUnCmxO/sU6zQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2015 03:17:06.4855 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB555 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3283 Lines: 103 On Tue, Nov 10, 2015 at 04:46:51PM -0800, Tim Bird wrote: > This fixes a bug where if you disconnect and re-connect the USB cable, > the gadget driver stops working. > > Add support for async_irq to wake up driver from low power mode. > Without this, the power management code never calls resume. > Also, have the phy driver kick the gadget driver (chipidea otg) > by having the chipidea driver register with it, for vbus connect > notifications. > > Signed-off-by: Tim Bird > --- > drivers/usb/chipidea/udc.c | 6 ++++++ > drivers/usb/phy/phy-msm-usb.c | 16 ++++++++++++++++ > include/linux/usb/msm_hsusb.h | 1 + > 3 files changed, 23 insertions(+) > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c > index 8223fe7..06234cd 100644 > --- a/drivers/usb/chipidea/udc.c > +++ b/drivers/usb/chipidea/udc.c > @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci) > > ci->gadget.ep0 = &ci->ep0in->ep; > > + if (ci->usb_phy) { > + retval = otg_set_peripheral(ci->usb_phy->otg, &ci->gadget); > + if (retval) > + goto destroy_eps; > + } > + > retval = usb_add_gadget_udc(dev, &ci->gadget); > if (retval) > goto destroy_eps; Although it looks no affect for other drivers, it is better you can split patches between controller and phy, then I can have a test. In fact, most of phy-msm-usb.c's implementations (except USB PHY related) are included in chipidea drivers, hope you can try it in future. > diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c > index 80eb991..eb80f92 100644 > --- a/drivers/usb/phy/phy-msm-usb.c > +++ b/drivers/usb/phy/phy-msm-usb.c > @@ -1731,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev) > return motg->irq; > } > > + motg->async_irq = platform_get_irq_byname(pdev, "async_irq"); > + if (motg->async_irq < 0) { > + dev_info(&pdev->dev, "platform_get_irq for async_irq failed\n"); > + motg->async_irq = 0; > + } > + dev_err > regs[0].supply = "vddcx"; > regs[1].supply = "v3p3"; > regs[2].supply = "v1p8"; > @@ -1780,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev) > goto disable_ldo; > } > > + if (motg->async_irq) { > + ret = devm_request_irq(&pdev->dev, motg->async_irq, > + msm_otg_irq, IRQF_TRIGGER_RISING, > + "msm_otg", motg); > + if (ret) { > + dev_err(&pdev->dev, "request irq failed (ASYNC INT)\n"); > + goto disable_ldo; > + } > + } > + > phy->init = msm_phy_init; > phy->set_power = msm_otg_set_power; > phy->notify_disconnect = msm_phy_notify_disconnect; > diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h > index 8c8f685..08c67a3 100644 > --- a/include/linux/usb/msm_hsusb.h > +++ b/include/linux/usb/msm_hsusb.h > @@ -164,6 +164,7 @@ struct msm_otg { > struct usb_phy phy; > struct msm_otg_platform_data *pdata; > int irq; > + int async_irq; > struct clk *clk; > struct clk *pclk; > struct clk *core_clk; > -- > 1.8.2.2 > -- Best Regards, Peter Chen -- 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/