diff options
author | Venu Byravarasu <vbyravarasu@nvidia.com> | 2013-01-15 22:30:21 -0500 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2013-01-28 13:20:05 -0500 |
commit | 3f9db1a19a8a17f6000973194c6a1d63c5cebf21 (patch) | |
tree | 6e5c67835b165d579cf94c35ca878a096cdca564 /drivers/usb | |
parent | 3a55c6a8b96f055783a1b9d5497f66b56a9ea0d7 (diff) |
USB: PHY: tegra: Get rid of instance number to differentiate PHY type
Tegra20 USB has 3 PHY instances:
Instance 1 and 3 are UTMI. Instance 2 is ULPI.
As instance number was used to differentiate ULPI from UTMI,
used DT param to get this info and processed accordingly.
Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Acked-by: Felipe Balbi <balbi@ti.com>
[swarren: moved assignment of phy->is_ulpi_phy into this patch out
of next patch.]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/phy/tegra_usb_phy.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/usb/phy/tegra_usb_phy.c b/drivers/usb/phy/tegra_usb_phy.c index 79280fe90893..48fa5258ce0b 100644 --- a/drivers/usb/phy/tegra_usb_phy.c +++ b/drivers/usb/phy/tegra_usb_phy.c | |||
@@ -209,11 +209,6 @@ static struct tegra_utmip_config utmip_default[] = { | |||
209 | }, | 209 | }, |
210 | }; | 210 | }; |
211 | 211 | ||
212 | static inline bool phy_is_ulpi(struct tegra_usb_phy *phy) | ||
213 | { | ||
214 | return (phy->instance == 1); | ||
215 | } | ||
216 | |||
217 | static int utmip_pad_open(struct tegra_usb_phy *phy) | 212 | static int utmip_pad_open(struct tegra_usb_phy *phy) |
218 | { | 213 | { |
219 | phy->pad_clk = clk_get_sys("utmip-pad", NULL); | 214 | phy->pad_clk = clk_get_sys("utmip-pad", NULL); |
@@ -655,7 +650,7 @@ static int tegra_phy_init(struct usb_phy *x) | |||
655 | struct tegra_ulpi_config *ulpi_config; | 650 | struct tegra_ulpi_config *ulpi_config; |
656 | int err; | 651 | int err; |
657 | 652 | ||
658 | if (phy_is_ulpi(phy)) { | 653 | if (phy->is_ulpi_phy) { |
659 | ulpi_config = phy->config; | 654 | ulpi_config = phy->config; |
660 | phy->clk = clk_get_sys(NULL, ulpi_config->clk); | 655 | phy->clk = clk_get_sys(NULL, ulpi_config->clk); |
661 | if (IS_ERR(phy->clk)) { | 656 | if (IS_ERR(phy->clk)) { |
@@ -693,7 +688,7 @@ static void tegra_usb_phy_close(struct usb_phy *x) | |||
693 | { | 688 | { |
694 | struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); | 689 | struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); |
695 | 690 | ||
696 | if (phy_is_ulpi(phy)) | 691 | if (phy->is_ulpi_phy) |
697 | clk_put(phy->clk); | 692 | clk_put(phy->clk); |
698 | else | 693 | else |
699 | utmip_pad_close(phy); | 694 | utmip_pad_close(phy); |
@@ -704,7 +699,7 @@ static void tegra_usb_phy_close(struct usb_phy *x) | |||
704 | 699 | ||
705 | static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy) | 700 | static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy) |
706 | { | 701 | { |
707 | if (phy_is_ulpi(phy)) | 702 | if (phy->is_ulpi_phy) |
708 | return ulpi_phy_power_on(phy); | 703 | return ulpi_phy_power_on(phy); |
709 | else | 704 | else |
710 | return utmi_phy_power_on(phy); | 705 | return utmi_phy_power_on(phy); |
@@ -712,7 +707,7 @@ static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy) | |||
712 | 707 | ||
713 | static int tegra_usb_phy_power_off(struct tegra_usb_phy *phy) | 708 | static int tegra_usb_phy_power_off(struct tegra_usb_phy *phy) |
714 | { | 709 | { |
715 | if (phy_is_ulpi(phy)) | 710 | if (phy->is_ulpi_phy) |
716 | return ulpi_phy_power_off(phy); | 711 | return ulpi_phy_power_off(phy); |
717 | else | 712 | else |
718 | return utmi_phy_power_off(phy); | 713 | return utmi_phy_power_off(phy); |
@@ -747,9 +742,14 @@ struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, | |||
747 | phy->dev = dev; | 742 | phy->dev = dev; |
748 | phy->is_legacy_phy = | 743 | phy->is_legacy_phy = |
749 | of_property_read_bool(np, "nvidia,has-legacy-mode"); | 744 | of_property_read_bool(np, "nvidia,has-legacy-mode"); |
745 | err = of_property_match_string(np, "phy_type", "ulpi"); | ||
746 | if (err < 0) | ||
747 | phy->is_ulpi_phy = false; | ||
748 | else | ||
749 | phy->is_ulpi_phy = true; | ||
750 | 750 | ||
751 | if (!phy->config) { | 751 | if (!phy->config) { |
752 | if (phy_is_ulpi(phy)) { | 752 | if (phy->is_ulpi_phy) { |
753 | pr_err("%s: ulpi phy configuration missing", __func__); | 753 | pr_err("%s: ulpi phy configuration missing", __func__); |
754 | err = -EINVAL; | 754 | err = -EINVAL; |
755 | goto err0; | 755 | goto err0; |
@@ -796,14 +796,14 @@ EXPORT_SYMBOL_GPL(tegra_usb_phy_open); | |||
796 | 796 | ||
797 | void tegra_usb_phy_preresume(struct tegra_usb_phy *phy) | 797 | void tegra_usb_phy_preresume(struct tegra_usb_phy *phy) |
798 | { | 798 | { |
799 | if (!phy_is_ulpi(phy)) | 799 | if (!phy->is_ulpi_phy) |
800 | utmi_phy_preresume(phy); | 800 | utmi_phy_preresume(phy); |
801 | } | 801 | } |
802 | EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume); | 802 | EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume); |
803 | 803 | ||
804 | void tegra_usb_phy_postresume(struct tegra_usb_phy *phy) | 804 | void tegra_usb_phy_postresume(struct tegra_usb_phy *phy) |
805 | { | 805 | { |
806 | if (!phy_is_ulpi(phy)) | 806 | if (!phy->is_ulpi_phy) |
807 | utmi_phy_postresume(phy); | 807 | utmi_phy_postresume(phy); |
808 | } | 808 | } |
809 | EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); | 809 | EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); |
@@ -811,14 +811,14 @@ EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); | |||
811 | void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, | 811 | void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, |
812 | enum tegra_usb_phy_port_speed port_speed) | 812 | enum tegra_usb_phy_port_speed port_speed) |
813 | { | 813 | { |
814 | if (!phy_is_ulpi(phy)) | 814 | if (!phy->is_ulpi_phy) |
815 | utmi_phy_restore_start(phy, port_speed); | 815 | utmi_phy_restore_start(phy, port_speed); |
816 | } | 816 | } |
817 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start); | 817 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start); |
818 | 818 | ||
819 | void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy) | 819 | void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy) |
820 | { | 820 | { |
821 | if (!phy_is_ulpi(phy)) | 821 | if (!phy->is_ulpi_phy) |
822 | utmi_phy_restore_end(phy); | 822 | utmi_phy_restore_end(phy); |
823 | } | 823 | } |
824 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end); | 824 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end); |