Moved global variable "orig_dma_mask" and static variables "first" and "old_state" to 'struct musb' to help support multi instance of musb controller as present on AM335x platform. Signed-off-by: Ajay Kumar Gupta <ajay.gupta@xxxxxx> --- drivers/usb/musb/musb_core.c | 28 ++++++++++++---------------- drivers/usb/musb/musb_core.h | 5 +++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index db3dff8..e89b232 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1785,10 +1785,9 @@ static const struct attribute_group musb_attr_group = { static void musb_irq_work(struct work_struct *data) { struct musb *musb = container_of(data, struct musb, irq_work); - static int old_state; - if (musb->xceiv->state != old_state) { - old_state = musb->xceiv->state; + if (musb->xceiv->state != musb->xceiv_old_state) { + musb->xceiv_old_state = musb->xceiv->state; sysfs_notify(&musb->controller->kobj, NULL, "mode"); } } @@ -1906,6 +1905,12 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb->min_power = plat->min_power; musb->ops = plat->platform_ops; + musb->first = 1; + +#ifndef CONFIG_MUSB_PIO_ONLY + musb->orig_dma_mask = dev->dma_mask; +#endif + /* The musb_platform_init() call: * - adjusts musb->mregs and musb->isr if needed, * - may initialize an integrated tranceiver @@ -2096,11 +2101,6 @@ fail0: /* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just * bridge to a platform device; this driver then suffices. */ - -#ifndef CONFIG_MUSB_PIO_ONLY -static u64 *orig_dma_mask; -#endif - static int __devinit musb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -2119,10 +2119,6 @@ static int __devinit musb_probe(struct platform_device *pdev) return -ENOMEM; } -#ifndef CONFIG_MUSB_PIO_ONLY - /* clobbered by use_dma=n */ - orig_dma_mask = dev->dma_mask; -#endif status = musb_init_controller(dev, irq, base); if (status < 0) iounmap(base); @@ -2147,7 +2143,7 @@ static int __devexit musb_remove(struct platform_device *pdev) iounmap(ctrl_base); device_init_wakeup(&pdev->dev, 0); #ifndef CONFIG_MUSB_PIO_ONLY - pdev->dev.dma_mask = orig_dma_mask; + pdev->dev.dma_mask = musb->orig_dma_mask; #endif return 0; } @@ -2353,7 +2349,6 @@ static int musb_runtime_suspend(struct device *dev) static int musb_runtime_resume(struct device *dev) { struct musb *musb = dev_to_musb(dev); - static int first = 1; /* * When pm_runtime_get_sync called for the first time in driver @@ -2364,9 +2359,10 @@ static int musb_runtime_resume(struct device *dev) * Also context restore without save does not make * any sense */ - if (!first) + if (musb->first) + musb->first = 0; + else musb_restore_context(musb); - first = 0; return 0; } diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index f4a40f0..ac808d4 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -456,6 +456,11 @@ struct musb { #ifdef MUSB_CONFIG_PROC_FS struct proc_dir_entry *proc_entry; #endif + int first; + int xceiv_old_state; +#ifndef CONFIG_MUSB_PIO_ONLY + u64 *orig_dma_mask; +#endif }; static inline struct musb *gadget_to_musb(struct usb_gadget *g) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html