diff options
Diffstat (limited to 'firmware/drivers/usb')
-rw-r--r-- | firmware/drivers/usb/arcotg_dcd.c | 37 | ||||
-rw-r--r-- | firmware/drivers/usb/arcotg_dcd.h | 2 |
2 files changed, 18 insertions, 21 deletions
diff --git a/firmware/drivers/usb/arcotg_dcd.c b/firmware/drivers/usb/arcotg_dcd.c index 09e71fee41..c85b4ba374 100644 --- a/firmware/drivers/usb/arcotg_dcd.c +++ b/firmware/drivers/usb/arcotg_dcd.c | |||
@@ -197,12 +197,6 @@ void usb_arcotg_dcd_start(void) | |||
197 | { | 197 | { |
198 | logf("start"); | 198 | logf("start"); |
199 | 199 | ||
200 | if (arcotg_dcd.device_driver != NULL) { | ||
201 | logf("YEEEEEEESSSSSSS"); | ||
202 | } else { | ||
203 | logf("NOOOOOO"); | ||
204 | } | ||
205 | |||
206 | /* clear stopped bit */ | 200 | /* clear stopped bit */ |
207 | dcd_controller.stopped = false; | 201 | dcd_controller.stopped = false; |
208 | 202 | ||
@@ -461,7 +455,7 @@ static void reset_int(void) | |||
461 | /*-------------------------------------------------------------------------*/ | 455 | /*-------------------------------------------------------------------------*/ |
462 | /* usb controller ops */ | 456 | /* usb controller ops */ |
463 | 457 | ||
464 | int usb_arcotg_dcd_enable(struct usb_ep* ep) | 458 | int usb_arcotg_dcd_enable(struct usb_ep* ep, struct usb_endpoint_descriptor* desc) |
465 | { | 459 | { |
466 | unsigned short max = 0; | 460 | unsigned short max = 0; |
467 | unsigned char mult = 0, zlt = 0; | 461 | unsigned char mult = 0, zlt = 0; |
@@ -473,14 +467,12 @@ int usb_arcotg_dcd_enable(struct usb_ep* ep) | |||
473 | return -EINVAL; | 467 | return -EINVAL; |
474 | } | 468 | } |
475 | 469 | ||
476 | logf("ahhh %d", ep->desc->wMaxPacketSize); | 470 | max = desc->wMaxPacketSize; |
477 | max = ep->desc->wMaxPacketSize; | ||
478 | retval = -EINVAL; | 471 | retval = -EINVAL; |
479 | 472 | ||
480 | /* check the max package size validate for this endpoint */ | 473 | /* check the max package size validate for this endpoint */ |
481 | /* Refer to USB2.0 spec table 9-13, | 474 | /* Refer to USB2.0 spec table 9-13. */ |
482 | */ | 475 | switch (desc->bmAttributes & 0x03) { |
483 | switch (ep->desc->bmAttributes & 0x03) { | ||
484 | case USB_ENDPOINT_XFER_BULK: | 476 | case USB_ENDPOINT_XFER_BULK: |
485 | zlt = 1; | 477 | zlt = 1; |
486 | break; | 478 | break; |
@@ -493,6 +485,7 @@ int usb_arcotg_dcd_enable(struct usb_ep* ep) | |||
493 | break; | 485 | break; |
494 | 486 | ||
495 | case USB_ENDPOINT_XFER_CONTROL: | 487 | case USB_ENDPOINT_XFER_CONTROL: |
488 | zlt = 1; | ||
496 | break; | 489 | break; |
497 | } | 490 | } |
498 | 491 | ||
@@ -599,28 +592,32 @@ int usb_arcotg_dcd_enable(struct usb_ep* ep) | |||
599 | + } | 592 | + } |
600 | #endif | 593 | #endif |
601 | 594 | ||
595 | /* set address of used ep in desc */ | ||
596 | desc->bEndpointAddress |= ep->ep_num; | ||
597 | |||
602 | /* here initialize variable of ep */ | 598 | /* here initialize variable of ep */ |
603 | ep->maxpacket = max; | 599 | ep->maxpacket = max; |
600 | ep->desc = desc; | ||
604 | 601 | ||
605 | /* hardware special operation */ | 602 | /* hardware special operation */ |
606 | 603 | ||
607 | /* Init EPx Queue Head (Ep Capabilites field in QH | 604 | /* Init EPx Queue Head (Ep Capabilites field in QH |
608 | * according to max, zlt, mult) */ | 605 | * according to max, zlt, mult) */ |
609 | qh_init(ep->ep_num, | 606 | qh_init(ep->ep_num, |
610 | (ep->desc->bEndpointAddress & USB_DIR_IN) ? USB_RECV : USB_SEND, | 607 | (desc->bEndpointAddress & USB_DIR_IN) ? USB_RECV : USB_SEND, |
611 | (unsigned char) (ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK), | 608 | (unsigned char) (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK), |
612 | max, zlt, mult); | 609 | max, zlt, mult); |
613 | 610 | ||
614 | /* Init endpoint x at here */ | 611 | /* Init endpoint x at here */ |
615 | ep_setup(ep->ep_num, | 612 | ep_setup(ep->ep_num, |
616 | (unsigned char)((ep->desc->bEndpointAddress & USB_DIR_IN) ? USB_RECV : USB_SEND), | 613 | (unsigned char)(desc->bEndpointAddress & USB_DIR_IN) ? USB_RECV : USB_SEND, |
617 | (unsigned char)(ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)); | 614 | (unsigned char)(desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)); |
618 | 615 | ||
619 | /* Now HW will be NAKing transfers to that EP, | 616 | /* Now HW will be NAKing transfers to that EP, |
620 | * until a buffer is queued to it. */ | 617 | * until a buffer is queued to it. */ |
621 | 618 | ||
622 | retval = 0; | 619 | retval = 0; |
623 | switch (ep->desc->bmAttributes & 0x03) { | 620 | switch (desc->bmAttributes & 0x03) { |
624 | case USB_ENDPOINT_XFER_BULK: | 621 | case USB_ENDPOINT_XFER_BULK: |
625 | val = "bulk"; | 622 | val = "bulk"; |
626 | break; | 623 | break; |
@@ -638,8 +635,8 @@ int usb_arcotg_dcd_enable(struct usb_ep* ep) | |||
638 | logf("ep num %d", (int)ep->ep_num); | 635 | logf("ep num %d", (int)ep->ep_num); |
639 | 636 | ||
640 | logf("enabled %s (ep%d%s-%s)", ep->name, | 637 | logf("enabled %s (ep%d%s-%s)", ep->name, |
641 | ep->desc->bEndpointAddress & 0x0f, | 638 | desc->bEndpointAddress & 0x0f, |
642 | (ep->desc->bEndpointAddress & USB_DIR_IN) ? "in" : "out", val); | 639 | (desc->bEndpointAddress & USB_DIR_IN) ? "in" : "out", val); |
643 | logf(" maxpacket %d", max); | 640 | logf(" maxpacket %d", max); |
644 | 641 | ||
645 | return retval; | 642 | return retval; |
diff --git a/firmware/drivers/usb/arcotg_dcd.h b/firmware/drivers/usb/arcotg_dcd.h index 2e6f71ef94..6c5f5739d5 100644 --- a/firmware/drivers/usb/arcotg_dcd.h +++ b/firmware/drivers/usb/arcotg_dcd.h | |||
@@ -146,7 +146,7 @@ void usb_arcotg_dcd_start(void); | |||
146 | void usb_arcotg_dcd_stop(void); | 146 | void usb_arcotg_dcd_stop(void); |
147 | 147 | ||
148 | /* usb controller ops */ | 148 | /* usb controller ops */ |
149 | int usb_arcotg_dcd_enable(struct usb_ep* ep); | 149 | int usb_arcotg_dcd_enable(struct usb_ep* ep, struct usb_endpoint_descriptor* desc); |
150 | int usb_arcotg_dcd_disable(struct usb_ep* ep); | 150 | int usb_arcotg_dcd_disable(struct usb_ep* ep); |
151 | int usb_arcotg_dcd_set_halt(struct usb_ep* ep, bool halt); | 151 | int usb_arcotg_dcd_set_halt(struct usb_ep* ep, bool halt); |
152 | int usb_arcotg_dcd_send(struct usb_ep* ep, struct usb_response* request); | 152 | int usb_arcotg_dcd_send(struct usb_ep* ep, struct usb_response* request); |