]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
ARM: tegra: fix USB ULPI PHY reset signal inversion confusion
authorStephen Warren <swarren@nvidia.com>
Thu, 15 Sep 2016 18:19:37 +0000 (12:19 -0600)
committerTom Warren <twarren@nvidia.com>
Tue, 27 Sep 2016 16:11:03 +0000 (09:11 -0700)
USB ULPI PHY reset signals are typically active low. Consequently, they
should be marked as GPIO_ACTIVE_LOW in device tree, and indeed they are in
the Linux kernel DTs, and in DT properties that U-Boot doesn't yet use.
However, in DT properties that U-Boot does use, the value has been set to
0 (== GPIO_ACTIVE_HIGH) to work around a bug in U-Boot.

This change fixes the DT to correctly represent the HW, and fixes the
Tegra USB driver to cope with the fact that dm_gpio_set_value() internally
handles any inversions implied by the DT value GPIO_ACTIVE_LOW.

Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
arch/arm/dts/tegra20-colibri.dts
arch/arm/dts/tegra20-harmony.dts
drivers/usb/host/ehci-tegra.c

index a291d93c7d01acc89ecb29f7a5def3619123cb29..777f63e5bdb6a6255b44aba317c8445393fc70ac 100644 (file)
@@ -39,7 +39,8 @@
        usb@c5004000 {
                statuc = "okay";
                /* VBUS_LAN */
-               nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) GPIO_ACTIVE_HIGH>;
+               nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
+                       GPIO_ACTIVE_LOW>;
                nvidia,vbus-gpio = <&gpio TEGRA_GPIO(BB, 1) GPIO_ACTIVE_HIGH>;
        };
 
index cace7433948316433d22183cd74bbc2adfda8dac..5aec150b5e6121c144764ad6048dc5e6892a3303 100644 (file)
 
        usb@c5004000 {
                status = "okay";
-               nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) 0>;
+               nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
+                       GPIO_ACTIVE_LOW>;
        };
 
        usb-phy@c5004000 {
index eb54df471d90202fc6a3851d645332d360b5b630..e3620da15fb13974a089834861d4d47d202b2aca 100644 (file)
@@ -600,9 +600,18 @@ static int init_ulpi_usb_controller(struct fdt_usb *config,
 
        /* reset ULPI phy */
        if (dm_gpio_is_valid(&config->phy_reset_gpio)) {
-               dm_gpio_set_value(&config->phy_reset_gpio, 0);
-               mdelay(5);
+               /*
+                * This GPIO is typically active-low, and marked as such in
+                * device tree. dm_gpio_set_value() takes this into account
+                * and inverts the value we pass here if required. In other
+                * words, this first call logically asserts the reset signal,
+                * which typically results in driving the physical GPIO low,
+                * and the second call logically de-asserts the reset signal,
+                * which typically results in driver the GPIO high.
+                */
                dm_gpio_set_value(&config->phy_reset_gpio, 1);
+               mdelay(5);
+               dm_gpio_set_value(&config->phy_reset_gpio, 0);
        }
 
        /* Reset the usb controller */