Skip to content

Commit 325849f

Browse files
committed
Merge git://git.denx.de/u-boot-usb
2 parents 8c65a2f + de45149 commit 325849f

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

common/usb_kbd.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,12 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
460460
/* We found a USB Keyboard, install it. */
461461
usb_set_protocol(dev, iface->desc.bInterfaceNumber, 0);
462462

463+
debug("USB KBD: found set idle...\n");
463464
#if !defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) && \
464465
!defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
465-
debug("USB KBD: found set idle...\n");
466466
usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE / 4, 0);
467+
#else
468+
usb_set_idle(dev, iface->desc.bInterfaceNumber, 0, 0);
467469
#endif
468470

469471
debug("USB KBD: enable interrupt pipe...\n");

drivers/usb/host/ehci-hcd.c

+19-7
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,7 @@ static int _ehci_submit_control_msg(struct usb_device *dev, unsigned long pipe,
12141214

12151215
struct int_queue {
12161216
int elementsize;
1217+
unsigned long pipe;
12171218
struct QH *first;
12181219
struct QH *current;
12191220
struct QH *last;
@@ -1269,7 +1270,7 @@ static struct int_queue *_ehci_create_int_queue(struct usb_device *dev,
12691270
{
12701271
struct ehci_ctrl *ctrl = ehci_get_ctrl(dev);
12711272
struct int_queue *result = NULL;
1272-
int i;
1273+
uint32_t i, toggle;
12731274

12741275
/*
12751276
* Interrupt transfers requiring several transactions are not supported
@@ -1309,6 +1310,7 @@ static struct int_queue *_ehci_create_int_queue(struct usb_device *dev,
13091310
goto fail1;
13101311
}
13111312
result->elementsize = elementsize;
1313+
result->pipe = pipe;
13121314
result->first = memalign(USB_DMA_MINALIGN,
13131315
sizeof(struct QH) * queuesize);
13141316
if (!result->first) {
@@ -1326,6 +1328,8 @@ static struct int_queue *_ehci_create_int_queue(struct usb_device *dev,
13261328
memset(result->first, 0, sizeof(struct QH) * queuesize);
13271329
memset(result->tds, 0, sizeof(struct qTD) * queuesize);
13281330

1331+
toggle = usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe));
1332+
13291333
for (i = 0; i < queuesize; i++) {
13301334
struct QH *qh = result->first + i;
13311335
struct qTD *td = result->tds + i;
@@ -1357,7 +1361,9 @@ static struct int_queue *_ehci_create_int_queue(struct usb_device *dev,
13571361
td->qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE);
13581362
debug("communication direction is '%s'\n",
13591363
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) |
13611367
((usb_pipein(pipe) ? 1 : 0) << 8) | /* IN/OUT token */
13621368
0x80); /* active */
13631369
td->qt_buffer[0] =
@@ -1372,6 +1378,7 @@ static struct int_queue *_ehci_create_int_queue(struct usb_device *dev,
13721378
cpu_to_hc32((td->qt_buffer[0] + 0x4000) & ~0xfff);
13731379

13741380
*buf = buffer + i * elementsize;
1381+
toggle ^= 1;
13751382
}
13761383

13771384
flush_dcache_range((unsigned long)buffer,
@@ -1426,6 +1433,8 @@ static void *_ehci_poll_int_queue(struct usb_device *dev,
14261433
{
14271434
struct QH *cur = queue->current;
14281435
struct qTD *cur_td;
1436+
uint32_t token, toggle;
1437+
unsigned long pipe = queue->pipe;
14291438

14301439
/* depleted queue */
14311440
if (cur == NULL) {
@@ -1436,12 +1445,15 @@ static void *_ehci_poll_int_queue(struct usb_device *dev,
14361445
cur_td = &queue->tds[queue->current - queue->first];
14371446
invalidate_dcache_range((unsigned long)cur_td,
14381447
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);
14431451
return NULL;
14441452
}
1453+
1454+
toggle = QT_TOKEN_GET_DT(token);
1455+
usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), toggle);
1456+
14451457
if (!(cur->qh_link & QH_LINK_TERMINATE))
14461458
queue->current++;
14471459
else
@@ -1452,7 +1464,7 @@ static void *_ehci_poll_int_queue(struct usb_device *dev,
14521464
queue->elementsize));
14531465

14541466
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);
14561468
return cur->buffer;
14571469
}
14581470

include/usb.h

-15
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,6 @@ enum usb_init_type {
171171
* this is how the lowlevel part communicate with the outer world
172172
*/
173173

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-
185174
int usb_lowlevel_init(int index, enum usb_init_type init, void **controller);
186175
int usb_lowlevel_stop(int index);
187176

@@ -216,12 +205,8 @@ void *poll_int_queue(struct usb_device *dev, struct int_queue *queue);
216205
* in boards init functions e.g. udc_disconnect() used for
217206
* forced device disconnection from host.
218207
*/
219-
#elif defined(CONFIG_USB_GADGET_PXA2XX)
220-
221208
extern void udc_disconnect(void);
222209

223-
#endif
224-
225210
/*
226211
* board-specific hardware initialization, called by
227212
* usb drivers and u-boot commands

0 commit comments

Comments
 (0)