aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2013-04-23 15:05:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-23 15:50:38 -0400
commitee5d5499edb94cd03738a52a7e234b139da8fd72 (patch)
tree6c6fe301f894625e86afb19ed283d3e2af39c77d /drivers/usb
parent4623245c769662e7cad80e1f9b39dadfbc2ad06d (diff)
usb: phy: tegra: don't call into tegra-ehci directly
Both phy-tegra-usb.c and ehci-tegra.c export symbols used by the other one, which does not work if one of them or both are loadable modules, resulting in an error like: drivers/built-in.o: In function `utmi_phy_clk_disable': drivers/usb/phy/phy-tegra-usb.c:302: undefined reference to `tegra_ehci_set_phcd' drivers/built-in.o: In function `utmi_phy_clk_enable': drivers/usb/phy/phy-tegra-usb.c:324: undefined reference to `tegra_ehci_set_phcd' drivers/built-in.o: In function `utmi_phy_power_on': drivers/usb/phy/phy-tegra-usb.c:447: undefined reference to `tegra_ehci_set_pts' This turns the interface into a one-way dependency by letting the tegra ehci driver pass two function pointers for callbacks that need to be called by the phy driver. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Venu Byravarasu <vbyravarasu@nvidia.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Felipe Balbi <balbi@ti.com> Cc: Stephen Warren <swarren@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-tegra.c10
-rw-r--r--drivers/usb/phy/phy-tegra-usb.c13
2 files changed, 14 insertions, 9 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index ed201ae879cb..e3eddc31ac83 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -611,7 +611,7 @@ static const struct dev_pm_ops tegra_ehci_pm_ops = {
611/* Bits of PORTSC1, which will get cleared by writing 1 into them */ 611/* Bits of PORTSC1, which will get cleared by writing 1 into them */
612#define TEGRA_PORTSC1_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC) 612#define TEGRA_PORTSC1_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
613 613
614void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val) 614static void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val)
615{ 615{
616 unsigned long val; 616 unsigned long val;
617 struct usb_hcd *hcd = bus_to_hcd(x->otg->host); 617 struct usb_hcd *hcd = bus_to_hcd(x->otg->host);
@@ -622,9 +622,8 @@ void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val)
622 val |= TEGRA_USB_PORTSC1_PTS(pts_val & 3); 622 val |= TEGRA_USB_PORTSC1_PTS(pts_val & 3);
623 writel(val, base + TEGRA_USB_PORTSC1); 623 writel(val, base + TEGRA_USB_PORTSC1);
624} 624}
625EXPORT_SYMBOL_GPL(tegra_ehci_set_pts);
626 625
627void tegra_ehci_set_phcd(struct usb_phy *x, bool enable) 626static void tegra_ehci_set_phcd(struct usb_phy *x, bool enable)
628{ 627{
629 unsigned long val; 628 unsigned long val;
630 struct usb_hcd *hcd = bus_to_hcd(x->otg->host); 629 struct usb_hcd *hcd = bus_to_hcd(x->otg->host);
@@ -637,7 +636,6 @@ void tegra_ehci_set_phcd(struct usb_phy *x, bool enable)
637 val &= ~TEGRA_USB_PORTSC1_PHCD; 636 val &= ~TEGRA_USB_PORTSC1_PHCD;
638 writel(val, base + TEGRA_USB_PORTSC1); 637 writel(val, base + TEGRA_USB_PORTSC1);
639} 638}
640EXPORT_SYMBOL_GPL(tegra_ehci_set_phcd);
641 639
642static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); 640static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32);
643 641
@@ -738,7 +736,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
738 736
739 tegra->phy = tegra_usb_phy_open(&pdev->dev, instance, hcd->regs, 737 tegra->phy = tegra_usb_phy_open(&pdev->dev, instance, hcd->regs,
740 pdata->phy_config, 738 pdata->phy_config,
741 TEGRA_USB_PHY_MODE_HOST); 739 TEGRA_USB_PHY_MODE_HOST,
740 tegra_ehci_set_pts,
741 tegra_ehci_set_phcd);
742 if (IS_ERR(tegra->phy)) { 742 if (IS_ERR(tegra->phy)) {
743 dev_err(&pdev->dev, "Failed to open USB phy\n"); 743 dev_err(&pdev->dev, "Failed to open USB phy\n");
744 err = -ENXIO; 744 err = -ENXIO;
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index 5487d38481af..17d811292f3a 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -299,7 +299,7 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
299 val &= ~USB_SUSP_SET; 299 val &= ~USB_SUSP_SET;
300 writel(val, base + USB_SUSP_CTRL); 300 writel(val, base + USB_SUSP_CTRL);
301 } else 301 } else
302 tegra_ehci_set_phcd(&phy->u_phy, true); 302 phy->set_phcd(&phy->u_phy, true);
303 303
304 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0) 304 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0)
305 pr_err("%s: timeout waiting for phy to stabilize\n", __func__); 305 pr_err("%s: timeout waiting for phy to stabilize\n", __func__);
@@ -321,7 +321,7 @@ static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
321 val &= ~USB_SUSP_CLR; 321 val &= ~USB_SUSP_CLR;
322 writel(val, base + USB_SUSP_CTRL); 322 writel(val, base + USB_SUSP_CTRL);
323 } else 323 } else
324 tegra_ehci_set_phcd(&phy->u_phy, false); 324 phy->set_phcd(&phy->u_phy, false);
325 325
326 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 326 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID,
327 USB_PHY_CLK_VALID)) 327 USB_PHY_CLK_VALID))
@@ -444,7 +444,7 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
444 utmi_phy_clk_enable(phy); 444 utmi_phy_clk_enable(phy);
445 445
446 if (!phy->is_legacy_phy) 446 if (!phy->is_legacy_phy)
447 tegra_ehci_set_pts(&phy->u_phy, 0); 447 phy->set_pts(&phy->u_phy, 0);
448 448
449 return 0; 449 return 0;
450} 450}
@@ -688,7 +688,10 @@ static int tegra_usb_phy_suspend(struct usb_phy *x, int suspend)
688} 688}
689 689
690struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, 690struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
691 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode) 691 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode,
692 void (*set_pts)(struct usb_phy *x, u8 pts_val),
693 void (*set_phcd)(struct usb_phy *x, bool enable))
694
692{ 695{
693 struct tegra_usb_phy *phy; 696 struct tegra_usb_phy *phy;
694 unsigned long parent_rate; 697 unsigned long parent_rate;
@@ -707,6 +710,8 @@ struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
707 phy->dev = dev; 710 phy->dev = dev;
708 phy->is_legacy_phy = 711 phy->is_legacy_phy =
709 of_property_read_bool(np, "nvidia,has-legacy-mode"); 712 of_property_read_bool(np, "nvidia,has-legacy-mode");
713 phy->set_pts = set_pts;
714 phy->set_phcd = set_phcd;
710 err = of_property_match_string(np, "phy_type", "ulpi"); 715 err = of_property_match_string(np, "phy_type", "ulpi");
711 if (err < 0) 716 if (err < 0)
712 phy->is_ulpi_phy = false; 717 phy->is_ulpi_phy = false;