diff options
author | Peter Chen <peter.chen@freescale.com> | 2011-07-04 16:03:24 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-01-09 20:18:34 +0800 |
commit | dc3fc8364c3abd05d5b0da7a0f4be0422ae7fb32 (patch) | |
tree | 044ca3dbcfa5a0b22b54cd51d2d3495d1c5a08ab /arch/arm/mach-mx5 | |
parent | 0d1df2c18713cc803adbf78edd79302a8b113bca (diff) |
ENGR00152512 mx5x: Update some newest usb changes from 2.6.35 to 2.6.38
Besides, it enables mx50 usb functions at rdp board
And add mxc (except for mx6q) phy specific register file
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Diffstat (limited to 'arch/arm/mach-mx5')
-rwxr-xr-x | arch/arm/mach-mx5/board-mx50_rdp.c | 31 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/usb_dr.c | 41 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/usb_h1.c | 8 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/usb_h2.c | 8 |
4 files changed, 58 insertions, 30 deletions
diff --git a/arch/arm/mach-mx5/board-mx50_rdp.c b/arch/arm/mach-mx5/board-mx50_rdp.c index bbe968743821..c3b930922464 100755 --- a/arch/arm/mach-mx5/board-mx50_rdp.c +++ b/arch/arm/mach-mx5/board-mx50_rdp.c @@ -43,6 +43,7 @@ #include "devices-imx50.h" #include "cpu_op-mx50.h" #include "devices.h" +#include "usb.h" #include "crm_regs.h" #define FEC_EN IMX_GPIO_NR(6, 23) @@ -88,8 +89,9 @@ #define MX50_RDP_SD1_WP IMX_GPIO_NR(4, 19) /*GPIO_4_19 */ #define MX50_RDP_SD1_CD IMX_GPIO_NR(1, 27) /*GPIO_1_27 */ #define MX50_RDP_SD2_WP IMX_GPIO_NR(5, 16) /*GPIO_5_16 */ -#define MX50_RDP_SD2_CD IMX_GPIO_NR(5, 17) /*GPIO_5_17 */ -#define MX50_RDP_SD3_WP IMX_GPIO_NR(5, 28) /*GPIO_5_28 */ +#define MX50_RDP_SD2_CD IMX_GPIO_NR(5, 17) /*GPIO_5_17 */ +#define MX50_RDP_SD3_WP IMX_GPIO_NR(5, 28) /*GPIO_5_28 */ +#define MX50_RDP_USB_OTG_PWR IMX_GPIO_NR(6, 25) /*GPIO_6_25*/ extern struct dvfs_op *(*get_dvfs_core_op)(int *wp); @@ -782,6 +784,30 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, get_dvfs_core_op = mx50_rdp_get_dvfs_core_table; } +static void mx50_rdp_usbotg_vbus(bool on) +{ + if (on) + gpio_set_value(MX50_RDP_USB_OTG_PWR, 1); + else + gpio_set_value(MX50_RDP_USB_OTG_PWR, 0); +} + +static void __init mx50_rdp_init_usb(void) +{ + int ret = 0; + + imx_otg_base = MX50_IO_ADDRESS(MX50_OTG_BASE_ADDR); + ret = gpio_request(MX50_RDP_USB_OTG_PWR, "usb-pwr"); + if (ret) { + printk(KERN_ERR"failed to get GPIO OTG_VBUS: %d\n", ret); + return; + } + gpio_direction_output(MX50_RDP_USB_OTG_PWR, 0); + + mx5_set_otghost_vbus_func(mx50_rdp_usbotg_vbus); + mx5_usb_dr_init(); + mx5_usbh1_init(); +} /* * Board specific initialization. */ @@ -826,6 +852,7 @@ static void __init mx50_rdp_board_init(void) imx50_add_dvfs_core(&rdp_dvfscore_data); imx50_add_busfreq(&rdp_bus_freq_data); + mx50_rdp_init_usb(); } static void __init mx50_rdp_timer_init(void) diff --git a/arch/arm/mach-mx5/usb_dr.c b/arch/arm/mach-mx5/usb_dr.c index 3dd51d36b7e0..25e63caea945 100755 --- a/arch/arm/mach-mx5/usb_dr.c +++ b/arch/arm/mach-mx5/usb_dr.c @@ -178,7 +178,6 @@ static void usbotg_wakeup_event_clear(void) #ifdef CONFIG_USB_EHCI_ARC_OTG -extern void fsl_usb_recover_hcd(struct platform_device *pdev); /* Beginning of host related operation for DR port */ static void _host_wakeup_enable(struct fsl_usb2_platform_data *pdata, bool enable) { @@ -203,8 +202,8 @@ static void _host_phy_lowpower_suspend(struct fsl_usb2_platform_data *pdata, boo static enum usb_wakeup_event _is_host_wakeup(struct fsl_usb2_platform_data *pdata) { - int wakeup_req = USBCTRL & UCTRL_OWIR; - int otgsc = UOG_OTGSC; + u32 wakeup_req = USBCTRL & UCTRL_OWIR; + u32 otgsc = UOG_OTGSC; /* if ID change sts, it is a host wakeup event */ if (wakeup_req && (otgsc & OTGSC_IS_USB_ID)) { @@ -225,7 +224,7 @@ static void host_wakeup_handler(struct fsl_usb2_platform_data *pdata) { _host_wakeup_enable(pdata, false); _host_phy_lowpower_suspend(pdata, false); - fsl_usb_recover_hcd(&mxc_usbdr_host_device); + pdata->wakeup_event = 1; } /* End of host related operation for DR port */ #endif /* CONFIG_USB_EHCI_ARC_OTG */ @@ -258,17 +257,29 @@ static void _device_phy_lowpower_suspend(struct fsl_usb2_platform_data *pdata, b static enum usb_wakeup_event _is_device_wakeup(struct fsl_usb2_platform_data *pdata) { int wakeup_req = USBCTRL & UCTRL_OWIR; - u32 otgsc = 0; - - otgsc = UOG_OTGSC; - if (wakeup_req && - (otgsc & OTGSC_STS_USB_ID) && - (otgsc & OTGSC_IS_B_SESSION_VALID)) { - printk(KERN_INFO "otg udc wakeup\n"); - return WAKEUP_EVENT_VBUS; + + pr_debug("the otgsc is 0x%x, usbsts is 0x%x, portsc is 0x%x, wakeup_irq is 0x%x\n", UOG_OTGSC, UOG_USBSTS, UOG_PORTSC1, wakeup_req); + + /* if ID=1, it is a device wakeup event */ + if (wakeup_req && (UOG_OTGSC & OTGSC_STS_USB_ID) && (UOG_PORTSC1 & PORTSC_PORT_FORCE_RESUME)) { + printk(KERN_INFO "otg udc wakeup, host sends resume signal\n"); + return true; + } + if (wakeup_req && (UOG_OTGSC & OTGSC_STS_USB_ID) && (UOG_USBSTS & USBSTS_URI)) { + printk(KERN_INFO "otg udc wakeup, host sends reset signal\n"); + return true; + } + if (wakeup_req && (UOG_OTGSC & OTGSC_STS_USB_ID) && (UOG_OTGSC & OTGSC_STS_A_VBUS_VALID) \ + && (UOG_OTGSC & OTGSC_IS_B_SESSION_VALID)) { + printk(KERN_INFO "otg udc vbus rising wakeup\n"); + return true; + } + if (wakeup_req && (UOG_OTGSC & OTGSC_STS_USB_ID) && !(UOG_OTGSC & OTGSC_STS_A_VBUS_VALID)) { + printk(KERN_INFO "otg udc vbus falling wakeup\n"); + return true; } - return WAKEUP_EVENT_INVALID; + return WAKEUP_EVENT_INVALID; } static void device_wakeup_handler(struct fsl_usb2_platform_data *pdata) @@ -295,7 +306,9 @@ void __init mx5_usb_dr_init(void) dr_utmi_config.operating_mode = FSL_USB2_DR_OTG; dr_utmi_config.wakeup_pdata = &dr_wakeup_config; ret |= platform_device_add_data(&mxc_usbdr_otg_device, &dr_utmi_config, sizeof(dr_utmi_config)); - ret |= platform_device_register(&mxc_usbdr_otg_device); + if (!machine_is_mx53_loco()) { + ret |= platform_device_register(&mxc_usbdr_otg_device); + } dr_wakeup_config.usb_pdata[0] = mxc_usbdr_otg_device.dev.platform_data; #endif #ifdef CONFIG_USB_EHCI_ARC_OTG diff --git a/arch/arm/mach-mx5/usb_h1.c b/arch/arm/mach-mx5/usb_h1.c index 21ee87bd8f55..3d692e90df00 100755 --- a/arch/arm/mach-mx5/usb_h1.c +++ b/arch/arm/mach-mx5/usb_h1.c @@ -35,12 +35,6 @@ extern int clk_get_usecount(struct clk *clk); #define MX5X_USBH1_STP IMX_GPIO_NR(1, 27) #define MX51_3DS_PHY_RESET IMX_GPIO_NR(2, 5) -#ifdef CONFIG_USB_EHCI_ARC -extern void fsl_usb_recover_hcd(struct platform_device *pdev); -#else -static void fsl_usb_recover_hcd(struct platform_device *pdev) -{; } -#endif /* * USB Host1 HS port */ @@ -139,7 +133,7 @@ static void h1_wakeup_handler(struct fsl_usb2_platform_data *pdata) { _wake_up_enable(pdata, false); _phy_lowpower_suspend(pdata, false); - fsl_usb_recover_hcd(&mxc_usbh1_device); + pdata->wakeup_event = 1; } static void usbh1_wakeup_event_clear(void) diff --git a/arch/arm/mach-mx5/usb_h2.c b/arch/arm/mach-mx5/usb_h2.c index b7f146a5d564..37e847640a7b 100755 --- a/arch/arm/mach-mx5/usb_h2.c +++ b/arch/arm/mach-mx5/usb_h2.c @@ -26,12 +26,6 @@ #define MX5X_USBH2_STP IMX_GPIO_NR(2, 20) -#ifdef CONFIG_USB_EHCI_ARC -extern void fsl_usb_recover_hcd(struct platform_device *pdev); -#else -static void fsl_usb_recover_hcd(struct platform_device *pdev) -{; } -#endif /* * USB Host2 HS port */ @@ -119,7 +113,7 @@ static void h2_wakeup_handler(struct fsl_usb2_platform_data *pdata) { _wake_up_enable(pdata, false); _phy_lowpower_suspend(pdata, false); - fsl_usb_recover_hcd(&mxc_usbh2_device); + pdata->wakeup_event = 1; } static void usbh2_wakeup_event_clear(void) |