aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-04-12 17:46:49 -0400
committerStephen Warren <swarren@nvidia.com>2012-04-25 17:22:09 -0400
commitaa607ebf93a5fc26275a575781399df971dd1b91 (patch)
tree93dcb6f1af5f6d7e64663a4ce9e45e889866309e
parent60d148b9f838b718e4808061ee6d5833de77fd9c (diff)
ARM: tegra: add USB ULPI PHY reset GPIO to device tree
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>
-rw-r--r--Documentation/devicetree/bindings/usb/tegra-usb.txt3
-rw-r--r--arch/arm/boot/dts/tegra-harmony.dts4
-rw-r--r--arch/arm/boot/dts/tegra-paz00.dts4
-rw-r--r--arch/arm/boot/dts/tegra-seaboard.dts4
-rw-r--r--arch/arm/boot/dts/tegra-trimslice.dts4
-rw-r--r--arch/arm/boot/dts/tegra-ventana.dts4
-rw-r--r--arch/arm/mach-tegra/include/mach/usb_phy.h4
-rw-r--r--arch/arm/mach-tegra/usb_phy.c15
-rw-r--r--drivers/usb/host/ehci-tegra.c5
9 files changed, 41 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/usb/tegra-usb.txt b/Documentation/devicetree/bindings/usb/tegra-usb.txt
index 007005ddbe12..e9b005dc7625 100644
--- a/Documentation/devicetree/bindings/usb/tegra-usb.txt
+++ b/Documentation/devicetree/bindings/usb/tegra-usb.txt
@@ -12,6 +12,9 @@ Required properties :
12 - nvidia,vbus-gpio : If present, specifies a gpio that needs to be 12 - nvidia,vbus-gpio : If present, specifies a gpio that needs to be
13 activated for the bus to be powered. 13 activated for the bus to be powered.
14 14
15Required properties for phy_type == ulpi:
16 - nvidia,phy-reset-gpio : The GPIO used to reset the PHY.
17
15Optional properties: 18Optional properties:
16 - dr_mode : dual role mode. Indicates the working mode for 19 - dr_mode : dual role mode. Indicates the working mode for
17 nvidia,tegra20-ehci compatible controllers. Can be "host", "peripheral", 20 nvidia,tegra20-ehci compatible controllers. Can be "host", "peripheral",
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts
index 1a0b1f182944..59bf1cf6a65c 100644
--- a/arch/arm/boot/dts/tegra-harmony.dts
+++ b/arch/arm/boot/dts/tegra-harmony.dts
@@ -336,4 +336,8 @@
336 power-gpios = <&gpio 70 0>; /* gpio PI6 */ 336 power-gpios = <&gpio 70 0>; /* gpio PI6 */
337 support-8bit; 337 support-8bit;
338 }; 338 };
339
340 usb@c5004000 {
341 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */
342 };
339}; 343};
diff --git a/arch/arm/boot/dts/tegra-paz00.dts b/arch/arm/boot/dts/tegra-paz00.dts
index 10943fb2561c..fad92f2dbff0 100644
--- a/arch/arm/boot/dts/tegra-paz00.dts
+++ b/arch/arm/boot/dts/tegra-paz00.dts
@@ -351,4 +351,8 @@
351 linux,default-trigger = "rfkill0"; 351 linux,default-trigger = "rfkill0";
352 }; 352 };
353 }; 353 };
354
355 usb@c5004000 {
356 nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */
357 };
354}; 358};
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
index ec33116f5df9..ed0a2f5bf918 100644
--- a/arch/arm/boot/dts/tegra-seaboard.dts
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -415,4 +415,8 @@
415 0x00000000 0x00000000 0x00000000 0x00000000 >; 415 0x00000000 0x00000000 0x00000000 0x00000000 >;
416 }; 416 };
417 }; 417 };
418
419 usb@c5004000 {
420 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */
421 };
418}; 422};
diff --git a/arch/arm/boot/dts/tegra-trimslice.dts b/arch/arm/boot/dts/tegra-trimslice.dts
index 98efd5b0d7f9..71b73aab87ff 100644
--- a/arch/arm/boot/dts/tegra-trimslice.dts
+++ b/arch/arm/boot/dts/tegra-trimslice.dts
@@ -304,4 +304,8 @@
304 cd-gpios = <&gpio 121 0>; 304 cd-gpios = <&gpio 121 0>;
305 wp-gpios = <&gpio 122 0>; 305 wp-gpios = <&gpio 122 0>;
306 }; 306 };
307
308 usb@c5004000 {
309 nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */
310 };
307}; 311};
diff --git a/arch/arm/boot/dts/tegra-ventana.dts b/arch/arm/boot/dts/tegra-ventana.dts
index 71eb2e50a668..bd074cfb338f 100644
--- a/arch/arm/boot/dts/tegra-ventana.dts
+++ b/arch/arm/boot/dts/tegra-ventana.dts
@@ -335,4 +335,8 @@
335 sdhci@c8000600 { 335 sdhci@c8000600 {
336 support-8bit; 336 support-8bit;
337 }; 337 };
338
339 usb@c5004000 {
340 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */
341 };
338}; 342};
diff --git a/arch/arm/mach-tegra/include/mach/usb_phy.h b/arch/arm/mach-tegra/include/mach/usb_phy.h
index de1a0f602b28..935ce9f65590 100644
--- a/arch/arm/mach-tegra/include/mach/usb_phy.h
+++ b/arch/arm/mach-tegra/include/mach/usb_phy.h
@@ -61,8 +61,8 @@ struct tegra_usb_phy {
61 struct usb_phy *ulpi; 61 struct usb_phy *ulpi;
62}; 62};
63 63
64struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, 64struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
65 void *config, enum tegra_usb_phy_mode phy_mode); 65 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode);
66 66
67int tegra_usb_phy_power_on(struct tegra_usb_phy *phy); 67int tegra_usb_phy_power_on(struct tegra_usb_phy *phy);
68 68
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index d71d2fed6721..54e353c8e304 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -26,6 +26,7 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/of_gpio.h>
29#include <linux/usb/otg.h> 30#include <linux/usb/otg.h>
30#include <linux/usb/ulpi.h> 31#include <linux/usb/ulpi.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -654,8 +655,8 @@ static void ulpi_phy_power_off(struct tegra_usb_phy *phy)
654 clk_disable(phy->clk); 655 clk_disable(phy->clk);
655} 656}
656 657
657struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, 658struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
658 void *config, enum tegra_usb_phy_mode phy_mode) 659 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode)
659{ 660{
660 struct tegra_usb_phy *phy; 661 struct tegra_usb_phy *phy;
661 struct tegra_ulpi_config *ulpi_config; 662 struct tegra_ulpi_config *ulpi_config;
@@ -711,6 +712,16 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
711 err = -ENXIO; 712 err = -ENXIO;
712 goto err1; 713 goto err1;
713 } 714 }
715 if (!gpio_is_valid(ulpi_config->reset_gpio))
716 ulpi_config->reset_gpio =
717 of_get_named_gpio(dev->of_node,
718 "nvidia,phy-reset-gpio", 0);
719 if (!gpio_is_valid(ulpi_config->reset_gpio)) {
720 pr_err("%s: invalid reset gpio: %d\n", __func__,
721 ulpi_config->reset_gpio);
722 err = -EINVAL;
723 goto err1;
724 }
714 gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b"); 725 gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b");
715 gpio_direction_output(ulpi_config->reset_gpio, 0); 726 gpio_direction_output(ulpi_config->reset_gpio, 0);
716 phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); 727 phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 9692bef159f5..14532fe04f5e 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -708,8 +708,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
708 } 708 }
709 } 709 }
710 710
711 tegra->phy = tegra_usb_phy_open(instance, hcd->regs, pdata->phy_config, 711 tegra->phy = tegra_usb_phy_open(&pdev->dev, instance, hcd->regs,
712 TEGRA_USB_PHY_MODE_HOST); 712 pdata->phy_config,
713 TEGRA_USB_PHY_MODE_HOST);
713 if (IS_ERR(tegra->phy)) { 714 if (IS_ERR(tegra->phy)) {
714 dev_err(&pdev->dev, "Failed to open USB phy\n"); 715 dev_err(&pdev->dev, "Failed to open USB phy\n");
715 err = -ENXIO; 716 err = -ENXIO;