Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934432AbbEMM3O (ORCPT ); Wed, 13 May 2015 08:29:14 -0400 Received: from mga14.intel.com ([192.55.52.115]:23371 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965057AbbEMM1T (ORCPT ); Wed, 13 May 2015 08:27:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,420,1427785200"; d="scan'208";a="493059224" From: Heikki Krogerus To: Felipe Balbi Cc: David Cohen , Greg Kroah-Hartman , Baolu Lu , Kishon Vijay Abraham I , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: =?UTF-8?q?=5B=CD=84PATCHv5=2009/12=5D=20usb=3A=20dwc3=3A=20pci=3A=20add=20quirk=20for=20Baytrails?= Date: Wed, 13 May 2015 15:26:50 +0300 Message-Id: <1431520013-78645-10-git-send-email-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431520013-78645-1-git-send-email-heikki.krogerus@linux.intel.com> References: <1431520013-78645-1-git-send-email-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2374 Lines: 85 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. Signed-off-by: Heikki Krogerus --- drivers/usb/dwc3/dwc3-pci.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index b773fb5..27e4fc8 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "platform_data.h" @@ -31,6 +33,15 @@ #define PCI_DEVICE_ID_INTEL_SPTLP 0x9d30 #define PCI_DEVICE_ID_INTEL_SPTH 0xa130 +static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; +static const struct acpi_gpio_params cs_gpios = { 1, 0, false }; + +static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = { + { "reset-gpios", &reset_gpios, 1 }, + { "cs-gpios", &cs_gpios, 1 }, + { }, +}; + static int dwc3_pci_quirks(struct pci_dev *pdev) { if (pdev->vendor == PCI_VENDOR_ID_AMD && @@ -65,6 +76,30 @@ static int dwc3_pci_quirks(struct pci_dev *pdev) sizeof(pdata)); } + if (pdev->vendor == PCI_VENDOR_ID_INTEL && + pdev->device == 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 = gpiod_get(&pdev->dev, "cs"); + if (!IS_ERR(gpio)) { + gpiod_direction_output(gpio, 0); + gpiod_set_value_cansleep(gpio, 1); + gpiod_put(gpio); + } + + gpio = gpiod_get(&pdev->dev, "reset"); + if (!IS_ERR(gpio)) { + gpiod_direction_output(gpio, 0); + gpiod_set_value_cansleep(gpio, 1); + gpiod_put(gpio); + usleep_range(10000, 11000); + } + } + return 0; } @@ -128,6 +163,7 @@ err: static void dwc3_pci_remove(struct pci_dev *pci) { + acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pci->dev)); platform_device_unregister(pci_get_drvdata(pci)); } -- 2.1.4 -- 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/