--- Antti Andreimann <[EMAIL PROTECTED]> wrote:
> On R, 2005-03-25 at 13:30 -0800, David Brownell wrote:
> > If that's an ISO-IN then I'd still not expect it to
> work.
> > Though Karsten has some "not clean" patches that may
> help you.
>
> It probably is an ISO-IN transaction, and opening sound
> device in output
> only mode does produce exactly the same error. I don't
> know exactly, but
> I suspect that some inbound data is used for
> synchronization in
> snd_usb_audio driver.
> Where can I get those patches You referred to? I'd be
> glad to test them.
The attached patch is what I use with my US428.
You'll probably have to change it for your device.
The patch _hardcodes_ (very bad!!!) the uframe schedule for
US428's periodic endpoints:
04IN INT max 21bytes
08IN ISO max 300bytes
10IN ISO max 300bytes
10OUT ISO max 300bytes
by those hunks
for INT:
@@ -574,6 +574,10 @@
? cpu_to_le32 (1 << uframe)
: __constant_cpu_to_le32 (0xff);
qh->hw_info2 |= c_mask;
+ if ((qh->hw_info2 & 0xFFFF) == 0x3C01) {
+ qh->hw_info2 &= __constant_cpu_to_le32 (~0xffff);
+ qh->hw_info2 |= 0x8020; //FIXME hack
+ }
} else
ehci_dbg (ehci, "reused qh %p schedule\n", qh);
and for ISO
@@ -1064,8 +1074,20 @@
/* we know urb->interval is 2^N uframes */
uframe += period_uframes;
} while (uframe < mod);
+ printk("%i %u %u\n", __LINE__, uframe, mod);
stream->splits = cpu_to_le32(stream->raw_mask << (uframe
& 7));
+ switch (stream->bEndpointAddress) {
+ case USB_DIR_IN | 0x8:
+ stream->splits = 0xC010;
+ break;
+ case USB_DIR_IN | 0xA:
+ stream->splits = 0x3004;
+ break;
+ case USB_DIR_OUT | 0xA:
+ stream->splits = 0x3; //FIXME hack
+ break;
+ }
return 1;
}
See the resulting schedule in attachment
uframe-schedule-usx2y.
Take care: attached patch still includes what is already
sent upstream by Greg and misses the ehci.h change!
Karsten
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden:
http://mail.yahoo.de
--- ../linux-2.6.11.2was/drivers/usb/host_ehci_orig/ehci-sched.c 2005-03-09 09:11:18.000000000 +0100
+++ drivers/usb/host/ehci-sched.c 2005-03-23 20:38:07.000000000 +0100
@@ -202,13 +202,13 @@
/* "knows" no gap is needed */
mask |= mask >> 8;
if (mask & uf_mask)
- break;
+ ;// break;
}
type = Q_NEXT_TYPE (here.qh->hw_next);
here = here.qh->qh_next;
continue;
case Q_TYPE_SITD:
- if (same_tt (dev, here.itd->urb->dev)) {
+ if (same_tt (dev, here.sitd->urb->dev)) {
u16 mask;
mask = le32_to_cpu (here.sitd
@@ -218,7 +218,7 @@
if (mask & uf_mask)
break;
}
- type = Q_NEXT_TYPE (here.qh->hw_next);
+ type = Q_NEXT_TYPE (here.sitd->hw_next);
here = here.sitd->sitd_next;
continue;
// case Q_TYPE_FSTN:
@@ -500,7 +500,7 @@
* NOTE: both SPLIT and CSPLIT could be checked in just
* one smart pass...
*/
- mask = 0x03 << (uframe + qh->gap_uf);
+ mask = 0x01e << (uframe + qh->gap_uf);
*c_maskp = cpu_to_le32 (mask << 8);
mask |= 1 << uframe;
@@ -574,6 +574,10 @@
? cpu_to_le32 (1 << uframe)
: __constant_cpu_to_le32 (0xff);
qh->hw_info2 |= c_mask;
+ if ((qh->hw_info2 & 0xFFFF) == 0x3C01) {
+ qh->hw_info2 &= __constant_cpu_to_le32 (~0xffff);
+ qh->hw_info2 |= 0x8020; //FIXME hack
+ }
} else
ehci_dbg (ehci, "reused qh %p schedule\n", qh);
@@ -656,7 +660,7 @@
unsigned interval
)
{
- static const u8 smask_out [] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f };
+ static const u32 smask_out [] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f };
u32 buf1;
unsigned epnum, maxp;
@@ -714,9 +718,10 @@
stream->raw_mask = 1;
/* pessimistic c-mask */
- tmp = usb_calc_bus_time (USB_SPEED_FULL, 1, 0, maxp)
+ tmp = usb_calc_bus_time (USB_SPEED_FULL, 1, 1, maxp)
/ (125 * 1000);
- stream->raw_mask |= 3 << (tmp + 9);
+ // stream->raw_mask |= 3 << (tmp + 9);
+ stream->raw_mask |= smask_out [tmp] << 10;
} else
stream->raw_mask = smask_out [maxp / 188];
bandwidth = stream->usecs + stream->c_usecs;
@@ -1008,7 +1013,7 @@
u32 mod,
struct ehci_iso_stream *stream,
u32 uframe,
- struct ehci_iso_sched *sched,
+ // struct ehci_iso_sched *sched,
u32 period_uframes
)
{
@@ -1016,7 +1021,7 @@
u32 frame, uf;
mask = stream->raw_mask << (uframe & 7);
-
+ printk("%i %X\n", __LINE__, mask);
/* for IN, don't wrap CSPLIT into the next frame */
if (mask & ~0xffff)
return 0;
@@ -1037,14 +1042,19 @@
* assume scheduling slop leaves 10+% for control/bulk.
*/
if (!tt_no_collision (ehci, period_uframes << 3,
- stream->udev, frame, mask))
+ stream->udev, frame, mask)) {
+ printk("%i\n", __LINE__);
return 0;
+ }
/* check starts (OUT uses more than one) */
max_used = 100 - stream->usecs;
for (tmp = stream->raw_mask & 0xff; tmp; tmp >>= 1, uf++) {
- if (periodic_usecs (ehci, frame, uf) > max_used)
- return 0;
+
+ if (periodic_usecs (ehci, frame, uf) > max_used) {
+ printk("%i %u\n", __LINE__, max_used);
+ return 0;
+ }
}
/* for IN, check CSPLIT */
@@ -1064,8 +1074,20 @@
/* we know urb->interval is 2^N uframes */
uframe += period_uframes;
} while (uframe < mod);
+ printk("%i %u %u\n", __LINE__, uframe, mod);
stream->splits = cpu_to_le32(stream->raw_mask << (uframe & 7));
+ switch (stream->bEndpointAddress) {
+ case USB_DIR_IN | 0x8:
+ stream->splits = 0xC010;
+ break;
+ case USB_DIR_IN | 0xA:
+ stream->splits = 0x3004;
+ break;
+ case USB_DIR_OUT | 0xA:
+ stream->splits = 0x3; //FIXME hack
+ break;
+ }
return 1;
}
@@ -1132,8 +1154,15 @@
* can also help high bandwidth if the dma and irq loads don't
* jump until after the queue is primed.
*/
- start = SCHEDULE_SLOP * 8 + (now & ~0x07);
- start %= mod;
+/* if ((urb->dev->speed != USB_SPEED_LOW && */
+/* urb->dev->speed != USB_SPEED_FULL) || */
+/* urb->transfer_flags & URB_ISO_ASAP) { */
+ start = SCHEDULE_SLOP * 8 + (now & ~0x07);
+ start %= mod;
+/* } else { */
+/* urb->start_frame &= 1023; */
+/* start = urb->start_frame << 3; */
+/* } */
stream->next_uframe = start;
/* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
@@ -1154,7 +1183,7 @@
if ((start % 8) >= 6)
continue;
enough_space = sitd_slot_ok (ehci, mod, stream,
- start, sched, period);
+ start, /*sched,*/ period);
}
/* schedule it here if there's enough bandwidth */
@@ -1177,6 +1206,13 @@
ready:
urb->start_frame = stream->next_uframe;
+
+ //adjust start_frame for full/low-speed client
+ if (urb->dev->speed == USB_SPEED_LOW || urb->dev->speed == USB_SPEED_FULL) {
+ urb->start_frame >>= 3;
+ urb->start_frame &= 1023; //FIXME kann wech?
+ }
+
return 0;
}
@@ -1500,18 +1536,17 @@
/* might need to cross a buffer page within a td */
packet->bufp = buf;
- buf += length;
- packet->buf1 = buf & ~0x0fff;
+ packet->buf1 = (buf + length) & ~0x0fff;
if (packet->buf1 != (buf & ~(u64)0x0fff))
packet->cross = 1;
/* OUT uses multiple start-splits */
if (stream->bEndpointAddress & USB_DIR_IN)
continue;
- length = 1 + (length / 188);
- packet->buf1 |= length;
+ length = (length + 187) / 188;
if (length > 1) /* BEGIN vs ALL */
- packet->buf1 |= 1 << 3;
+ length |= 1 << 3;
+ packet->buf1 |= length;
}
}
@@ -1606,10 +1641,9 @@
sitd->hw_buf_hi [0] = cpu_to_le32 (bufp >> 32);
sitd->hw_buf [1] = cpu_to_le32 (uf->buf1);
- if (uf->cross) {
+ if (uf->cross)
bufp += 4096;
- sitd->hw_buf_hi [1] = cpu_to_le32 (bufp >> 32);
- }
+ sitd->hw_buf_hi [1] = cpu_to_le32 (bufp >> 32);
sitd->index = index;
}
@@ -1640,13 +1674,13 @@
struct ehci_sitd *sitd;
next_uframe = stream->next_uframe;
-
+ // printk("%i: %u\n", __LINE__, stream->next_uframe);
if (list_empty(&stream->td_list)) {
/* usbfs ignores TT bandwidth */
ehci_to_hcd(ehci)->self.bandwidth_allocated
+= stream->bandwidth;
ehci_vdbg (ehci,
- "sched dev%s ep%d%s-iso [%d] %dms/%04x\n",
+ "schedule devp %s ep%d%s-iso [%d] %dms/%04x\n",
urb->dev->devpath, stream->bEndpointAddress & 0x0f,
(stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out",
(next_uframe >> 3) % ehci->periodic_size,
@@ -1674,11 +1708,11 @@
sitd_patch (stream, sitd, sched, packet);
sitd_link (ehci, (next_uframe >> 3) % ehci->periodic_size,
sitd);
-
next_uframe += stream->interval << 3;
stream->depth += stream->interval << 3;
}
stream->next_uframe = next_uframe % mod;
+ // printk("%i: %u\n", __LINE__, stream->next_uframe);
/* don't need that schedule data any more */
iso_sched_free (stream, sched);
@@ -1693,7 +1727,7 @@
/*-------------------------------------------------------------------------*/
#define SITD_ERRS (SITD_STS_ERR | SITD_STS_DBE | SITD_STS_BABBLE \
- | SITD_STS_XACT | SITD_STS_MMF | SITD_STS_STS)
+ | SITD_STS_XACT | SITD_STS_MMF)
static unsigned
sitd_complete (
@@ -1721,8 +1755,10 @@
: -ECOMM; /* hc couldn't write */
else if (t & SITD_STS_BABBLE)
desc->status = -EOVERFLOW;
- else /* XACT, MMF, etc */
- desc->status = -EPROTO;
+ else /* XACT, MMF, etc */{
+ printk("%s %i: %X\n", __FUNCTION__, __LINE__, t);
+ desc->status = -EPROTO;
+ }
} else {
desc->status = 0;
desc->actual_length = desc->length - SITD_LENGTH (t);
@@ -1777,10 +1813,10 @@
struct ehci_iso_stream *stream;
// FIXME remove when csplits behave
- if (usb_pipein(urb->pipe)) {
+ /* if (usb_pipein(urb->pipe)) {
ehci_dbg (ehci, "no iso-IN split transactions yet\n");
return -ENOMEM;
- }
+ }*/
/* Get iso_stream head */
stream = iso_stream_find (ehci, urb);
@@ -1794,7 +1830,7 @@
goto done;
}
-#ifdef EHCI_URB_TRACE
+#ifdef EHCI_URB_TRACE0
ehci_dbg (ehci,
"submit %p dev%s ep%d%s-iso len %d\n",
urb, urb->dev->devpath,
size = 1024
7: qh8-8020/ee00c500 (f10 ep4in [8/16] q2 p21)
15: qh8-8020/ee00c500
23: qh8-8020/ee00c500
31: qh8-8020/ee00c500
39: qh8-8020/ee00c500
47: qh8-8020/ee00c500
55: qh8-8020/ee00c500
63: qh8-8020/ee00c500
71: qh8-8020/ee00c500
79: qh8-8020/ee00c500
87: qh8-8020/ee00c500
95: qh8-8020/ee00c500
103: qh8-8020/ee00c500
111: qh8-8020/ee00c500
119: qh8-8020/ee00c500
127: qh8-8020/ee00c500
135: qh8-8020/ee00c500
143: qh8-8020/ee00c500
151: qh8-8020/ee00c500
159: qh8-8020/ee00c500
167: qh8-8020/ee00c500
175: qh8-8020/ee00c500
183: qh8-8020/ee00c500
191: qh8-8020/ee00c500
199: qh8-8020/ee00c500
207: qh8-8020/ee00c500
215: qh8-8020/ee00c500
223: qh8-8020/ee00c500
231: qh8-8020/ee00c500
239: qh8-8020/ee00c500
247: qh8-8020/ee00c500
255: qh256-0001/ee00c100 (h3 ep1in [7/0] q1 p1) qh256-0001/ee00c200 (h4 ep1in
[7/0] q1 p1) qh8-8020/ee00c500
263: qh8-8020/ee00c500
271: qh8-8020/ee00c500
279: qh8-8020/ee00c500
287: qh8-8020/ee00c500
295: qh8-8020/ee00c500
303: qh8-8020/ee00c500
311: qh8-8020/ee00c500
319: qh8-8020/ee00c500
327: qh8-8020/ee00c500
335: qh8-8020/ee00c500
343: qh8-8020/ee00c500
351: qh8-8020/ee00c500
359: qh8-8020/ee00c500
367: qh8-8020/ee00c500
375: qh8-8020/ee00c500
383: qh8-8020/ee00c500
391: qh8-8020/ee00c500
399: qh8-8020/ee00c500
407: qh8-8020/ee00c500
415: qh8-8020/ee00c500
423: qh8-8020/ee00c500
431: qh8-8020/ee00c500
439: qh8-8020/ee00c500
447: qh8-8020/ee00c500
455: qh8-8020/ee00c500
463: qh8-8020/ee00c500
471: qh8-8020/ee00c500
479: qh8-8020/ee00c500
487: qh8-8020/ee00c500
495: qh8-8020/ee00c500
503: qh8-8020/ee00c500
511: qh256-0001/ee00c100
519: qh8-8020/ee00c500
527: qh8-8020/ee00c500
535: qh8-8020/ee00c500
543: qh8-8020/ee00c500
551: qh8-8020/ee00c500
559: qh8-8020/ee00c500
567: qh8-8020/ee00c500
575: qh8-8020/ee00c500
583: qh8-8020/ee00c500
591: qh8-8020/ee00c500
599: qh8-8020/ee00c500
607: qh8-8020/ee00c500
615: qh8-8020/ee00c500
623: qh8-8020/ee00c500
631: qh8-8020/ee00c500
639: qh8-8020/ee00c500
647: qh8-8020/ee00c500
655: qh8-8020/ee00c500
663: qh8-8020/ee00c500
671: qh8-8020/ee00c500
679: qh8-8020/ee00c500
687: qh8-8020/ee00c500
695: qh8-8020/ee00c500
696: sitd1-3004/edad8060 sitd1-c010/edad80c0 sitd1-0003/edad81e0
697: sitd1-3004/edad8120 sitd1-c010/edad8000 sitd1-0003/edad8180
703: qh8-8020/ee00c500
711: qh8-8020/ee00c500
719: qh8-8020/ee00c500
727: qh8-8020/ee00c500
735: qh8-8020/ee00c500
743: qh8-8020/ee00c500
751: qh8-8020/ee00c500
759: qh8-8020/ee00c500
767: qh256-0001/ee00c100
775: qh8-8020/ee00c500
783: qh8-8020/ee00c500
791: qh8-8020/ee00c500
799: qh8-8020/ee00c500
807: qh8-8020/ee00c500
815: qh8-8020/ee00c500
823: qh8-8020/ee00c500
831: qh8-8020/ee00c500
839: qh8-8020/ee00c500
847: qh8-8020/ee00c500
855: qh8-8020/ee00c500
863: qh8-8020/ee00c500
871: qh8-8020/ee00c500
879: qh8-8020/ee00c500
887: qh8-8020/ee00c500
895: qh8-8020/ee00c500
903: qh8-8020/ee00c500
911: qh8-8020/ee00c500
919: qh8-8020/ee00c500
927: qh8-8020/ee00c500
935: qh8-8020/ee00c500
943: qh8-8020/ee00c500
951: qh8-8020/ee00c500
959: qh8-8020/ee00c500
967: qh8-8020/ee00c500
975: qh8-8020/ee00c500
983: qh8-8020/ee00c500
991: qh8-8020/ee00c500
999: qh8-8020/ee00c500
1007: qh8-8020/ee00c500
1015: qh8-8020/ee00c500
1023: qh256-0001/ee00c100