USB: musb: Disable USB interrupt in the musb_resume() function
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 10/12 USB: musb: Disable USB interrupt in the musb_resume() function
From: Kim Kyuwon <[email protected]>
USB should be suspended with interrupt disabled[1]. If USB is suspended with interrupt enabled and connected to host PC, a kernel panic would occur When it wakes up. Because, after the arch_suspend_enable_irqs() function is called in the suspend_enter() function, USB Interrupt handler is called, even though USB controller is still not resumed! All devices are resumed after the device_resume() is called.
[1] /Documentation/power/devices.txt: 412 line
--- drivers/usb/musb/musb_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/musb/musb_core.c +4 -0
@@ -2151,6 +2151,8 @@ static int musb_suspend(struct platform_spin_lock_irqsave (&musb->lock, flags); +disable_irq (musb->nIrq); +if (is_peripheral_active (musb)) {/* FIXME force disconnect unless we know USB will wake * the system up quickly enough to respond ...
@@ -2184,6 +2186,8 @@ static int musb_resume(struct platform_delse clk_enable (musb->clock); +enable_irq (musb->nIrq); +/* for static cmos like DaVinci, register values were preserved * unless for some reason the whole soc powered down and we're * not treating that as a whole-system restart (e.g. swsusp)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 12/12 usb: musb: NAK timeout scheme on bulk reserved ep
In reply to a message not in the archiveFrom: Ajay Kumar Gupta <[email protected]>
Fixes endpoint starvation issue when more than one bulk qhs are multiplexed on reserved bulk endpoint.NAK timeout interval is set for such qhs and next qh is scheduled when NAK timeout occurs.
This scheme doesn't work for devices which are connected to a high to full speed tree as there is no NAK timeout interrupt at musb controller from such devices.
--- drivers/usb/musb/musb_host.c | 63 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_host.c +60 -3
@@ -1428,6 +1428,49 @@ finish:#endif +/* Schedule next qh from musb->in_bulk and add the current qh at tail +* to avoid endpoint starvation. +*/ +static void musb_bulk_nak_timeout (struct musb *musb,struct musb_hw_ep *ep) +{ +struct dma_channel *dma; +struct urb *urb; +void __iomem *mbase = musb->mregs; +void __iomem *epio = ep->regs; +struct musb_qh *cur_qh, *next_qh; +u16 rx_csr; + +musb_ep_select (mbase, ep->epnum); + dma =is_dma_capable () ? ep->rx_channel :NULL ; + +/* clear nak timeout bit */ + rx_csr =musb_readw (epio,MUSB_RXCSR ); + rx_csr &= ~MUSB_RXCSR_DATAERROR ; +musb_writew (epio,MUSB_RXCSR , rx_csr); + + cur_qh =first_qh (&musb->in_bulk); +if (cur_qh) { + urb =next_urb (cur_qh); +if (dma_channel_status (dma) ==MUSB_DMA_STATUS_BUSY ) { + dma->status =MUSB_DMA_STATUS_CORE_ABORT ; + musb->dma_controller->channel_abort (dma); + urb->actual_length += dma->actual_len; + dma->actual_len =0L ; + } +musb_save_toggle (ep,1 , urb); + +/* delete cur_qh and add to tail to musb->in_bulk */ +list_move_tail (&cur_qh->ring, &musb->in_bulk); + +/* get the next qh from musb->in_bulk */ + next_qh =first_qh (&musb->in_bulk); + +/* set rx_reinit and schedule the next qh */ + ep->rx_reinit =1 ; +musb_start_urb (musb,1 , next_qh); + } +} +/* * Service an RX interrupt for the given IN endpoint; docs cover bulk, iso, * and high-bandwidth IN transfer cases.
@@ -1499,10 +1542,14 @@ void musb_host_rx(struct musb *musb, u8* we have a candidate... NAKing is *NOT* an error */ DBG (6 ,"RX end %d NAK timeout\n" , epnum); +if (usb_pipebulk (urb->pipe) && qh->mux ==1 && + !list_is_singular (&musb->in_bulk)) { +musb_bulk_nak_timeout (musb, hw_ep); +return ; + }musb_ep_select (mbase, epnum); -musb_writew (epio,MUSB_RXCSR , -MUSB_RXCSR_H_WZC_BITS - |MUSB_RXCSR_H_REQPKT ); + rx_csr &= ~MUSB_RXCSR_DATAERROR ; +musb_writew (epio,MUSB_RXCSR , rx_csr); goto finish; }else {
@@ -1831,6 +1878,16 @@ static int musb_schedule( head = &musb->in_bulk; else head = &musb->out_bulk; +/* Enable bulk NAK time out scheme when bulk requests are +* multiplxed.This scheme doen't work in high speed to full +* speed scenario as NAK interrupts are not coming from a +* full speed device connected to a high speed device. +* NAK timeout interval is 8 (128 uframe or 16ms) for HS and +* 4 (8 frame or 8ms) for FS device. +*/ +if (is_in && qh->dev) + qh->intv_reg = + (USB_SPEED_HIGH == qh->dev->speed) ?8 :4 ; goto success; }else if (best_end <0 ) {return -ENOSPC ;
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 11/12 usb: musb: adding high bandwidth support
From: Ajay Kumar Gupta <[email protected]>
Tested with Creative (Live! Cam Optia) USB camera which uses high bandwidth isochronous interface.FIFO table has been updated for Rx high bandwidth case.
--- drivers/usb/musb/musb_core.c | 18 +++++++++--------- drivers/usb/musb/musb_host.c | 43 +++++++++++++++++++++++++++++-------------- drivers/usb/musb/musb_host.h | 1 + 3 files changed, 39 insertions(+), 23 deletions(-)
drivers/usb/musb/musb_core.c +9 -9
@@ -1064,17 +1064,17 @@ static struct fifo_cfg __initdata mode_4 { .hw_ep_num = 7, .style = FIFO_TX, .maxpacket = 512, }, { .hw_ep_num = 7, .style = FIFO_RX, .maxpacket = 512, }, { .hw_ep_num = 8, .style = FIFO_TX, .maxpacket = 512, }, -{ .hw_ep_num = 8, .style = FIFO_RX, .maxpacket = 512, }, +{ .hw_ep_num = 8, .style = FIFO_RX, .maxpacket = 64, }, { .hw_ep_num = 9, .style = FIFO_TX, .maxpacket = 512, }, -{ .hw_ep_num = 9, .style = FIFO_RX, .maxpacket = 512, }, +{ .hw_ep_num = 9, .style = FIFO_RX, .maxpacket = 64, }, { .hw_ep_num = 10, .style = FIFO_TX, .maxpacket = 512, }, -{ .hw_ep_num = 10, .style = FIFO_RX, .maxpacket = 512, }, -{ .hw_ep_num = 11, .style = FIFO_TX, .maxpacket = 512, }, -{ .hw_ep_num = 11, .style = FIFO_RX, .maxpacket = 512, }, -{ .hw_ep_num = 12, .style = FIFO_TX, .maxpacket = 512, }, -{ .hw_ep_num = 12, .style = FIFO_RX, .maxpacket = 512, }, -{ .hw_ep_num = 13, .style = FIFO_TX, .maxpacket = 512, }, -{ .hw_ep_num = 13, .style = FIFO_RX, .maxpacket = 512, }, +{ .hw_ep_num = 10, .style = FIFO_RX, .maxpacket = 64, }, +{ .hw_ep_num = 11, .style = FIFO_TX, .maxpacket = 256, }, +{ .hw_ep_num = 11, .style = FIFO_RX, .maxpacket = 256, }, +{ .hw_ep_num = 12, .style = FIFO_TX, .maxpacket = 256, }, +{ .hw_ep_num = 12, .style = FIFO_RX, .maxpacket = 256, }, +{ .hw_ep_num = 13, .style = FIFO_TX, .maxpacket = 256, }, +{ .hw_ep_num = 13, .style = FIFO_RX, .maxpacket = 4096, }, { .hw_ep_num = 14, .style = FIFO_RXTX, .maxpacket = 1024, }, { .hw_ep_num = 15, .style = FIFO_RXTX, .maxpacket = 1024, }, };
drivers/usb/musb/musb_host.c +29 -14
93 lines not on this page · raw message
drivers/usb/musb/musb_host.h +1 -0
@@ -68,6 +68,7 @@ struct musb_qh {u8 type;/* XFERTYPE_* */ u8 epnum;u16 maxpacket; +u8 hb_mult;/* high bandwidth pkts per uf */ u16 frame;/* for periodic schedule */ unsigned iso_idx;/* in urb->iso_frame_desc[] */ };
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [patch 11/12] usb: musb: adding high bandwidth support
Quoted 9 lines · On Wednesday 18 February 2009, [email protected]…
From: Ajay Kumar Gupta <[email protected]>
Tested with Creative (Live! Cam Optia) USB camera which uses high bandwidth isochronous interface.FIFO table has been updated for Rx high bandwidth case.
Signed-off-by Ajay Kumar Gupta <[email protected]>Cc Felipe Balbi <[email protected]>Cc David Brownell <[email protected]>
NAK on this one ... Ajay, please re-issue with udpates to verify that the silicon supports high bandwith ISO!
There's code in musb_core_init():
if (reg & MUSB_CONFIGDATA_HBRXE) {
strcat(aInfo, ", HB-ISO Rx");
strcat(aInfo, " (X)"); /* no driver support */
}
if (reg & MUSB_CONFIGDATA_HBTXE) {
strcat(aInfo, ", HB-ISO Tx");
strcat(aInfo, " (X)"); /* no driver support */
}What it needs to do is save a flag instead of
printing the " (X)" ... and test that flag later,
instead of assuming it's set.
Examples:
- DaVinci DM6446 and DM355 don't support high bandwidth for either RX or TX.
- Neither does TUSB6010 (and presumably TUSB6020), which was sort of extracted from the DM6446 (adding more RAM, splitting out the fibula and tibula chips, etc)
- OMAP3 ES2.1 and ES3.1 support it for RX and TX ... but the ES3.0 chips only support it for RX (goofage?)
I don't know what the Blackfin or ST-Micro parts do, but one shouldn't assume they always support it either.
Also, I suspect you should probably create a new fifo_mode table to support this. These changes will break some composite gadget code I've seen ... and I'm curious why you didn't just configure that endpoint in shared-FIFO mode, so that it'd support both RX and TX in high bandwidth.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html