diff options
author | Dan Willemsen <dwillemsen@nvidia.com> | 2011-10-25 13:28:46 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:49:30 -0800 |
commit | 2f3e0d74d640524c8f7d889642268d0d9b7ae431 (patch) | |
tree | 9417945aac95f30fae6a5c381433d445231e5061 /drivers/usb/gadget | |
parent | 6a014a1c5cd02aa7592733e661ba034ab692e94a (diff) |
HACK: Revert "USB: extend ehci-fsl and fsl_udc_core driver for OTG operation"
This reverts commit 83722bc9430424de1614ff31696f73a40b3d81a9.
Our OTG support doesn't play nice with the upstreamed OTG support, so
for now, revert the upstream commit.
Conflicts:
drivers/usb/gadget/fsl_udc_core.c
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
Rebase-Id: R5a4b466ee983307ee277a591e664c854b0ddd970
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/fsl_udc_core.c | 148 | ||||
-rw-r--r-- | drivers/usb/gadget/fsl_usb2_udc.h | 2 |
2 files changed, 16 insertions, 134 deletions
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 4c1657a8505e..66bcef636096 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -492,19 +492,6 @@ static void dr_controller_stop(struct fsl_udc *udc) { unsigned int tmp; - pr_debug("%s\n", __func__); - - /* if we're in OTG mode, and the Host is currently using the port, - * stop now and don't rip the controller out from under the - * ehci driver - */ - if (udc->gadget.is_otg) { - if (!(fsl_readl(&dr_regs->otgsc) & OTGSC_STS_USB_ID)) { - pr_debug("udc: Leaving early\n"); - return; - } - } - /* Clear pending interrupt status bits */ tmp = fsl_readl(&dr_regs->usbsts); fsl_writel(tmp, &dr_regs->usbsts); @@ -2086,9 +2073,6 @@ static void port_change_irq(struct fsl_udc *udc) { u32 speed; - if (udc->bus_reset) - udc->bus_reset = 0; - /* Bus resetting is finished */ if (!(fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET)) { /* Get the speed */ @@ -2206,8 +2190,6 @@ static void reset_irq(struct fsl_udc *udc) #else if (fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET) { VDBG("Bus reset"); - /* Bus is reseting */ - udc->bus_reset = 1; /* Reset all the queues, include XD, dTD, EP queue * head and TR Queue */ reset_queues(udc); @@ -2354,7 +2336,6 @@ static irqreturn_t fsl_udc_irq(int irq, void *_udc) /* Reset Received */ if (irq_src & USB_STS_RESET) { - VDBG("reset int"); reset_irq(udc); status = IRQ_HANDLED; } @@ -2412,30 +2393,11 @@ static int fsl_start(struct usb_gadget_driver *driver, goto out; } - if (udc_controller->transceiver) { - /* Suspend the controller until OTG enable it */ - udc_controller->stopped = 1; - printk(KERN_INFO "Suspend udc for OTG auto detect\n"); - - /* connect to bus through transceiver */ - if (udc_controller->transceiver) { - retval = otg_set_peripheral(udc_controller->transceiver, - &udc_controller->gadget); - if (retval < 0) { - ERR("can't bind to transceiver\n"); - driver->unbind(&udc_controller->gadget); - udc_controller->gadget.dev.driver = 0; - udc_controller->driver = 0; - return retval; - } - } - } else { - /* Enable DR IRQ reg and set USBCMD reg Run bit */ - dr_controller_run(udc_controller); - udc_controller->usb_state = USB_STATE_ATTACHED; - udc_controller->ep0_state = WAIT_FOR_SETUP; - udc_controller->ep0_dir = 0; - } + /* Enable DR IRQ reg and Set usbcmd reg Run bit */ + dr_controller_run(udc_controller); + udc_controller->usb_state = USB_STATE_ATTACHED; + udc_controller->ep0_state = WAIT_FOR_SETUP; + udc_controller->ep0_dir = 0; printk(KERN_INFO "%s: bind to driver %s\n", udc_controller->gadget.name, driver->driver.name); @@ -2914,30 +2876,17 @@ static int __init fsl_udc_probe(struct platform_device *pdev) spin_lock_init(&udc_controller->lock); udc_controller->stopped = 1; -#ifdef CONFIG_USB_OTG - if (pdata->operating_mode == FSL_USB2_DR_OTG) { - udc_controller->transceiver = otg_get_transceiver(); - if (!udc_controller->transceiver) { - ERR("Can't find OTG driver!\n"); - ret = -ENODEV; - goto err_kfree; - } - } -#endif - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { ret = -ENXIO; goto err_kfree; } - if (pdata->operating_mode == FSL_USB2_DR_DEVICE) { - if (!request_mem_region(res->start, resource_size(res), - driver_name)) { - ERR("request mem region for %s failed\n", pdev->name); - ret = -EBUSY; - goto err_kfree; - } + if (!request_mem_region(res->start, resource_size(res), + driver_name)) { + ERR("request mem region for %s failed\n", pdev->name); + ret = -EBUSY; + goto err_kfree; } dr_regs = ioremap(res->start, resource_size(res)); @@ -3021,11 +2970,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev) goto err_free_irq; } - if (!udc_controller->transceiver) { - /* initialize usb hw reg except for regs for EP, - * leave usbintr reg untouched */ - dr_controller_setup(udc_controller); - } + /* initialize usb hw reg except for regs for EP, + * leave usbintr reg untouched */ + dr_controller_setup(udc_controller); fsl_udc_clk_finalize(pdev); @@ -3045,9 +2992,6 @@ static int __init fsl_udc_probe(struct platform_device *pdev) if (ret < 0) goto err_free_irq; - if (udc_controller->transceiver) - udc_controller->gadget.is_otg = 1; - /* setup QH and epctrl for ep0 */ ep0_setup(udc_controller); @@ -3090,6 +3034,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) INIT_WORK(&udc_controller->charger_work, fsl_udc_set_current_limit_work); #ifdef CONFIG_USB_OTG_UTILS + udc_controller->transceiver = otg_get_transceiver(); if (udc_controller->transceiver) { dr_controller_stop(udc_controller); dr_controller_reset(udc_controller); @@ -3133,8 +3078,7 @@ err_iounmap: err_iounmap_noclk: iounmap(dr_regs); err_release_mem_region: - if (pdata->operating_mode == FSL_USB2_DR_DEVICE) - release_mem_region(res->start, resource_size(res)); + release_mem_region(res->start, resource_size(res)); err_kfree: kfree(udc_controller); udc_controller = NULL; @@ -3177,8 +3121,7 @@ static int __exit fsl_udc_remove(struct platform_device *pdev) dma_pool_destroy(udc_controller->td_pool); free_irq(udc_controller->irq, udc_controller); iounmap(dr_regs); - if (pdata->operating_mode == FSL_USB2_DR_DEVICE) - release_mem_region(res->start, resource_size(res)); + release_mem_region(res->start, resource_size(res)); device_unregister(&udc_controller->gadget.dev); /* free udc --wait for the release() finished */ @@ -3269,62 +3212,6 @@ static int fsl_udc_resume(struct platform_device *pdev) return 0; } -static int fsl_udc_otg_suspend(struct device *dev, pm_message_t state) -{ - struct fsl_udc *udc = udc_controller; - u32 mode, usbcmd; - - mode = fsl_readl(&dr_regs->usbmode) & USB_MODE_CTRL_MODE_MASK; - - pr_debug("%s(): mode 0x%x stopped %d\n", __func__, mode, udc->stopped); - - /* - * If the controller is already stopped, then this must be a - * PM suspend. Remember this fact, so that we will leave the - * controller stopped at PM resume time. - */ - if (udc->stopped) { - pr_debug("gadget already stopped, leaving early\n"); - udc->already_stopped = 1; - return 0; - } - - if (mode != USB_MODE_CTRL_MODE_DEVICE) { - pr_debug("gadget not in device mode, leaving early\n"); - return 0; - } - - /* stop the controller */ - usbcmd = fsl_readl(&dr_regs->usbcmd) & ~USB_CMD_RUN_STOP; - fsl_writel(usbcmd, &dr_regs->usbcmd); - - udc->stopped = 1; - - pr_info("USB Gadget suspended\n"); - - return 0; -} - -static int fsl_udc_otg_resume(struct device *dev) -{ - pr_debug("%s(): stopped %d already_stopped %d\n", __func__, - udc_controller->stopped, udc_controller->already_stopped); - - /* - * If the controller was stopped at suspend time, then - * don't resume it now. - */ - if (udc_controller->already_stopped) { - udc_controller->already_stopped = 0; - pr_debug("gadget was already stopped, leaving early\n"); - return 0; - } - - pr_info("USB Gadget resume\n"); - - return fsl_udc_resume(NULL); -} - /*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ @@ -3337,9 +3224,6 @@ static struct platform_driver udc_driver = { .driver = { .name = (char *)driver_name, .owner = THIS_MODULE, - /* udc suspend/resume called from OTG driver */ - .suspend = fsl_udc_otg_suspend, - .resume = fsl_udc_otg_resume, }, }; diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index 9bcf8e5bc236..0386be60ff79 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -619,7 +619,6 @@ struct fsl_udc { unsigned vbus_active:1; unsigned stopped:1; unsigned remote_wakeup:1; - unsigned already_stopped:1; unsigned big_endian_desc:1; struct ep_queue_head *ep_qh; /* Endpoints Queue-Head */ @@ -631,7 +630,6 @@ struct fsl_udc { dma_addr_t ep_qh_dma; /* dma address of QH */ u32 max_pipes; /* Device max pipes */ - u32 bus_reset; /* Device is bus resetting */ u32 resume_state; /* USB state to resume */ u32 usb_state; /* USB current state */ u32 ep0_state; /* Endpoint zero state */ |