summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e11a79d)
raw | patch | inline | side by side (parent: e11a79d)
author | Ajay Kumar Gupta <ajay.gupta@ti.com> | |
Wed, 2 Nov 2011 05:45:40 +0000 (11:15 +0530) | ||
committer | Vaibhav Hiremath <hvaibhav@ti.com> | |
Mon, 23 Jan 2012 19:14:34 +0000 (00:44 +0530) |
This needed for dual instances support.
Changes include:
- Move fifo_mode, orig_dma_mask, otg_timer, first to musb struct
- Killed option for use_dma
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Changes include:
- Move fifo_mode, orig_dma_mask, otg_timer, first to musb struct
- Killed option for use_dma
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
drivers/usb/musb/musb_core.c | patch | blob | history | |
drivers/usb/musb/musb_core.h | patch | blob | history |
index 929da0b8b49a8f54ae34246dd379be6f2c0343bc..a65012157228524368e0acf017f09aa7a1ec4e05 100644 (file)
spin_unlock_irqrestore(&musb->lock, flags);
}
-static DEFINE_TIMER(musb_otg_timer, musb_otg_timer_func, 0, 0);
-
/*
* Stops the B-device HNP state. Caller must take care of locking.
*/
if (musb->is_active) {
musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
- musb_otg_timer.data = (unsigned long)musb;
- mod_timer(&musb_otg_timer, jiffies
+ mod_timer(&musb->otg_timer, jiffies
+ msecs_to_jiffies(TB_ASE0_BRST));
}
break;
case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */
dev_dbg(musb->controller, "HNP: Setting timer as %s\n",
otg_state_string(musb->xceiv->state));
- musb_otg_timer.data = (unsigned long)musb;
- mod_timer(&musb_otg_timer, jiffies
+ mod_timer(&musb->otg_timer, jiffies
+ msecs_to_jiffies(100));
break;
case OTG_STATE_A_PERIPHERAL:
/*-------------------------------------------------------------------------*/
-/*
- * The silicon either has hard-wired endpoint configurations, or else
- * "dynamic fifo" sizing. The driver has support for both, though at this
- * writing only the dynamic sizing is very well tested. Since we switched
- * away from compile-time hardware parameters, we can no longer rely on
- * dead code elimination to leave only the relevant one in the object file.
- *
- * We don't currently use dynamic fifo setup capability to do anything
- * more than selecting one of a bunch of predefined configurations.
- */
-static short __devinitdata fifo_mode = -1;
-
-/* "modprobe ... fifo_mode=1" etc */
-module_param(fifo_mode, short, 0);
-MODULE_PARM_DESC(fifo_mode, "initial endpoint configuration");
-
/*
* tables defining fifo_mode values. define more if you like.
* for host side, make sure both halves of ep1 are set up.
return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0));
}
- static struct musb_fifo_cfg __devinitdata ep0_cfg = {
+static struct musb_fifo_cfg __devinitdata ep0_cfg = {
.style = FIFO_RXTX, .maxpacket = 64,
};
struct musb_hw_ep *hw_ep = musb->endpoints;
if (musb->config->fifo_mode)
- fifo_mode = musb->config->fifo_mode;
+ musb->fifo_mode = musb->config->fifo_mode;
else if (musb->config->fifo_cfg) {
cfg = musb->config->fifo_cfg;
n = musb->config->fifo_cfg_size;
goto done;
}
- switch (fifo_mode) {
+ switch (musb->fifo_mode) {
default:
- fifo_mode = 0;
+ musb->fifo_mode = 0;
/* FALLTHROUGH */
case 0:
cfg = mode_0_cfg;
}
printk(KERN_DEBUG "%s: setup fifo_mode %d\n",
- musb_driver_name, fifo_mode);
+ musb_driver_name, musb->fifo_mode);
done:
EXPORT_SYMBOL_GPL(musb_interrupt);
#ifndef CONFIG_MUSB_PIO_ONLY
-static int __devinitdata use_dma = 1;
-
-/* "modprobe ... use_dma=0" etc */
-module_param(use_dma, bool, 0);
-MODULE_PARM_DESC(use_dma, "enable/disable use of DMA");
-
void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit)
{
u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
}
}
EXPORT_SYMBOL_GPL(musb_dma_completion);
-
-#else
-#define use_dma 0
#endif
/*-------------------------------------------------------------------------*/
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->old_state) {
+ musb->old_state = musb->xceiv->state;
sysfs_notify(&musb->controller->kobj, NULL, "mode");
}
}
if (musb->gb_queue)
destroy_workqueue(musb->gb_queue);
+ del_timer_sync(&musb->otg_timer);
+
kfree(musb);
}
musb->min_power = plat->min_power;
musb->ops = plat->platform_ops;
musb->id = pdev->id;
+ musb->first = 1;
- if (fifo_mode == -1)
- fifo_mode = musb->ops->fifo_mode;
+ musb->fifo_mode = musb->ops->fifo_mode;
+#ifndef CONFIG_MUSB_PIO_ONLY
+ musb->orig_dma_mask = dev->dma_mask;
+#endif
if (musb->ops->flags & MUSB_GLUE_TUSB_STYLE) {
musb_readb = __tusb_musb_readb;
musb_writeb = __tusb_musb_writeb;
}
#ifndef CONFIG_MUSB_PIO_ONLY
- if (use_dma && dev->dma_mask) {
+ if (dev->dma_mask) {
struct dma_controller *c;
if (!musb->ops->dma_controller_create) {
/* Init giveback workqueue */
INIT_WORK(&musb->gb_work, musb_gb_work);
+ /* setup otg_timer */
+ setup_timer(&musb->otg_timer, musb_otg_timer_func,
+ (unsigned long) musb);
return 0;
fail6:
/* 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;
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);
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;
}
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
* 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;
}
index 5e57c5dcd47a1a355e61953b51dc83ae2aa144ec..9bac8e49df8ce0a361b063f1aa230ccecb2de7db 100644 (file)
u8 id;
struct timer_list otg_workaround;
unsigned long last_timer;
+ int first;
+ int old_state;
+ struct timer_list otg_timer;
+#ifndef CONFIG_MUSB_PIO_ONLY
+ u64 *orig_dma_mask;
+#endif
+ short fifo_mode;
};
static inline struct musb *gadget_to_musb(struct usb_gadget *g)