]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: tegra: add USB ULPI PHY reset GPIO to device tree
authorStephen Warren <swarren@nvidia.com>
Thu, 12 Apr 2012 21:46:49 +0000 (15:46 -0600)
committerStephen Warren <swarren@nvidia.com>
Mon, 16 Apr 2012 17:00:39 +0000 (11:00 -0600)
ULPI PHYs have a reset signal, and different boards use a different GPIO
for this task. Add a property to device tree to represent this.

I'm not sure if adding this property to the EHCI controller node is
entirely correct; perhaps eventually we should have explicit separate
nodes for the various PHYs. However, we don't have that right now, so this
binding seems like a reasonable choice.

Cc: <devicetree-discuss@lists.ozlabs.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Documentation/devicetree/bindings/usb/tegra-usb.txt
arch/arm/boot/dts/tegra-harmony.dts
arch/arm/boot/dts/tegra-paz00.dts
arch/arm/boot/dts/tegra-seaboard.dts
arch/arm/boot/dts/tegra-trimslice.dts
arch/arm/boot/dts/tegra-ventana.dts
arch/arm/mach-tegra/include/mach/usb_phy.h
arch/arm/mach-tegra/usb_phy.c
drivers/usb/host/ehci-tegra.c

index 007005ddbe12ddbf5780061a94c243cc915bbcfe..e9b005dc762538073f553cf6a0af0f964017e7e0 100644 (file)
@@ -12,6 +12,9 @@ Required properties :
  - nvidia,vbus-gpio : If present, specifies a gpio that needs to be
    activated for the bus to be powered.
 
+Required properties for phy_type == ulpi:
+  - nvidia,phy-reset-gpio : The GPIO used to reset the PHY.
+
 Optional properties:
   - dr_mode : dual role mode. Indicates the working mode for
    nvidia,tegra20-ehci compatible controllers.  Can be "host", "peripheral",
index 1a0b1f182944b889838ffcd55ce374a721aa5453..59bf1cf6a65ca7153cefc957b5dfa4b3d74571a2 100644 (file)
                power-gpios = <&gpio 70 0>; /* gpio PI6 */
                support-8bit;
        };
+
+       usb@c5004000 {
+               nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */
+       };
 };
index 10943fb2561c905ccf04b3ffe6ff34b3aab8597c..fad92f2dbff07c04904393269d20b7e4a325ef69 100644 (file)
                        linux,default-trigger = "rfkill0";
                };
        };
+
+       usb@c5004000 {
+               nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */
+       };
 };
index ec33116f5df92a5ef2d0dda633b29d3e7218943f..ed0a2f5bf91872f91b3f52d49b3486176bb6e767 100644 (file)
                                0x00000000 0x00000000 0x00000000 0x00000000 >;
                };
        };
+
+       usb@c5004000 {
+               nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */
+       };
 };
index 98efd5b0d7f9a085584e40a43ed366f2bd28e954..71b73aab87ffa679ca1f90bb314f55550f14b067 100644 (file)
                cd-gpios = <&gpio 121 0>;
                wp-gpios = <&gpio 122 0>;
        };
+
+       usb@c5004000 {
+               nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */
+       };
 };
index 71eb2e50a66824b4f8a441c547238132ea154e02..bd074cfb338fbab0be7f49453aa0e8fa6da87a81 100644 (file)
        sdhci@c8000600 {
                support-8bit;
        };
+
+       usb@c5004000 {
+               nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */
+       };
 };
index de1a0f602b2891c5dfd2eeb3b0322c1ba84f3adf..935ce9f6559031b79102eac935376dd3fea3e1a8 100644 (file)
@@ -61,8 +61,8 @@ struct tegra_usb_phy {
        struct usb_phy *ulpi;
 };
 
-struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
-                       void *config, enum tegra_usb_phy_mode phy_mode);
+struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
+       void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode);
 
 int tegra_usb_phy_power_on(struct tegra_usb_phy *phy);
 
index d71d2fed67216227f1958dfa187be7e7fa5a57ad..54e353c8e3042f61e7c487c16f1cd29d22758fb6 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/of_gpio.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 #include <asm/mach-types.h>
@@ -654,8 +655,8 @@ static void ulpi_phy_power_off(struct tegra_usb_phy *phy)
        clk_disable(phy->clk);
 }
 
-struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
-                       void *config, enum tegra_usb_phy_mode phy_mode)
+struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
+       void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode)
 {
        struct tegra_usb_phy *phy;
        struct tegra_ulpi_config *ulpi_config;
@@ -711,6 +712,16 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
                        err = -ENXIO;
                        goto err1;
                }
+               if (!gpio_is_valid(ulpi_config->reset_gpio))
+                       ulpi_config->reset_gpio =
+                               of_get_named_gpio(dev->of_node,
+                                                 "nvidia,phy-reset-gpio", 0);
+               if (!gpio_is_valid(ulpi_config->reset_gpio)) {
+                       pr_err("%s: invalid reset gpio: %d\n", __func__,
+                              ulpi_config->reset_gpio);
+                       err = -EINVAL;
+                       goto err1;
+               }
                gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b");
                gpio_direction_output(ulpi_config->reset_gpio, 0);
                phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
index faed4c4c1c67df10b88045cd97216af71aa0cc7a..2fa375232de7289ba53a28778075fd2378fb1756 100644 (file)
@@ -706,8 +706,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
                }
        }
 
-       tegra->phy = tegra_usb_phy_open(instance, hcd->regs, pdata->phy_config,
-                                               TEGRA_USB_PHY_MODE_HOST);
+       tegra->phy = tegra_usb_phy_open(&pdev->dev, instance, hcd->regs,
+                                       pdata->phy_config,
+                                       TEGRA_USB_PHY_MODE_HOST);
        if (IS_ERR(tegra->phy)) {
                dev_err(&pdev->dev, "Failed to open USB phy\n");
                err = -ENXIO;