summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/m66591.c34
-rw-r--r--firmware/export/config.h9
2 files changed, 28 insertions, 15 deletions
diff --git a/firmware/drivers/m66591.c b/firmware/drivers/m66591.c
index 5b3c4e1035..8f29e04dc6 100644
--- a/firmware/drivers/m66591.c
+++ b/firmware/drivers/m66591.c
@@ -238,7 +238,7 @@ static int mxx_transmit_receive(int endpoint) {
238 238
239 /* Start sending data in 16-bit words */ 239 /* Start sending data in 16-bit words */
240 for (i = 0; i < (length>>1); i++) { 240 for (i = 0; i < (length>>1); i++) {
241 /* This wait is dangerous in the event htat something happens to 241 /* This wait is dangerous in the event that something happens to
242 * the PHY pipe where it never becomes ready again, should probably 242 * the PHY pipe where it never becomes ready again, should probably
243 * add a timeout, and ideally completely remove. 243 * add a timeout, and ideally completely remove.
244 */ 244 */
@@ -550,17 +550,30 @@ void usb_drv_set_test_mode(int mode) {
550int usb_drv_request_endpoint(int type, int dir) { 550int usb_drv_request_endpoint(int type, int dir) {
551 int ep; 551 int ep;
552 int pipecfg = 0; 552 int pipecfg = 0;
553
554 if (type != USB_ENDPOINT_XFER_BULK)
555 return -1;
556 553
557 /* The endpoint/pipes are hard coded: This could be more flexible */ 554 /* The endpoint/pipes are hard coded: This could be more flexible */
558 if (dir == USB_DIR_IN) { 555 if (type == USB_ENDPOINT_XFER_BULK) {
559 pipecfg |= (1<<4); 556 /* Enalbe double buffer mode */
560 ep = 2; 557 pipecfg |= 1<<9;
558
559 if (dir == USB_DIR_IN) {
560 pipecfg |= (1<<4);
561 ep = 2;
562 } else {
563 ep = 1;
564 }
565 } else if (type == USB_ENDPOINT_XFER_INT) {
566 if (dir == USB_DIR_IN) {
567 pipecfg |= (1<<4);
568 ep = 6;
569 } else {
570 ep = 5;
571 }
561 } else { 572 } else {
562 ep = 1; 573 /* Not a supported type */
574 return -1;
563 } 575 }
576
564 577
565 if (!M66591_eps[ep].busy) { 578 if (!M66591_eps[ep].busy) {
566 M66591_eps[ep].busy = true; 579 M66591_eps[ep].busy = true;
@@ -572,11 +585,12 @@ int usb_drv_request_endpoint(int type, int dir) {
572 585
573 M66591_PIPE_CFGSEL=ep; 586 M66591_PIPE_CFGSEL=ep;
574 587
575 pipecfg |= 1<<15 | 1<<9 | 1<<8; 588 /* Enable pipe (15) and continuous transfer mode (8) */
589 pipecfg |= 1<<15 | 1<<8;
576 590
577 pipe_handshake(ep, PIPE_SHAKE_NAK); 591 pipe_handshake(ep, PIPE_SHAKE_NAK);
578 592
579 // Setup the flags 593 /* Setup the flags */
580 M66591_PIPE_CFGWND=pipecfg; 594 M66591_PIPE_CFGWND=pipecfg;
581 595
582 logf("mxx: ep req ep#: %d config: 0x%04x", ep, M66591_PIPE_CFGWND); 596 logf("mxx: ep req ep#: %d config: 0x%04x", ep, M66591_PIPE_CFGWND);
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 95bf2fb73b..406ef509c8 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -788,13 +788,12 @@ Lyre prototype 1*/
788/* Define the implemented USB transport classes */ 788/* Define the implemented USB transport classes */
789#if CONFIG_USBOTG == USBOTG_ISP1583 789#if CONFIG_USBOTG == USBOTG_ISP1583
790#define USB_HAS_BULK 790#define USB_HAS_BULK
791#elif CONFIG_USBOTG == USBOTG_ARC 791#elif (CONFIG_USBOTG == USBOTG_ARC) || \
792 (CONFIG_USBOTG == USBOTG_JZ4740) || \
793 (CONFIG_USBOTG == USBOTG_M66591)
792#define USB_HAS_BULK 794#define USB_HAS_BULK
793#define USB_HAS_INTERRUPT 795#define USB_HAS_INTERRUPT
794#elif CONFIG_USBOTG == USBOTG_JZ4740 796#elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
795#define USB_HAS_BULK
796#define USB_HAS_INTERRUPT
797#elif defined(CPU_TCC780X) || defined(CPU_TCC77X) || defined(MROBE_500)
798#define USB_HAS_BULK 797#define USB_HAS_BULK
799#endif /* CONFIG_USBOTG */ 798#endif /* CONFIG_USBOTG */
800 799