From 3dda1968136e0a3ebc247900068468d683f07a06 Mon Sep 17 00:00:00 2001 From: Tony LIU Date: Thu, 3 May 2012 10:00:29 +0800 Subject: [PATCH] ENGR00209480-4 mx6sl_usb remove the sw workaround to verify IC fix - add a function to tell if sw walkaround is needed for the IC bug Signed-off-by: Tony LIU --- arch/arm/mach-mx6/usb_dr.c | 14 ++++++++++++-- arch/arm/mach-mx6/usb_h1.c | 15 +++++++++++++-- arch/arm/plat-mxc/usb_common.c | 8 ++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-mx6/usb_dr.c b/arch/arm/mach-mx6/usb_dr.c index 24c8cb9c4d31..0a15a8ce3327 100644 --- a/arch/arm/mach-mx6/usb_dr.c +++ b/arch/arm/mach-mx6/usb_dr.c @@ -32,6 +32,7 @@ static int usbotg_init_ext(struct platform_device *pdev); static void usbotg_uninit_ext(struct platform_device *pdev); static void usbotg_clock_gate(bool on); static void _dr_discharge_line(bool enable); +extern bool usb_icbug_swfix_need(void); /* The usb_phy1_clk do not have enable/disable function at clock.c * and PLL output for usb1's phy should be always enabled. @@ -160,6 +161,9 @@ static int usb_phy_enable(struct fsl_usb2_platform_data *pdata) , phy_reg + HW_USBPHY_CTRL_SET); } + if (!usb_icbug_swfix_need()) + __raw_writel(((1 << 17) | (1 << 18)), + phy_reg + HW_USBPHY_IP_SET); return 0; } /* Notes: configure USB clock*/ @@ -553,6 +557,7 @@ void __init mx6_usb_dr_init(void) { struct platform_device *pdev, *pdev_wakeup; static void __iomem *anatop_base_addr = MX6_IO_ADDRESS(ANATOP_BASE_ADDR); + #ifdef CONFIG_USB_OTG /* wake_up_enable is useless, just for usb_register_remote_wakeup execution*/ dr_utmi_config.wake_up_enable = _device_wakeup_enable; @@ -564,8 +569,13 @@ void __init mx6_usb_dr_init(void) #ifdef CONFIG_USB_EHCI_ARC_OTG dr_utmi_config.operating_mode = DR_HOST_MODE; dr_utmi_config.wake_up_enable = _host_wakeup_enable; - dr_utmi_config.platform_rh_suspend = _host_platform_rh_suspend; - dr_utmi_config.platform_rh_resume = _host_platform_rh_resume; + if (usb_icbug_swfix_need()) { + dr_utmi_config.platform_rh_suspend = _host_platform_rh_suspend; + dr_utmi_config.platform_rh_resume = _host_platform_rh_resume; + } else { + dr_utmi_config.platform_rh_suspend = NULL; + dr_utmi_config.platform_rh_resume = NULL; + } dr_utmi_config.platform_set_disconnect_det = fsl_platform_otg_set_usb_phy_dis; dr_utmi_config.phy_lowpower_suspend = _host_phy_lowpower_suspend; dr_utmi_config.is_wakeup_event = _is_host_wakeup; diff --git a/arch/arm/mach-mx6/usb_h1.c b/arch/arm/mach-mx6/usb_h1.c index 215509867843..bff9a29aef02 100644 --- a/arch/arm/mach-mx6/usb_h1.c +++ b/arch/arm/mach-mx6/usb_h1.c @@ -34,6 +34,7 @@ static struct clk *usb_oh3_clk; extern int clk_get_usecount(struct clk *clk); static struct fsl_usb2_platform_data usbh1_config; +extern bool usb_icbug_swfix_need(void); static void fsl_platform_h1_set_usb_phy_dis( struct fsl_usb2_platform_data *pdata, bool enable) @@ -124,6 +125,9 @@ static int usb_phy_enable(struct fsl_usb2_platform_data *pdata) tmp |= (BM_USBPHY_CTRL_ENUTMILEVEL2 | BM_USBPHY_CTRL_ENUTMILEVEL3); __raw_writel(tmp, phy_reg + HW_USBPHY_CTRL); + if (!usb_icbug_swfix_need()) + __raw_writel(((1 << 17) | (1 << 18)), + phy_reg + HW_USBPHY_IP_SET); return 0; } static int fsl_usb_host_init_ext(struct platform_device *pdev) @@ -329,8 +333,6 @@ static struct fsl_usb2_platform_data usbh1_config = { .power_budget = 500, /* 500 mA max power */ .wake_up_enable = _wake_up_enable, .usb_clock_for_pm = usbh1_clock_gate, - .platform_rh_suspend = usbh1_platform_rh_suspend, - .platform_rh_resume = usbh1_platform_rh_resume, .platform_set_disconnect_det = fsl_platform_h1_set_usb_phy_dis, .phy_lowpower_suspend = _phy_lowpower_suspend, .is_wakeup_event = _is_usbh1_wakeup, @@ -349,7 +351,15 @@ void __init mx6_usb_h1_init(void) { struct platform_device *pdev, *pdev_wakeup; static void __iomem *anatop_base_addr = MX6_IO_ADDRESS(ANATOP_BASE_ADDR); + usbh1_config.wakeup_pdata = &usbh1_wakeup_config; + if (usb_icbug_swfix_need()) { + usbh1_config.platform_rh_suspend = usbh1_platform_rh_suspend; + usbh1_config.platform_rh_resume = usbh1_platform_rh_resume; + } else { + usbh1_config.platform_rh_suspend = NULL; + usbh1_config.platform_rh_resume = NULL; + } if (cpu_is_mx6sl()) pdev = imx6sl_add_fsl_ehci_hs(1, &usbh1_config); else @@ -361,6 +371,7 @@ void __init mx6_usb_h1_init(void) pdev_wakeup = imx6q_add_fsl_usb2_hs_wakeup(1, &usbh1_wakeup_config); ((struct fsl_usb2_platform_data *)(pdev->dev.platform_data))->wakeup_pdata = (struct fsl_usb2_wakeup_platform_data *)(pdev_wakeup->dev.platform_data); + /* Some phy and power's special controls for host1 * 1. The external charger detector needs to be disabled * or the signal at DP will be poor diff --git a/arch/arm/plat-mxc/usb_common.c b/arch/arm/plat-mxc/usb_common.c index 6cf2fa8fb682..b18f5239c8b9 100755 --- a/arch/arm/plat-mxc/usb_common.c +++ b/arch/arm/plat-mxc/usb_common.c @@ -55,6 +55,14 @@ void __iomem *imx_otg_base; #define MXC_NUMBER_USB_TRANSCEIVER 6 struct fsl_xcvr_ops *g_xc_ops[MXC_NUMBER_USB_TRANSCEIVER] = { NULL }; +bool usb_icbug_swfix_need(void) +{ + if (cpu_is_mx6sl()) + return false; + else + return true; +} + enum fsl_usb2_modes get_usb_mode(struct fsl_usb2_platform_data *pdata) { enum fsl_usb2_modes mode; -- 2.39.5