omap3-pandora-kernel: bump for cpu/PMON patches
[openpandora.oe.git] / recipes / linux / omap3-pandora-kernel / musb-support-high-bandwidth.patch.eml
1 Enables support for camera (as creative) requiring high bandwidth
2 isochronous transfer.
3
4 Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
5 ---
6  drivers/usb/musb/musb_core.c |   18 +++++++++---------
7  drivers/usb/musb/musb_host.c |   32 +++++++++++++++++++++-----------
8  2 files changed, 30 insertions(+), 20 deletions(-)
9
10 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
11 index c939f81..9914f70 100644
12 --- a/drivers/usb/musb/musb_core.c
13 +++ b/drivers/usb/musb/musb_core.c
14 @@ -1063,17 +1063,17 @@ static struct fifo_cfg __initdata mode_4_cfg[] = {
15  { .hw_ep_num =  7, .style = FIFO_TX,   .maxpacket = 512, },
16  { .hw_ep_num =  7, .style = FIFO_RX,   .maxpacket = 512, },
17  { .hw_ep_num =  8, .style = FIFO_TX,   .maxpacket = 512, },
18 -{ .hw_ep_num =  8, .style = FIFO_RX,   .maxpacket = 512, },
19 +{ .hw_ep_num =  8, .style = FIFO_RX,   .maxpacket =  64, },
20  { .hw_ep_num =  9, .style = FIFO_TX,   .maxpacket = 512, },
21 -{ .hw_ep_num =  9, .style = FIFO_RX,   .maxpacket = 512, },
22 +{ .hw_ep_num =  9, .style = FIFO_RX,   .maxpacket =  64, },
23  { .hw_ep_num = 10, .style = FIFO_TX,   .maxpacket = 512, },
24 -{ .hw_ep_num = 10, .style = FIFO_RX,   .maxpacket = 512, },
25 -{ .hw_ep_num = 11, .style = FIFO_TX,   .maxpacket = 512, },
26 -{ .hw_ep_num = 11, .style = FIFO_RX,   .maxpacket = 512, },
27 -{ .hw_ep_num = 12, .style = FIFO_TX,   .maxpacket = 512, },
28 -{ .hw_ep_num = 12, .style = FIFO_RX,   .maxpacket = 512, },
29 -{ .hw_ep_num = 13, .style = FIFO_TX,   .maxpacket = 512, },
30 -{ .hw_ep_num = 13, .style = FIFO_RX,   .maxpacket = 512, },
31 +{ .hw_ep_num = 10, .style = FIFO_RX,   .maxpacket =  64, },
32 +{ .hw_ep_num = 11, .style = FIFO_TX,   .maxpacket = 256, },
33 +{ .hw_ep_num = 11, .style = FIFO_RX,   .maxpacket = 256, },
34 +{ .hw_ep_num = 12, .style = FIFO_TX,   .maxpacket = 256, },
35 +{ .hw_ep_num = 12, .style = FIFO_RX,   .maxpacket = 256, },
36 +{ .hw_ep_num = 13, .style = FIFO_TX,   .maxpacket = 256, },
37 +{ .hw_ep_num = 13, .style = FIFO_RX,   .maxpacket = 4096, },
38  { .hw_ep_num = 14, .style = FIFO_RXTX, .maxpacket = 1024, },
39  { .hw_ep_num = 15, .style = FIFO_RXTX, .maxpacket = 1024, },
40  };
41 diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
42 index 08e421f..84173df 100644
43 --- a/drivers/usb/musb/musb_host.c
44 +++ b/drivers/usb/musb/musb_host.c
45 @@ -1443,6 +1443,10 @@ void musb_host_rx(struct musb *musb, u8 epnum)
46                         /* packet error reported later */
47                         iso_err = true;
48                 }
49 +       } else if (rx_csr & MUSB_RXCSR_INCOMPRX) {
50 +               DBG(3, "end %d Highbandwidth  incomplete ISO packet received\n"
51 +                                       , epnum);
52 +               status = -EPROTO;
53         }
54  
55         /* faults abort the transfer */
56 @@ -1595,7 +1599,13 @@ void musb_host_rx(struct musb *musb, u8 epnum)
57                                 val &= ~MUSB_RXCSR_H_AUTOREQ;
58                         else
59                                 val |= MUSB_RXCSR_H_AUTOREQ;
60 -                       val |= MUSB_RXCSR_AUTOCLEAR | MUSB_RXCSR_DMAENAB;
61 +
62 +                       if (qh->maxpacket & ~0x7ff)
63 +                               /* Autoclear doesn't work in high bandwidth iso */
64 +                               val |= MUSB_RXCSR_DMAENAB;
65 +                       else
66 +                               val |= MUSB_RXCSR_AUTOCLEAR
67 +                                       | MUSB_RXCSR_DMAENAB;
68  
69                         musb_writew(epio, MUSB_RXCSR,
70                                 MUSB_RXCSR_H_WZC_BITS | val);
71 @@ -1666,6 +1676,7 @@ static int musb_schedule(
72         int                     best_end, epnum;
73         struct musb_hw_ep       *hw_ep = NULL;
74         struct list_head        *head = NULL;
75 +       u16                     maxpacket;
76  
77         /* use fixed hardware for control and bulk */
78         switch (qh->type) {
79 @@ -1708,6 +1719,13 @@ static int musb_schedule(
80         best_diff = 4096;
81         best_end = -1;
82  
83 +       if (qh->maxpacket & (1<<11))
84 +               maxpacket = 2 * (qh->maxpacket & 0x7ff);
85 +       else if (qh->maxpacket & (1<<12))
86 +               maxpacket = 3 * (qh->maxpacket & 0x7ff);
87 +       else
88 +               maxpacket = (qh->maxpacket & 0x7ff);
89 +
90         for (epnum = 1; epnum < musb->nr_endpoints; epnum++) {
91                 int     diff;
92  
93 @@ -1718,9 +1736,9 @@ static int musb_schedule(
94                         continue;
95  
96                 if (is_in)
97 -                       diff = hw_ep->max_packet_sz_rx - qh->maxpacket;
98 +                       diff = hw_ep->max_packet_sz_rx - maxpacket;
99                 else
100 -                       diff = hw_ep->max_packet_sz_tx - qh->maxpacket;
101 +                       diff = hw_ep->max_packet_sz_tx - maxpacket;
102  
103                 if (diff > 0 && best_diff > diff) {
104                         best_diff = diff;
105 @@ -1797,13 +1815,6 @@ static int musb_urb_enqueue(
106         qh->is_ready = 1;
107  
108         qh->maxpacket = le16_to_cpu(epd->wMaxPacketSize);
109 -
110 -       /* no high bandwidth support yet */
111 -       if (qh->maxpacket & ~0x7ff) {
112 -               ret = -EMSGSIZE;
113 -               goto done;
114 -       }
115 -
116         qh->epnum = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
117         qh->type = epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
118  
119 @@ -1897,7 +1908,6 @@ static int musb_urb_enqueue(
120         }
121         spin_unlock_irqrestore(&musb->lock, flags);
122  
123 -done:
124         if (ret != 0) {
125                 usb_hcd_unlink_urb_from_ep(hcd, urb);
126                 kfree(qh);
127 -- 
128 1.5.6
129
130 --
131 To unsubscribe from this list: send the line "unsubscribe linux-omap" in
132 the body of a message to majordomo@vger.kernel.org
133 More majordomo info at  http://vger.kernel.org/majordomo-info.html
134