|
@@ -40,7 +40,6 @@ typedef int pm_message_t;
|
|
|
#define __devinit
|
|
|
#define pr_warning printf
|
|
|
#define pr_debug(args...)
|
|
|
-//#define VDBG(str, args...) printf(str "\n", ## args)
|
|
|
|
|
|
#define DRIVER_DESC "ARC USBOTG Device Controller driver"
|
|
|
#define DRIVER_AUTHOR "Freescale Semiconductor"
|
|
@@ -959,7 +958,6 @@ out:
|
|
|
static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
|
|
|
dma_addr_t *dma, int *is_last)
|
|
|
{
|
|
|
- //VDBG("top of build_dtd\n");
|
|
|
u32 swap_temp;
|
|
|
struct ep_td_struct *dtd;
|
|
|
|
|
@@ -1438,8 +1436,6 @@ static int fsl_vbus_draw(struct usb_gadget *gadget, unsigned mA)
|
|
|
struct fsl_usb2_platform_data *pdata;
|
|
|
|
|
|
udc = container_of(gadget, struct fsl_udc, gadget);
|
|
|
- //if (udc->transceiver)
|
|
|
- //return otg_set_power(udc->transceiver, mA);
|
|
|
pdata = udc->pdata;
|
|
|
if (pdata->xcvr_ops && pdata->xcvr_ops->set_vbus_draw) {
|
|
|
pdata->xcvr_ops->set_vbus_draw(pdata->xcvr_ops, pdata, mA);
|
|
@@ -1654,7 +1650,6 @@ static void setup_received_irq(struct fsl_udc *udc,
|
|
|
return;
|
|
|
case USB_REQ_SET_CONFIGURATION:
|
|
|
spin_unlock(&udc->lock);
|
|
|
- //fsl_vbus_draw(gadget, mA);
|
|
|
spin_lock(&udc->lock);
|
|
|
break;
|
|
|
case USB_REQ_CLEAR_FEATURE:
|
|
@@ -1721,7 +1716,6 @@ static void setup_received_irq(struct fsl_udc *udc,
|
|
|
u32 tmp;
|
|
|
|
|
|
mdelay(10);
|
|
|
- //fsl_platform_set_test_mode(udc->pdata, ptc);
|
|
|
tmp = fsl_readl(&dr_regs->portsc1) | (ptc << 16);
|
|
|
fsl_writel(tmp, &dr_regs->portsc1);
|
|
|
printk(KERN_INFO "udc: switch to test mode 0x%x.\n", ptc);
|
|
@@ -2399,11 +2393,9 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
|
|
|
/* lock is needed but whether should use this lock or another */
|
|
|
spin_lock_irqsave(&udc_controller->lock, flags);
|
|
|
|
|
|
- //driver->driver.bus = 0;
|
|
|
udc_controller->pdata->port_enables = 1;
|
|
|
/* hook up the driver */
|
|
|
udc_controller->driver = driver;
|
|
|
- //udc_controller->gadget.dev.driver = &driver->driver;
|
|
|
spin_unlock_irqrestore(&udc_controller->lock, flags);
|
|
|
dr_clk_gate(true);
|
|
|
|
|
@@ -2411,41 +2403,16 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
|
|
|
retval = driver->bind(&udc_controller->gadget);
|
|
|
if (retval) {
|
|
|
VDBG("bind udc driver to gadget driver --> %d", retval);
|
|
|
- //udc_controller->gadget.dev.driver = 0;
|
|
|
udc_controller->driver = 0;
|
|
|
dr_clk_gate(false);
|
|
|
goto out;
|
|
|
}
|
|
|
- if (0) {
|
|
|
-#if 0
|
|
|
- if (udc_controller->transceiver) {
|
|
|
- printk(KERN_INFO "Suspend udc for OTG auto detect\n");
|
|
|
- udc_controller->suspended = 1;
|
|
|
- dr_wake_up_enable(udc_controller, true);
|
|
|
+ /* Enable DR IRQ reg and Set usbcmd reg Run bit */
|
|
|
+ dr_controller_run(udc_controller);
|
|
|
+ if (udc_controller->stopped)
|
|
|
dr_clk_gate(false);
|
|
|
- /* export udc suspend/resume call to OTG */
|
|
|
- udc_controller->gadget.dev.driver->suspend = (dev_sus)fsl_udc_suspend;
|
|
|
- udc_controller->gadget.dev.driver->resume = (dev_res)fsl_udc_resume;
|
|
|
-
|
|
|
- /* connect to bus through 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;
|
|
|
- }
|
|
|
-#endif
|
|
|
- } else {
|
|
|
- /* Enable DR IRQ reg and Set usbcmd reg Run bit */
|
|
|
- dr_controller_run(udc_controller);
|
|
|
- if (udc_controller->stopped)
|
|
|
- dr_clk_gate(false);
|
|
|
- }
|
|
|
printk(KERN_INFO "%s: bind to driver \n",
|
|
|
- udc_controller->gadget.name);
|
|
|
+ udc_controller->gadget.name);
|
|
|
|
|
|
out:
|
|
|
if (retval) {
|
|
@@ -2471,11 +2438,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
|
|
|
if (udc_controller->stopped)
|
|
|
dr_clk_gate(true);
|
|
|
|
|
|
-#if 0
|
|
|
- if (udc_controller->transceiver)
|
|
|
- (void)otg_set_peripheral(udc_controller->transceiver, 0);
|
|
|
-#endif
|
|
|
-
|
|
|
/* stop DR, disable intr */
|
|
|
dr_controller_stop(udc_controller);
|
|
|
|
|
@@ -2498,7 +2460,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
|
|
|
|
|
|
/* unbind gadget and unhook driver. */
|
|
|
driver->unbind(&udc_controller->gadget);
|
|
|
- //udc_controller->gadget.dev.driver = 0;
|
|
|
udc_controller->driver = 0;
|
|
|
|
|
|
if (udc_controller->gadget.is_otg) {
|
|
@@ -2686,7 +2647,6 @@ int fsl_udc_probe(struct fsl_usb2_platform_data *pdata)
|
|
|
}
|
|
|
udc_controller->gadget.is_otg = 1;
|
|
|
#endif
|
|
|
- //dr_regs = get_dr_regs();
|
|
|
dr_regs = (void *) OTG_BASE_ADDR;
|
|
|
if (!dr_regs) {
|
|
|
ret = -ENOMEM;
|
|
@@ -2700,14 +2660,7 @@ int fsl_udc_probe(struct fsl_usb2_platform_data *pdata)
|
|
|
set_usb_phy1_clk();
|
|
|
enable_usboh3_clk(1);
|
|
|
enable_usb_phy1_clk(1);
|
|
|
- //usb_phy_enable();
|
|
|
-#if 0
|
|
|
- if (pdata->init && pdata->init(pdata)) {
|
|
|
- pdata->lowpower = false;
|
|
|
- ret = -ENODEV;
|
|
|
- goto err2a;
|
|
|
- }
|
|
|
-#endif
|
|
|
+
|
|
|
spin_lock_init(&pdata->lock);
|
|
|
|
|
|
/* Due to mx35/mx25's phy's bug */
|
|
@@ -2739,24 +2692,6 @@ int fsl_udc_probe(struct fsl_usb2_platform_data *pdata)
|
|
|
* leave usbintr reg untouched */
|
|
|
dr_controller_setup(udc_controller);
|
|
|
|
|
|
-
|
|
|
-#if 0
|
|
|
- temp = 0;
|
|
|
- /* Enable DR irq reg */
|
|
|
- temp = USB_INTR_INT_EN | USB_INTR_ERR_INT_EN
|
|
|
- | USB_INTR_PTC_DETECT_EN | USB_INTR_RESET_EN
|
|
|
- | USB_INTR_DEVICE_SUSPEND | USB_INTR_SYS_ERR_EN
|
|
|
- | USB_INTR_SOF_EN;
|
|
|
-
|
|
|
- fsl_writel(temp, &dr_regs->usbintr);
|
|
|
-
|
|
|
- /* Set controller to Run */
|
|
|
- //temp = readl(USB_USBCMD);
|
|
|
- //temp |= USB_CMD_RUN_STOP;
|
|
|
- //writel(temp, USB_USBCMD);
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
/* Setup gadget structure */
|
|
|
udc_controller->gadget.ops = &fsl_gadget_ops;
|
|
|
udc_controller->gadget.is_dualspeed = 1;
|
|
@@ -2765,12 +2700,6 @@ int fsl_udc_probe(struct fsl_usb2_platform_data *pdata)
|
|
|
udc_controller->gadget.speed = USB_SPEED_UNKNOWN;
|
|
|
udc_controller->gadget.name = driver_name;
|
|
|
|
|
|
- /* Setup gadget.dev and register with kernel */
|
|
|
- //dev_set_name(&udc_controller->gadget.dev, "gadget");
|
|
|
- //udc_controller->gadget.dev.release = fsl_udc_release;
|
|
|
- //udc_controller->gadget.dev.parent = NULL;
|
|
|
- //udc_controller->gadget.dev.groups = fsl_udc_attr_groups;
|
|
|
-
|
|
|
/* setup QH and epctrl for ep0 */
|
|
|
ep0_setup(udc_controller);
|
|
|
|
|
@@ -2829,20 +2758,6 @@ int fsl_udc_probe(struct fsl_usb2_platform_data *pdata)
|
|
|
/* let the gadget register function open the clk */
|
|
|
dr_clk_gate(false);
|
|
|
|
|
|
- /* create usb charger */
|
|
|
-#ifdef CONFIG_IMX_USB_CHARGER
|
|
|
- udc_controller->charger.dev = &pdev->dev;
|
|
|
- udc_controller->charger.dp_pullup = usb_charger_pullup_dp;
|
|
|
- udc_controller->charger.enable = true;
|
|
|
- if (pdata->charger_base_addr)
|
|
|
- udc_controller->charger.charger_base_addr = pdata->charger_base_addr;
|
|
|
- if (imx_usb_create_charger(&udc_controller->charger, "imx_usb_charger"))
|
|
|
- dev_err(&pdev->dev, "Can't create usb charger\n");
|
|
|
-#else
|
|
|
- //udc_controller->charger.dp_pullup = usb_charger_pullup_dp;
|
|
|
- //udc_controller->charger.enable = false;
|
|
|
-#endif
|
|
|
-
|
|
|
return 0;
|
|
|
|
|
|
err3:
|
|
@@ -2866,7 +2781,6 @@ static int fsl_udc_remove(struct fsl_usb2_platform_data *pdata)
|
|
|
|
|
|
if (!udc_controller)
|
|
|
return -ENODEV;
|
|
|
- //udc_controller->done = &done;
|
|
|
/* open USB PHY clock */
|
|
|
dr_clk_gate(true);
|
|
|
|
|
@@ -2902,20 +2816,6 @@ static int fsl_udc_remove(struct fsl_usb2_platform_data *pdata)
|
|
|
|
|
|
static bool udc_can_wakeup_system(void)
|
|
|
{
|
|
|
-#if 0
|
|
|
- struct fsl_usb2_platform_data *pdata = udc_controller->pdata;
|
|
|
-
|
|
|
- if (pdata->operating_mode == FSL_USB2_DR_OTG)
|
|
|
- if (device_may_wakeup(udc_controller->transceiver->dev))
|
|
|
- return true;
|
|
|
- else
|
|
|
- return false;
|
|
|
- else
|
|
|
- if (device_may_wakeup(udc_controller->gadget.dev.parent))
|
|
|
- return true;
|
|
|
- else
|
|
|
- return false;
|
|
|
-#endif
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -3114,35 +3014,6 @@ end:
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/*-------------------------------------------------------------------------
|
|
|
- Register entry point for the peripheral controller driver
|
|
|
---------------------------------------------------------------------------*/
|
|
|
-
|
|
|
-#if 0
|
|
|
-static struct platform_driver udc_driver = {
|
|
|
- .remove = fsl_udc_remove,
|
|
|
- /* these suspend and resume are not usb suspend and resume */
|
|
|
- .suspend = fsl_udc_suspend,
|
|
|
- .resume = fsl_udc_resume,
|
|
|
- .probe = fsl_udc_probe,
|
|
|
- .driver = {
|
|
|
- .name = driver_name,
|
|
|
- .owner = THIS_MODULE,
|
|
|
- },
|
|
|
-};
|
|
|
-
|
|
|
-static int __init udc_init(void)
|
|
|
-{
|
|
|
- printk(KERN_INFO "%s (%s)\n", driver_desc, DRIVER_VERSION);
|
|
|
- return platform_driver_register(&udc_driver);
|
|
|
-}
|
|
|
-static void __exit udc_exit(void)
|
|
|
-{
|
|
|
- platform_driver_unregister(&udc_driver);
|
|
|
- printk(KERN_INFO "%s unregistered \n", driver_desc);
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
int usb_gadget_handle_interrupts(void)
|
|
|
{
|
|
|
return fsl_udc_irq(0, udc_controller);
|