From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751944AbbEGSyX (ORCPT ); Thu, 7 May 2015 14:54:23 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:45708 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751555AbbEGSyV (ORCPT ); Thu, 7 May 2015 14:54:21 -0400 Date: Thu, 7 May 2015 13:52:34 -0500 From: Felipe Balbi To: Heikki Krogerus CC: Felipe Balbi , David Cohen , Greg Kroah-Hartman , Stephen Boyd , Baolu Lu , Paul Bolle , , Subject: Re: =?utf-8?B?W82EUEFUQ0h2?= =?utf-8?Q?4?= 09/12] usb: dwc3: pci: add quirk for Baytrails Message-ID: <20150507185234.GF29183@saruman.tx.rr.com> Reply-To: References: <1430979572-14768-1-git-send-email-heikki.krogerus@linux.intel.com> <1430979572-14768-10-git-send-email-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="K/NRh952CO+2tg14" Content-Disposition: inline In-Reply-To: <1430979572-14768-10-git-send-email-heikki.krogerus@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --K/NRh952CO+2tg14 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 07, 2015 at 09:19:29AM +0300, Heikki Krogerus wrote: > On some BYT platforms the USB2 PHY needs to be put into > operational mode by the controller driver with GPIOs > controlling the PHYs reset and cs signals. >=20 > Signed-off-by: Heikki Krogerus > --- > drivers/usb/dwc3/dwc3-pci.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) >=20 > diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c > index b773fb5..0235f46 100644 > --- a/drivers/usb/dwc3/dwc3-pci.c > +++ b/drivers/usb/dwc3/dwc3-pci.c > @@ -21,6 +21,8 @@ > #include > #include > #include > +#include > +#include > =20 > #include "platform_data.h" > =20 > @@ -31,6 +33,15 @@ > #define PCI_DEVICE_ID_INTEL_SPTLP 0x9d30 > #define PCI_DEVICE_ID_INTEL_SPTH 0xa130 > =20 > +static const struct acpi_gpio_params reset_gpios =3D { 0, 0, false }; > +static const struct acpi_gpio_params cs_gpios =3D { 1, 0, false }; > + > +static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] =3D { > + { "reset-gpios", &reset_gpios, 1 }, > + { "cs-gpios", &cs_gpios, 1 }, > + { }, > +}; > + > static int dwc3_pci_quirks(struct pci_dev *pdev) > { > if (pdev->vendor =3D=3D PCI_VENDOR_ID_AMD && > @@ -65,6 +76,30 @@ static int dwc3_pci_quirks(struct pci_dev *pdev) > sizeof(pdata)); > } > =20 > + if (pdev->vendor =3D=3D PCI_VENDOR_ID_INTEL && > + pdev->device =3D=3D PCI_DEVICE_ID_INTEL_BYT) { > + struct gpio_desc *gpio; > + > + acpi_dev_add_driver_gpios(ACPI_COMPANION(&pdev->dev), > + acpi_dwc3_byt_gpios); > + > + /* These GPIOs will turn on the USB2 PHY */ > + gpio =3D gpiod_get(&pdev->dev, "cs"); > + if (!IS_ERR(gpio)) { > + gpiod_direction_output(gpio, 0); > + gpiod_set_value_cansleep(gpio, 1); > + gpiod_put(gpio); > + } > + > + gpio =3D gpiod_get(&pdev->dev, "reset"); > + if (!IS_ERR(gpio)) { > + gpiod_direction_output(gpio, 0); > + gpiod_set_value_cansleep(gpio, 1); > + gpiod_put(gpio); > + msleep(10); WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/t= imers-howto.txt #76: FILE: drivers/usb/dwc3/dwc3-pci.c:99: + msleep(10); looks like usleep_range() is more desirable here. --=20 balbi --K/NRh952CO+2tg14 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVS7RyAAoJEIaOsuA1yqREGbcQAI4Ox5uUVprEpwPXUfUXDuKv KKvW/IimNMOYywwuD52dWI8lr8y3X8zUE3y94sguQOPucMZxRip8b/RuddakcjUO fL16VzagI8bL8nfDrhLefCIgWHqFJeFBYjbp44wpSms/Bb2gZ5mVBrnhC1GvkTtK jAXmUHS8TV+mxnpy04mGJweKIn+crRgeENpytYkThQGktcnhq/bciG4/0ctu23/2 TrnY5RK1VgIFoHOrWYiheRCuGVZ5cUS2zTRQgOQLHvZdfvqnb4fmIJFjv8v1epQi Vx6vR0edYo9vctg0ZOLJRii0AVDLuUC3F2jAgOo7qdB/6aIQKWKoMshi1WtRR9z0 65AxWDEF8oKuQqYsjPQ9+OqqgxxbFc9eJNTk+aRu5kVJMAWgNaTKu1hbQivOzOKT mte36DcgriJ+x8sNV3IqvalUS9rtAJlsbHVirgC61WlYzkhxv1BvMiLCiilhqIad UaHJBhBVtz/dGvWS4OVO3M8AAvE+v8O1yOSCr+TfG5w1i33Xq07DPPI/uh9Fb9sP 5LAjRLFEuTDzRpxZGifroZ8BGolvD/LJdW0r0XChNwZBGkL301rOuAPpy234SuG7 dMr+SnBg/8mouqU76tv+vz2GR/0dS1h/+jyza3vntTOfSYikBpKGL+0I0/V/EH1T AYI9K8rYKVR6nAHCBI/a =0WDY -----END PGP SIGNATURE----- --K/NRh952CO+2tg14--