While looking at the phy-msm-usb driver, I noticed that its registers
are also accessed by teh ehci-msm driver, basically duplicating part
of the logic that is already present in the phy driver.

This removes the duplicate code from the ehci driver and instead
calls the usb_phy_init() function.

I did not test this change, so please review the patch carefully
and wait for a positive test result before applying.

Signed-off-by: Arnd Bergmann <[email protected]>
---
 drivers/usb/host/ehci-msm.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index d3afc89d00f5..4a9f31f77c46 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -30,15 +30,12 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/usb/otg.h>
-#include <linux/usb/msm_hsusb_hw.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/acpi.h>
 
 #include "ehci.h"
 
-#define MSM_USB_BASE (hcd->regs)
-
 #define DRIVER_DESC "Qualcomm On-Chip EHCI Host Controller"
 
 static const char hcd_name[] = "ehci-msm";
@@ -49,24 +46,13 @@ static int ehci_msm_reset(struct usb_hcd *hcd)
        struct ehci_hcd *ehci = hcd_to_ehci(hcd);
        int retval;
 
-       ehci->caps = USB_CAPLENGTH;
+       ehci->caps = hcd->regs + 0x100;
        hcd->has_tt = 1;
 
        retval = ehci_setup(hcd);
        if (retval)
                return retval;
 
-       /* select ULPI phy and clear other status/control bits in PORTSC */
-       writel(PORTSC_PTS_ULPI, USB_PORTSC);
-       /* bursts of unspecified length. */
-       writel(0, USB_AHBBURST);
-       /* Use the AHB transactor, allow posted data writes */
-       writel(0x8, USB_AHBMODE);
-       /* Disable streaming mode and select host mode */
-       writel(0x13, USB_USBMODE);
-       /* Disable ULPI_TX_PKT_EN_CLR_FIX which is valid only for HSIC */
-       writel(readl(USB_GENCONFIG_2) & ~ULPI_TX_PKT_EN_CLR_FIX, 
USB_GENCONFIG_2);
-
        return 0;
 }
 
@@ -144,6 +130,7 @@ static int ehci_msm_probe(struct platform_device *pdev)
                pm_runtime_no_callbacks(&pdev->dev);
                pm_runtime_enable(&pdev->dev);
        } else {
+               usb_phy_init(phy);
                ret = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
                if (ret)
                        goto put_hcd;
-- 
2.7.0

Reply via email to