From mboxrd@z Thu Jan 1 00:00:00 1970 From: Felipe Balbi Subject: Re: [PATCH v1 3/3] usb: phy: msm: Do not do runtime pm if the phy is not idle Date: Mon, 30 Jun 2014 12:56:03 -0500 Message-ID: <20140630175603.GO31442@saruman.home> References: <1404149311-11831-1-git-send-email-srinivas.kandagatla@linaro.org> <1404149397-11970-1-git-send-email-srinivas.kandagatla@linaro.org> Reply-To: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="b1ERR0FXR0PvNIRE" Return-path: Received: from bear.ext.ti.com ([192.94.94.41]:47865 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756930AbaF3R4O (ORCPT ); Mon, 30 Jun 2014 13:56:14 -0400 Content-Disposition: inline In-Reply-To: <1404149397-11970-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Srinivas Kandagatla Cc: linux-usb@vger.kernel.org, Felipe Balbi , gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org --b1ERR0FXR0PvNIRE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 30, 2014 at 06:29:57PM +0100, Srinivas Kandagatla wrote: > Use case is when the phy is configured in host mode and a usb device is > attached to board before bootup. On bootup, with the existing code and > runtime pm enabled, the driver would decrement the pm usage count > without checking the current state of the phy. This pm usage count > decrement would trigger the runtime pm which than would abort the > usb enumeration which was in progress. In my case a usb stick gets > detected and then immediatly the driver goes to low power mode which is > not correct. >=20 > log: > [ 1.631412] msm_hsusb_host 12520000.usb: EHCI Host Controller > [ 1.636556] msm_hsusb_host 12520000.usb: new USB bus registered, assig= ned bus number 1 > [ 1.642563] msm_hsusb_host 12520000.usb: irq 220, io mem 0x12520000 > [ 1.658197] msm_hsusb_host 12520000.usb: USB 2.0 started, EHCI 1.00 > [ 1.659473] hub 1-0:1.0: USB hub found > [ 1.663415] hub 1-0:1.0: 1 port detected > ... > [ 1.973352] usb 1-1: new high-speed USB device number 2 using msm_hsus= b_host > [ 2.107707] usb-storage 1-1:1.0: USB Mass Storage device detected > [ 2.108993] scsi0 : usb-storage 1-1:1.0 > [ 2.678341] msm_otg 12520000.phy: USB in low power mode > [ 3.168977] usb 1-1: USB disconnect, device number 2 >=20 > This issue was detected on IFC6410 board. >=20 > This patch fixes the intial runtime pm trigger by checking the phy > state and decrementing the pm use count only when the phy state is IDLE. >=20 > Signed-off-by: Srinivas Kandagatla > --- > drivers/usb/phy/phy-msm-usb.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c > index 3bb559d..78cc870 100644 > --- a/drivers/usb/phy/phy-msm-usb.c > +++ b/drivers/usb/phy/phy-msm-usb.c > @@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w) > motg->chg_state =3D USB_CHG_STATE_UNDEFINED; > motg->chg_type =3D USB_INVALID_CHARGER; > } > - pm_runtime_put_sync(otg->phy->dev); > + > + if (otg->phy->state =3D=3D OTG_STATE_B_IDLE) > + pm_runtime_put_sync(otg->phy->dev); > break; > case OTG_STATE_B_PERIPHERAL: > dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); does this need to go on this -rc or can it wait until v3.17 merge window? Also, how far back should this be backported ? --=20 balbi --b1ERR0FXR0PvNIRE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTsaSzAAoJEIaOsuA1yqREj6IP/AuWYbe/6CYuRVc10qplglYj ZT7HB32UyDD9aU8Ha+lNOY/2QDv3JPwON9P+f+j2+JBUjBY6yeNRbAbudWqH7Sh9 uO8zmbzaMQKN/T4mb0CoeXNDrMf0FATE5mLSX730uxyJ1jg7K98onHuKeXJqpVRI f5y3Weh4TZ63/jC6eaP8YX2DfRNgUcHt39cBxds+Zu4m7WD0FTwykAtfAFuhb/1P Nz1rhozmmJ0Puv5ZWBUdgrSGt3zO43P4FRzZk3UxBcwx7jRGA1vhhm3Np3kGChHN Evb+gEVNZkqER6f78R/EDbu2ejkJ9MyDPz/FzwYxWp11H45kQ5+RYUoS74LJuLXJ 3BghETX243VEII5+Hgflc8hY/TPo1BEaj4MoyQ3BohkSAr3eVRfpAXnri/KTDrtz My0RE7dhO3cc/c6bOrDkSDI5Gy15PMseS9IxgjCPj1sTOZb+OT7JDHMCotC6PfJr kbXuPFMb/Bmfr5P3SLWNrrInTP7DObWwLlvCFzXkt1qSJIcry7XpXXFbDkWdD2o2 Sp9X2T8m4nOD94P4yUcZ9GiX2iX3a9LCAj2JMn3Q36AGSCjOlrHJpp/hkUIxFc6b f/YqiINKb+fM2+EZkGV4vY7KZenCWgkKq+5R+tdYlIjWjG0aMY/pqC7K6xcRV421 2cHCPuppMMbLrfu0jLyK =ds0l -----END PGP SIGNATURE----- --b1ERR0FXR0PvNIRE--