]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
usb: ehci-tegra: Add vbus_gpio to platform data
authorStephen Warren <swarren@nvidia.com>
Fri, 16 Mar 2012 22:06:07 +0000 (16:06 -0600)
committerStephen Warren <swarren@nvidia.com>
Wed, 18 Apr 2012 16:26:37 +0000 (10:26 -0600)
Add a vbus_gpio field to platform data. This mirrors the device tree
property nvidia,vbus-gpio. This makes the VBUS GPIO handling identical
between booting with board files and device tree; the driver always does
it.

This removes the need for board files to request and initialize the GPIO
early during their boot process, perhaps even before the GPIO driver is
ready to process the request.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Olof Johansson <olof@lixom.net>
arch/arm/mach-tegra/devices.c
drivers/usb/host/ehci-tegra.c
include/linux/platform_data/tegra_usb.h

index 5f6b867e20b49c77c2635017e44b6dc0d8eeafe1..748b40cb7fcfe89cdfbfec2914b6255ca287e535 100644 (file)
@@ -448,17 +448,20 @@ static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
 struct tegra_ehci_platform_data tegra_ehci1_pdata = {
        .operating_mode = TEGRA_USB_OTG,
        .power_down_on_bus_suspend = 1,
+       .vbus_gpio = -1,
 };
 
 struct tegra_ehci_platform_data tegra_ehci2_pdata = {
        .phy_config = &tegra_ehci2_ulpi_phy_config,
        .operating_mode = TEGRA_USB_HOST,
        .power_down_on_bus_suspend = 1,
+       .vbus_gpio = -1,
 };
 
 struct tegra_ehci_platform_data tegra_ehci3_pdata = {
        .operating_mode = TEGRA_USB_HOST,
        .power_down_on_bus_suspend = 1,
+       .vbus_gpio = -1,
 };
 
 static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32);
index 73544bd440bd09cfaca5d50ebd1daf862266dc3a..9692bef159f540a0b1973b7828cfcf2007b0985d 100644 (file)
@@ -581,15 +581,16 @@ static const struct hc_driver tegra_ehci_hc_driver = {
        .port_handed_over       = ehci_port_handed_over,
 };
 
-static int setup_vbus_gpio(struct platform_device *pdev)
+static int setup_vbus_gpio(struct platform_device *pdev,
+                          struct tegra_ehci_platform_data *pdata)
 {
        int err = 0;
        int gpio;
 
-       if (!pdev->dev.of_node)
-               return 0;
-
-       gpio = of_get_named_gpio(pdev->dev.of_node, "nvidia,vbus-gpio", 0);
+       gpio = pdata->vbus_gpio;
+       if (!gpio_is_valid(gpio))
+               gpio = of_get_named_gpio(pdev->dev.of_node,
+                                        "nvidia,vbus-gpio", 0);
        if (!gpio_is_valid(gpio))
                return 0;
 
@@ -633,7 +634,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
        if (!pdev->dev.dma_mask)
                pdev->dev.dma_mask = &tegra_ehci_dma_mask;
 
-       setup_vbus_gpio(pdev);
+       setup_vbus_gpio(pdev, pdata);
 
        tegra = kzalloc(sizeof(struct tegra_ehci_hcd), GFP_KERNEL);
        if (!tegra)
index 6bca5b569acb57f84e75ab648680f4d4540323db..66c673fef4084ba8a9a7c254bbb864516b673911 100644 (file)
@@ -26,6 +26,7 @@ struct tegra_ehci_platform_data {
        /* power down the phy on bus suspend */
        int power_down_on_bus_suspend;
        void *phy_config;
+       int vbus_gpio;
 };
 
 #endif /* _TEGRA_USB_H_ */