diff --git a/drivers/usb/musb/cppi41_dma.c b/drivers/usb/musb/cppi41_dma.c index d82fe71..692e382 100644 --- a/drivers/usb/musb/cppi41_dma.c +++ b/drivers/usb/musb/cppi41_dma.c @@ -31,12 +31,14 @@ #undef DEBUG_CPPI_TD #undef USBDRV_DEBUG -#ifdef USBDRV_DEBUG +#if 1 #define dprintk(x, ...) printk(x, ## __VA_ARGS__) #else #define dprintk(x, ...) #endif +#undef DBG +#define DBG(level, format, args...) printk(format, ##args) /* * Data structure definitions */ @@ -1312,7 +1314,15 @@ void txdma_completion_work(struct work_struct *data) u8 resched = 0; unsigned long flags; +void __iomem *epio_addrs[USB_CPPI41_NUM_CH]; +u16 csr_values[USB_CPPI41_NUM_CH]; +u8 resched_values[USB_CPPI41_NUM_CH]; + +printk("Entering loop!\n"); while (1) { +memset(epio_addrs, 0xff, sizeof(epio_addrs)); +memset(csr_values, 0xff, sizeof(csr_values)); +memset(resched_values, 0xff, sizeof(resched_values)); for (index = 0; index < USB_CPPI41_NUM_CH; index++) { void __iomem *epio; u16 csr; @@ -1351,13 +1361,43 @@ void txdma_completion_work(struct work_struct *data) musb_dma_completion(musb, index+1, 1); spin_unlock_irqrestore(&musb->lock, flags); } + +epio_addrs[index] = epio; +csr_values[index] = csr; +resched_values[index] = resched; } } if (resched) { resched = 0; + +for (index = 0; index < USB_CPPI41_NUM_CH; index++) { + if (resched_values[index] != 255) { + printk(" %2d: *%p=0x%04x (%d)\n", index, epio_addrs[index], csr_values[index], resched_values[index]); + } +} + +#if 1 + /* + ** HACK: + ** This work queue spins and consumes 100% of the CPU when + ** there is no serial terminal on the USB host side. Although + ** cond_resched is called it only allows higher priority + ** tasks to run. The call to schedule_timeout works but + ** feels inefficient and yucky. There should be a better way + ** of fixing this. Right now this is a temporary work around. + */ + + /* set task's state to interruptible sleep */ + set_current_state(TASK_INTERRUPTIBLE); + + /* take a nap and wake up in "s" seconds */ + schedule_timeout(1); +#else cond_resched(); +#endif } else { +printk("------- EMPTY\n"); return ; } }