diff options
-rw-r--r-- | drivers/usb/host/ehci-tegra.c | 27 | ||||
-rw-r--r-- | drivers/usb/phy/tegra_usb_phy.c | 16 | ||||
-rw-r--r-- | include/linux/usb/tegra_usb_phy.h | 8 |
3 files changed, 29 insertions, 22 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index b02622a936c2..568aecc7075b 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -56,7 +56,7 @@ static void tegra_ehci_power_up(struct usb_hcd *hcd) | |||
56 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | 56 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); |
57 | 57 | ||
58 | clk_prepare_enable(tegra->clk); | 58 | clk_prepare_enable(tegra->clk); |
59 | usb_phy_set_suspend(&tegra->phy->u_phy, 0); | 59 | usb_phy_set_suspend(hcd->phy, 0); |
60 | tegra->host_resumed = 1; | 60 | tegra->host_resumed = 1; |
61 | } | 61 | } |
62 | 62 | ||
@@ -65,7 +65,7 @@ static void tegra_ehci_power_down(struct usb_hcd *hcd) | |||
65 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | 65 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); |
66 | 66 | ||
67 | tegra->host_resumed = 0; | 67 | tegra->host_resumed = 0; |
68 | usb_phy_set_suspend(&tegra->phy->u_phy, 1); | 68 | usb_phy_set_suspend(hcd->phy, 1); |
69 | clk_disable_unprepare(tegra->clk); | 69 | clk_disable_unprepare(tegra->clk); |
70 | } | 70 | } |
71 | 71 | ||
@@ -159,7 +159,7 @@ static int tegra_ehci_hub_control( | |||
159 | if (tegra->port_resuming && !(temp & PORT_SUSPEND)) { | 159 | if (tegra->port_resuming && !(temp & PORT_SUSPEND)) { |
160 | /* Resume completed, re-enable disconnect detection */ | 160 | /* Resume completed, re-enable disconnect detection */ |
161 | tegra->port_resuming = 0; | 161 | tegra->port_resuming = 0; |
162 | tegra_usb_phy_postresume(tegra->phy); | 162 | tegra_usb_phy_postresume(hcd->phy); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
@@ -212,7 +212,7 @@ static int tegra_ehci_hub_control( | |||
212 | goto done; | 212 | goto done; |
213 | 213 | ||
214 | /* Disable disconnect detection during port resume */ | 214 | /* Disable disconnect detection during port resume */ |
215 | tegra_usb_phy_preresume(tegra->phy); | 215 | tegra_usb_phy_preresume(hcd->phy); |
216 | 216 | ||
217 | ehci->reset_done[wIndex-1] = jiffies + msecs_to_jiffies(25); | 217 | ehci->reset_done[wIndex-1] = jiffies + msecs_to_jiffies(25); |
218 | 218 | ||
@@ -476,7 +476,7 @@ static int controller_resume(struct device *dev) | |||
476 | } | 476 | } |
477 | 477 | ||
478 | /* Force the phy to keep data lines in suspend state */ | 478 | /* Force the phy to keep data lines in suspend state */ |
479 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | 479 | tegra_ehci_phy_restore_start(hcd->phy, tegra->port_speed); |
480 | 480 | ||
481 | /* Enable host mode */ | 481 | /* Enable host mode */ |
482 | tdi_reset(ehci); | 482 | tdi_reset(ehci); |
@@ -543,17 +543,17 @@ static int controller_resume(struct device *dev) | |||
543 | } | 543 | } |
544 | } | 544 | } |
545 | 545 | ||
546 | tegra_ehci_phy_restore_end(tegra->phy); | 546 | tegra_ehci_phy_restore_end(hcd->phy); |
547 | goto done; | 547 | goto done; |
548 | 548 | ||
549 | restart: | 549 | restart: |
550 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | 550 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) |
551 | tegra_ehci_phy_restore_end(tegra->phy); | 551 | tegra_ehci_phy_restore_end(hcd->phy); |
552 | 552 | ||
553 | tegra_ehci_restart(hcd); | 553 | tegra_ehci_restart(hcd); |
554 | 554 | ||
555 | done: | 555 | done: |
556 | tegra_usb_phy_preresume(tegra->phy); | 556 | tegra_usb_phy_preresume(hcd->phy); |
557 | tegra->port_resuming = 1; | 557 | tegra->port_resuming = 1; |
558 | return 0; | 558 | return 0; |
559 | } | 559 | } |
@@ -740,9 +740,9 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
740 | goto fail_io; | 740 | goto fail_io; |
741 | } | 741 | } |
742 | 742 | ||
743 | usb_phy_init(&tegra->phy->u_phy); | ||
744 | |||
745 | hcd->phy = u_phy = &tegra->phy->u_phy; | 743 | hcd->phy = u_phy = &tegra->phy->u_phy; |
744 | usb_phy_init(hcd->phy); | ||
745 | |||
746 | u_phy->otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), | 746 | u_phy->otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), |
747 | GFP_KERNEL); | 747 | GFP_KERNEL); |
748 | if (!u_phy->otg) { | 748 | if (!u_phy->otg) { |
@@ -752,7 +752,7 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
752 | } | 752 | } |
753 | u_phy->otg->host = hcd_to_bus(hcd); | 753 | u_phy->otg->host = hcd_to_bus(hcd); |
754 | 754 | ||
755 | err = usb_phy_set_suspend(&tegra->phy->u_phy, 0); | 755 | err = usb_phy_set_suspend(hcd->phy, 0); |
756 | if (err) { | 756 | if (err) { |
757 | dev_err(&pdev->dev, "Failed to power on the phy\n"); | 757 | dev_err(&pdev->dev, "Failed to power on the phy\n"); |
758 | goto fail; | 758 | goto fail; |
@@ -798,7 +798,7 @@ fail: | |||
798 | if (!IS_ERR_OR_NULL(tegra->transceiver)) | 798 | if (!IS_ERR_OR_NULL(tegra->transceiver)) |
799 | otg_set_host(tegra->transceiver->otg, NULL); | 799 | otg_set_host(tegra->transceiver->otg, NULL); |
800 | #endif | 800 | #endif |
801 | usb_phy_shutdown(&tegra->phy->u_phy); | 801 | usb_phy_shutdown(hcd->phy); |
802 | fail_io: | 802 | fail_io: |
803 | clk_disable_unprepare(tegra->clk); | 803 | clk_disable_unprepare(tegra->clk); |
804 | fail_clk: | 804 | fail_clk: |
@@ -820,11 +820,10 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
820 | otg_set_host(tegra->transceiver->otg, NULL); | 820 | otg_set_host(tegra->transceiver->otg, NULL); |
821 | #endif | 821 | #endif |
822 | 822 | ||
823 | usb_phy_shutdown(hcd->phy); | ||
823 | usb_remove_hcd(hcd); | 824 | usb_remove_hcd(hcd); |
824 | usb_put_hcd(hcd); | 825 | usb_put_hcd(hcd); |
825 | 826 | ||
826 | usb_phy_shutdown(&tegra->phy->u_phy); | ||
827 | |||
828 | clk_disable_unprepare(tegra->clk); | 827 | clk_disable_unprepare(tegra->clk); |
829 | 828 | ||
830 | return 0; | 829 | return 0; |
diff --git a/drivers/usb/phy/tegra_usb_phy.c b/drivers/usb/phy/tegra_usb_phy.c index d4657045b8b1..5487d38481af 100644 --- a/drivers/usb/phy/tegra_usb_phy.c +++ b/drivers/usb/phy/tegra_usb_phy.c | |||
@@ -759,30 +759,38 @@ err0: | |||
759 | } | 759 | } |
760 | EXPORT_SYMBOL_GPL(tegra_usb_phy_open); | 760 | EXPORT_SYMBOL_GPL(tegra_usb_phy_open); |
761 | 761 | ||
762 | void tegra_usb_phy_preresume(struct tegra_usb_phy *phy) | 762 | void tegra_usb_phy_preresume(struct usb_phy *x) |
763 | { | 763 | { |
764 | struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); | ||
765 | |||
764 | if (!phy->is_ulpi_phy) | 766 | if (!phy->is_ulpi_phy) |
765 | utmi_phy_preresume(phy); | 767 | utmi_phy_preresume(phy); |
766 | } | 768 | } |
767 | EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume); | 769 | EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume); |
768 | 770 | ||
769 | void tegra_usb_phy_postresume(struct tegra_usb_phy *phy) | 771 | void tegra_usb_phy_postresume(struct usb_phy *x) |
770 | { | 772 | { |
773 | struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); | ||
774 | |||
771 | if (!phy->is_ulpi_phy) | 775 | if (!phy->is_ulpi_phy) |
772 | utmi_phy_postresume(phy); | 776 | utmi_phy_postresume(phy); |
773 | } | 777 | } |
774 | EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); | 778 | EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); |
775 | 779 | ||
776 | void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, | 780 | void tegra_ehci_phy_restore_start(struct usb_phy *x, |
777 | enum tegra_usb_phy_port_speed port_speed) | 781 | enum tegra_usb_phy_port_speed port_speed) |
778 | { | 782 | { |
783 | struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); | ||
784 | |||
779 | if (!phy->is_ulpi_phy) | 785 | if (!phy->is_ulpi_phy) |
780 | utmi_phy_restore_start(phy, port_speed); | 786 | utmi_phy_restore_start(phy, port_speed); |
781 | } | 787 | } |
782 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start); | 788 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start); |
783 | 789 | ||
784 | void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy) | 790 | void tegra_ehci_phy_restore_end(struct usb_phy *x) |
785 | { | 791 | { |
792 | struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); | ||
793 | |||
786 | if (!phy->is_ulpi_phy) | 794 | if (!phy->is_ulpi_phy) |
787 | utmi_phy_restore_end(phy); | 795 | utmi_phy_restore_end(phy); |
788 | } | 796 | } |
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h index 9259d4659582..9ebebe906925 100644 --- a/include/linux/usb/tegra_usb_phy.h +++ b/include/linux/usb/tegra_usb_phy.h | |||
@@ -66,14 +66,14 @@ struct tegra_usb_phy { | |||
66 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, | 66 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, |
67 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); | 67 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); |
68 | 68 | ||
69 | void tegra_usb_phy_preresume(struct tegra_usb_phy *phy); | 69 | void tegra_usb_phy_preresume(struct usb_phy *phy); |
70 | 70 | ||
71 | void tegra_usb_phy_postresume(struct tegra_usb_phy *phy); | 71 | void tegra_usb_phy_postresume(struct usb_phy *phy); |
72 | 72 | ||
73 | void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, | 73 | void tegra_ehci_phy_restore_start(struct usb_phy *phy, |
74 | enum tegra_usb_phy_port_speed port_speed); | 74 | enum tegra_usb_phy_port_speed port_speed); |
75 | 75 | ||
76 | void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy); | 76 | void tegra_ehci_phy_restore_end(struct usb_phy *phy); |
77 | 77 | ||
78 | void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val); | 78 | void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val); |
79 | 79 | ||