diff options
-rw-r--r-- | arch/arm/mach-mx5/mx50_rdp.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-mx5/usb_dr.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-mx5/usb_h1.c | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/usb_wakeup.c | 9 |
4 files changed, 16 insertions, 4 deletions
diff --git a/arch/arm/mach-mx5/mx50_rdp.c b/arch/arm/mach-mx5/mx50_rdp.c index edd4d7256882..b5b37053a228 100644 --- a/arch/arm/mach-mx5/mx50_rdp.c +++ b/arch/arm/mach-mx5/mx50_rdp.c @@ -1360,8 +1360,7 @@ static void __init mx50_rdp_io_init(void) /* USB OTG PWR */ gpio_request(USB_OTG_PWR, "usb otg power"); - gpio_direction_output(USB_OTG_PWR, 1); - gpio_set_value(USB_OTG_PWR, 0); + gpio_direction_output(USB_OTG_PWR, 0); cspi_keeper.pad_ctrl = 0x0; /* Disable all keepers */ mxc_iomux_v3_setup_pad(&cspi_keeper); diff --git a/arch/arm/mach-mx5/usb_dr.c b/arch/arm/mach-mx5/usb_dr.c index f0dfc6f3149b..c94ace667807 100644 --- a/arch/arm/mach-mx5/usb_dr.c +++ b/arch/arm/mach-mx5/usb_dr.c @@ -177,6 +177,7 @@ static bool _is_host_wakeup(struct fsl_usb2_platform_data *pdata) { int wakeup_req = USBCTRL & UCTRL_OWIR; int otgsc = UOG_OTGSC; + /* if ID change sts, it is a host wakeup event */ if (wakeup_req && (otgsc & OTGSC_IS_USB_ID)) { printk(KERN_INFO "otg host ID wakeup\n"); @@ -184,7 +185,7 @@ static bool _is_host_wakeup(struct fsl_usb2_platform_data *pdata) UOG_OTGSC = otgsc & (~OTGSC_IS_USB_ID); return true; } - if (wakeup_req && /*(UOG_USBSTS & (1<<2)) && */(!((otgsc & OTGSC_IS_B_SESSION_VALID)))) { + if (wakeup_req && (!(otgsc & OTGSC_STS_USB_ID))) { printk(KERN_INFO "otg host Remote wakeup\n"); return true; } @@ -214,6 +215,7 @@ static void usbotg_clock_gate(bool on) clk_disable(usb_oh3_clk); clk_disable(usb_ahb_clk); } + pr_debug("usb_ahb_ref_count:%d, usb_phy_clk1_ref_count:%d\n", clk_get_usecount(usb_ahb_clk), clk_get_usecount(usb_phy1_clk)); } void mx5_set_otghost_vbus_func(driver_vbus_func driver_vbus) @@ -227,6 +229,7 @@ void __init mx5_usb_dr_init(void) /* wake_up_enalbe is useless, just for usb_register_remote_wakeup execution*/ dr_utmi_config.wake_up_enable = _device_wakeup_enable; dr_utmi_config.operating_mode = FSL_USB2_DR_OTG; + dr_utmi_config.wakeup_pdata = &dr_wakeup_config; platform_device_add_data(&mxc_usbdr_otg_device, &dr_utmi_config, sizeof(dr_utmi_config)); platform_device_register(&mxc_usbdr_otg_device); dr_wakeup_config.usb_pdata[0] = mxc_usbdr_otg_device.dev.platform_data; @@ -236,6 +239,7 @@ void __init mx5_usb_dr_init(void) dr_utmi_config.wake_up_enable = _host_wakeup_enable; dr_utmi_config.phy_lowpower_suspend = _host_phy_lowpower_suspend; dr_utmi_config.is_wakeup_event = _is_host_wakeup; + dr_utmi_config.wakeup_pdata = &dr_wakeup_config; platform_device_add_data(&mxc_usbdr_host_device, &dr_utmi_config, sizeof(dr_utmi_config)); platform_device_register(&mxc_usbdr_host_device); dr_wakeup_config.usb_pdata[1] = mxc_usbdr_host_device.dev.platform_data; @@ -245,6 +249,7 @@ void __init mx5_usb_dr_init(void) dr_utmi_config.wake_up_enable = _device_wakeup_enable; dr_utmi_config.phy_lowpower_suspend = _device_phy_lowpower_suspend; dr_utmi_config.is_wakeup_event = _is_device_wakeup; + dr_utmi_config.wakeup_pdata = &dr_wakeup_config; platform_device_add_data(&mxc_usbdr_udc_device, &dr_utmi_config, sizeof(dr_utmi_config)); platform_device_register(&mxc_usbdr_udc_device); dr_wakeup_config.usb_pdata[2] = mxc_usbdr_udc_device.dev.platform_data; diff --git a/arch/arm/mach-mx5/usb_h1.c b/arch/arm/mach-mx5/usb_h1.c index b41a0d0a37a8..1a86ae2e4b1e 100644 --- a/arch/arm/mach-mx5/usb_h1.c +++ b/arch/arm/mach-mx5/usb_h1.c @@ -207,6 +207,7 @@ void __init mx5_usbh1_init(void) usbh1_config.gpio_usb_inactive = gpio_usbh1_inactive; } mxc_register_device(&mxc_usbh1_device, &usbh1_config); + usbh1_config.wakeup_pdata = &usbh1_wakeup_config; mxc_register_device(&mxc_usbh1_wakeup_device, &usbh1_wakeup_config); } diff --git a/arch/arm/plat-mxc/usb_wakeup.c b/arch/arm/plat-mxc/usb_wakeup.c index f2a6704f51d9..d588413b4a14 100644 --- a/arch/arm/plat-mxc/usb_wakeup.c +++ b/arch/arm/plat-mxc/usb_wakeup.c @@ -67,6 +67,7 @@ static void delay_process_wakeup(struct wakeup_ctrl *ctrl) pdata->usb_pdata[i]->irq_delay = 1; } } + pdata->usb_wakeup_is_pending = true; complete(&ctrl->event); } @@ -113,6 +114,8 @@ static void wakeup_event_handler(struct wakeup_ctrl *ctrl) } } wakeup_clk_gate(ctrl->pdata, false); + pdata->usb_wakeup_is_pending = false; + wake_up(&pdata->wq); } static int wakeup_event_thread(void *param) @@ -133,7 +136,7 @@ static int wakeup_event_thread(void *param) return 0; } -static int wakeup_dev_probe(struct platform_device *pdev) +static int wakeup_dev_probe(struct platform_device *pdev) { struct fsl_usb2_wakeup_platform_data *pdata; struct wakeup_ctrl *ctrl = NULL; @@ -147,6 +150,9 @@ static int wakeup_dev_probe(struct platform_device *pdev) if (!ctrl) return -ENOMEM; pdata = pdev->dev.platform_data; + init_waitqueue_head(&pdata->wq); + pdata->usb_wakeup_is_pending = false; + ctrl->pdata = pdata; init_completion(&ctrl->event); ctrl->wakeup_irq = platform_get_irq(pdev, 0); @@ -160,6 +166,7 @@ static int wakeup_dev_probe(struct platform_device *pdev) if (status) goto error2; g_ctrl = ctrl; + printk(KERN_DEBUG "the wakeup pdata is 0x%p\n", pdata); return 0; error2: |