diff options
author | Ramneek Mehresh <ramneek.mehresh@freescale.com> | 2014-02-28 22:51:28 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-03-12 01:50:51 (GMT) |
commit | e5b3f2153ad11911157444fdba71b70d20561708 (patch) | |
tree | 13d600cf30c7057a883ad076df2bf489adb1f55f /drivers | |
parent | 606232633903c3bec5b6c1590e774ea5526569da (diff) | |
download | linux-fsl-qoriq-e5b3f2153ad11911157444fdba71b70d20561708.tar.xz |
fsl/usb: Modify PHY_CLK_VALID bit usage
PHY_CLK_VALID bit is de-featured for all controller
versions before 2.4, and is only to be used for
internal UTMI phy
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Change-Id: Ie1f5d9f6f75f759e482e6ff39a557ee888ee66ae
Reviewed-on: http://git.am.freescale.net:8181/9299
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Suresh Gupta <suresh.gupta@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ehci-fsl.c | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 1884555..4affcd0 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -52,42 +52,13 @@ struct ehci_fsl { unsigned hcd_add:1; }; -static bool usb_phy_clk_valid(struct usb_hcd *hcd, - enum fsl_usb2_phy_modes phy_mode) +static bool usb_phy_clk_valid(struct usb_hcd *hcd) { void __iomem *non_ehci = hcd->regs; - struct device *dev = hcd->self.controller; - struct fsl_usb2_platform_data *pdata = dev->platform_data; bool ret = true; - int retry = UTMI_PHY_CLK_VALID_CHK_RETRY; - - if (phy_mode == FSL_USB2_PHY_ULPI) { - /* check PHY_CLK_VALID to get phy clk valid */ - if (!(spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) & - PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0) || - in_be32(non_ehci + FSL_SOC_USB_PRICTRL))) { - ret = false; - } - } else if (phy_mode == FSL_USB2_PHY_UTMI) { - if (!(in_be32(non_ehci + FSL_SOC_USB_CTRL) & PHY_CLK_VALID)) { - ret = false; - if (pdata->controller_ver < FSL_USB_VER_2_4) { - while (retry--) { - clrbits32(non_ehci + FSL_SOC_USB_CTRL, - CTRL_UTMI_PHY_EN); - setbits32(non_ehci + FSL_SOC_USB_CTRL, - CTRL_UTMI_PHY_EN); - /* delay required for Clk to appear */ - mdelay(FSL_UTMI_PHY_DLY); - if ((in_be32(non_ehci + - FSL_SOC_USB_CTRL) & PHY_CLK_VALID)) { - ret = true; - break; - } - } - } - } - } + + if (!(in_be32(non_ehci + FSL_SOC_USB_CTRL) & PHY_CLK_VALID)) + ret = false; return ret; } @@ -348,6 +319,15 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, return -EINVAL; } + /* PHY_CLK_VALID bit is de-featured from all controller + * versions below 2.4 and is to be checked only for + * internal UTMI phy */ + if (pdata->controller_ver > FSL_USB_VER_2_4 && + pdata->have_sysif_regs && !usb_phy_clk_valid(hcd)) { + pr_err("fsl-ehci: USB PHY clock invalid\n"); + return -EINVAL; + } + if (pdata->have_sysif_regs && pdata->controller_ver) { /* controller version 1.6 or above */ setbits32(non_ehci + FSL_SOC_USB_CTRL, UTMI_PHY_EN); @@ -364,12 +344,6 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, break; } - if (pdata->have_sysif_regs && pdata->controller_ver && - !usb_phy_clk_valid(hcd, phy_mode)) { - printk(KERN_ERR "fsl-ehci: USB PHY clock invalid\n"); - return -EINVAL; - } - ehci_writel(ehci, portsc, &ehci->regs->port_status[port_offset]); if (phy_mode != FSL_USB2_PHY_ULPI && pdata->have_sysif_regs) |