Commit 325849ff3d4adeebb8f8f9bc5db950724df9bc21
Exists in
v2017.01-smarct4x
and in
34 other branches
Merge git://git.denx.de/u-boot-usb
Showing 3 changed files Side-by-side Diff
common/usb_kbd.c
... | ... | @@ -460,10 +460,12 @@ |
460 | 460 | /* We found a USB Keyboard, install it. */ |
461 | 461 | usb_set_protocol(dev, iface->desc.bInterfaceNumber, 0); |
462 | 462 | |
463 | + debug("USB KBD: found set idle...\n"); | |
463 | 464 | #if !defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) && \ |
464 | 465 | !defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE) |
465 | - debug("USB KBD: found set idle...\n"); | |
466 | 466 | usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE / 4, 0); |
467 | +#else | |
468 | + usb_set_idle(dev, iface->desc.bInterfaceNumber, 0, 0); | |
467 | 469 | #endif |
468 | 470 | |
469 | 471 | debug("USB KBD: enable interrupt pipe...\n"); |
drivers/usb/host/ehci-hcd.c
... | ... | @@ -1214,6 +1214,7 @@ |
1214 | 1214 | |
1215 | 1215 | struct int_queue { |
1216 | 1216 | int elementsize; |
1217 | + unsigned long pipe; | |
1217 | 1218 | struct QH *first; |
1218 | 1219 | struct QH *current; |
1219 | 1220 | struct QH *last; |
... | ... | @@ -1269,7 +1270,7 @@ |
1269 | 1270 | { |
1270 | 1271 | struct ehci_ctrl *ctrl = ehci_get_ctrl(dev); |
1271 | 1272 | struct int_queue *result = NULL; |
1272 | - int i; | |
1273 | + uint32_t i, toggle; | |
1273 | 1274 | |
1274 | 1275 | /* |
1275 | 1276 | * Interrupt transfers requiring several transactions are not supported |
... | ... | @@ -1309,6 +1310,7 @@ |
1309 | 1310 | goto fail1; |
1310 | 1311 | } |
1311 | 1312 | result->elementsize = elementsize; |
1313 | + result->pipe = pipe; | |
1312 | 1314 | result->first = memalign(USB_DMA_MINALIGN, |
1313 | 1315 | sizeof(struct QH) * queuesize); |
1314 | 1316 | if (!result->first) { |
... | ... | @@ -1326,6 +1328,8 @@ |
1326 | 1328 | memset(result->first, 0, sizeof(struct QH) * queuesize); |
1327 | 1329 | memset(result->tds, 0, sizeof(struct qTD) * queuesize); |
1328 | 1330 | |
1331 | + toggle = usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)); | |
1332 | + | |
1329 | 1333 | for (i = 0; i < queuesize; i++) { |
1330 | 1334 | struct QH *qh = result->first + i; |
1331 | 1335 | struct qTD *td = result->tds + i; |
... | ... | @@ -1357,7 +1361,9 @@ |
1357 | 1361 | td->qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE); |
1358 | 1362 | debug("communication direction is '%s'\n", |
1359 | 1363 | usb_pipein(pipe) ? "in" : "out"); |
1360 | - td->qt_token = cpu_to_hc32((elementsize << 16) | | |
1364 | + td->qt_token = cpu_to_hc32( | |
1365 | + QT_TOKEN_DT(toggle) | | |
1366 | + (elementsize << 16) | | |
1361 | 1367 | ((usb_pipein(pipe) ? 1 : 0) << 8) | /* IN/OUT token */ |
1362 | 1368 | 0x80); /* active */ |
1363 | 1369 | td->qt_buffer[0] = |
... | ... | @@ -1372,6 +1378,7 @@ |
1372 | 1378 | cpu_to_hc32((td->qt_buffer[0] + 0x4000) & ~0xfff); |
1373 | 1379 | |
1374 | 1380 | *buf = buffer + i * elementsize; |
1381 | + toggle ^= 1; | |
1375 | 1382 | } |
1376 | 1383 | |
1377 | 1384 | flush_dcache_range((unsigned long)buffer, |
... | ... | @@ -1426,6 +1433,8 @@ |
1426 | 1433 | { |
1427 | 1434 | struct QH *cur = queue->current; |
1428 | 1435 | struct qTD *cur_td; |
1436 | + uint32_t token, toggle; | |
1437 | + unsigned long pipe = queue->pipe; | |
1429 | 1438 | |
1430 | 1439 | /* depleted queue */ |
1431 | 1440 | if (cur == NULL) { |
1432 | 1441 | |
... | ... | @@ -1436,12 +1445,15 @@ |
1436 | 1445 | cur_td = &queue->tds[queue->current - queue->first]; |
1437 | 1446 | invalidate_dcache_range((unsigned long)cur_td, |
1438 | 1447 | ALIGN_END_ADDR(struct qTD, cur_td, 1)); |
1439 | - if (QT_TOKEN_GET_STATUS(hc32_to_cpu(cur_td->qt_token)) & | |
1440 | - QT_TOKEN_STATUS_ACTIVE) { | |
1441 | - debug("Exit poll_int_queue with no completed intr transfer. token is %x\n", | |
1442 | - hc32_to_cpu(cur_td->qt_token)); | |
1448 | + token = hc32_to_cpu(cur_td->qt_token); | |
1449 | + if (QT_TOKEN_GET_STATUS(token) & QT_TOKEN_STATUS_ACTIVE) { | |
1450 | + debug("Exit poll_int_queue with no completed intr transfer. token is %x\n", token); | |
1443 | 1451 | return NULL; |
1444 | 1452 | } |
1453 | + | |
1454 | + toggle = QT_TOKEN_GET_DT(token); | |
1455 | + usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), toggle); | |
1456 | + | |
1445 | 1457 | if (!(cur->qh_link & QH_LINK_TERMINATE)) |
1446 | 1458 | queue->current++; |
1447 | 1459 | else |
... | ... | @@ -1452,7 +1464,7 @@ |
1452 | 1464 | queue->elementsize)); |
1453 | 1465 | |
1454 | 1466 | debug("Exit poll_int_queue with completed intr transfer. token is %x at %p (first at %p)\n", |
1455 | - hc32_to_cpu(cur_td->qt_token), cur, queue->first); | |
1467 | + token, cur, queue->first); | |
1456 | 1468 | return cur->buffer; |
1457 | 1469 | } |
1458 | 1470 |
include/usb.h
... | ... | @@ -171,17 +171,6 @@ |
171 | 171 | * this is how the lowlevel part communicate with the outer world |
172 | 172 | */ |
173 | 173 | |
174 | -#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \ | |
175 | - defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \ | |
176 | - defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \ | |
177 | - defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \ | |
178 | - defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \ | |
179 | - defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) || \ | |
180 | - defined(CONFIG_USB_MUSB_DSPS) || defined(CONFIG_USB_MUSB_AM35X) || \ | |
181 | - defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined(CONFIG_USB_MUSB_SUNXI) || \ | |
182 | - defined(CONFIG_USB_XHCI) || defined(CONFIG_USB_DWC2) || \ | |
183 | - defined(CONFIG_USB_EMUL) | |
184 | - | |
185 | 174 | int usb_lowlevel_init(int index, enum usb_init_type init, void **controller); |
186 | 175 | int usb_lowlevel_stop(int index); |
187 | 176 | |
188 | 177 | |
... | ... | @@ -216,11 +205,7 @@ |
216 | 205 | * in boards init functions e.g. udc_disconnect() used for |
217 | 206 | * forced device disconnection from host. |
218 | 207 | */ |
219 | -#elif defined(CONFIG_USB_GADGET_PXA2XX) | |
220 | - | |
221 | 208 | extern void udc_disconnect(void); |
222 | - | |
223 | -#endif | |
224 | 209 | |
225 | 210 | /* |
226 | 211 | * board-specific hardware initialization, called by |