diff options
author | Tuomas Tynkkynen <ttynkkynen@nvidia.com> | 2013-07-25 14:38:08 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-07-29 06:58:26 -0400 |
commit | 9fdb07f72088ab5fc7bd6fd6f070fac53d636bd9 (patch) | |
tree | c21f392b6731d8f3d074e1d95bab2ed87bc93823 | |
parent | 3b102e8bc0e49d417c7d376af857537080335dbf (diff) |
usb: phy: tegra: Use DT helpers for phy_type
Use the new of_usb_get_phy_mode helper function for parsing phy_type
from the device tree.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/phy/phy-tegra-usb.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index fb5bc8cea680..fb469f1e8d10 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/of_gpio.h> | 31 | #include <linux/of_gpio.h> |
32 | #include <linux/usb/otg.h> | 32 | #include <linux/usb/otg.h> |
33 | #include <linux/usb/ulpi.h> | 33 | #include <linux/usb/ulpi.h> |
34 | #include <linux/usb/of.h> | ||
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
35 | #include <linux/usb/ehci_def.h> | 36 | #include <linux/usb/ehci_def.h> |
36 | #include <linux/usb/tegra_usb_phy.h> | 37 | #include <linux/usb/tegra_usb_phy.h> |
@@ -860,6 +861,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) | |||
860 | struct resource *res; | 861 | struct resource *res; |
861 | struct tegra_usb_phy *tegra_phy = NULL; | 862 | struct tegra_usb_phy *tegra_phy = NULL; |
862 | struct device_node *np = pdev->dev.of_node; | 863 | struct device_node *np = pdev->dev.of_node; |
864 | enum usb_phy_interface phy_type; | ||
863 | int err; | 865 | int err; |
864 | 866 | ||
865 | tegra_phy = devm_kzalloc(&pdev->dev, sizeof(*tegra_phy), GFP_KERNEL); | 867 | tegra_phy = devm_kzalloc(&pdev->dev, sizeof(*tegra_phy), GFP_KERNEL); |
@@ -884,12 +886,12 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) | |||
884 | tegra_phy->is_legacy_phy = | 886 | tegra_phy->is_legacy_phy = |
885 | of_property_read_bool(np, "nvidia,has-legacy-mode"); | 887 | of_property_read_bool(np, "nvidia,has-legacy-mode"); |
886 | 888 | ||
887 | err = of_property_match_string(np, "phy_type", "ulpi"); | 889 | phy_type = of_usb_get_phy_mode(np); |
888 | if (err < 0) { | 890 | if (phy_type == USBPHY_INTERFACE_MODE_UTMI) { |
889 | err = utmi_phy_probe(tegra_phy, pdev); | 891 | err = utmi_phy_probe(tegra_phy, pdev); |
890 | if (err < 0) | 892 | if (err < 0) |
891 | return err; | 893 | return err; |
892 | } else { | 894 | } else if (phy_type == USBPHY_INTERFACE_MODE_ULPI) { |
893 | tegra_phy->is_ulpi_phy = true; | 895 | tegra_phy->is_ulpi_phy = true; |
894 | 896 | ||
895 | tegra_phy->reset_gpio = | 897 | tegra_phy->reset_gpio = |
@@ -899,8 +901,10 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) | |||
899 | tegra_phy->reset_gpio); | 901 | tegra_phy->reset_gpio); |
900 | return tegra_phy->reset_gpio; | 902 | return tegra_phy->reset_gpio; |
901 | } | 903 | } |
902 | |||
903 | tegra_phy->config = NULL; | 904 | tegra_phy->config = NULL; |
905 | } else { | ||
906 | dev_err(&pdev->dev, "phy_type is invalid or unsupported\n"); | ||
907 | return -EINVAL; | ||
904 | } | 908 | } |
905 | 909 | ||
906 | err = of_property_match_string(np, "dr_mode", "otg"); | 910 | err = of_property_match_string(np, "dr_mode", "otg"); |