summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-06-22 13:27:58 +0000
committerTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-06-22 13:27:58 +0000
commitbf7e632e869ca0845a454e4e8b41e0ee08180f0b (patch)
tree01a88a60d126785e0b35b5a11c119f64ca86f5fc
parent5c50021b905559fdeabb30423e4a1cbfa118ffff (diff)
Hardware too smart can complicate things... We have to intercept the usb_core reply to SET_CONFIGURATION.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27051 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c
index 9b25491983..5c4725ea95 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525.c
@@ -39,6 +39,7 @@
#include "usb-drv-as3525.h"
static struct usb_endpoint endpoints[USB_NUM_EPS][2];
+static int got_set_configuration = 0;
/*
* dma/setup descriptors and buffers should avoid sharing
@@ -268,11 +269,9 @@ void usb_drv_init(void)
USB_DEV_CFG_CSR_PRG |
USB_DEV_CFG_PHY_ERR_DETECT;
- USB_DEV_CTRL = USB_DEV_CTRL_BLEN_1DWORD |
- USB_DEV_CTRL_DESC_UPDATE |
+ USB_DEV_CTRL = USB_DEV_CTRL_DESC_UPDATE |
USB_DEV_CTRL_THRES_ENABLE |
- USB_DEV_CTRL_RDE |
- 0x04000000;
+ USB_DEV_CTRL_BURST_ENABLE;
USB_DEV_EP_INTR_MASK &= ~((1<<0) | (1<<16)); /* ep 0 */
@@ -444,7 +443,7 @@ int usb_drv_recv(int ep, void *ptr, int len)
i++;
}
if (i>2)
- panicf("CNAK needed %d retries\n", i);
+ panicf("ep%d CNAK needed %d retries CTRL=%x\n", ep, i, (int)USB_OEP_CTRL(ep));
}
return 0;
@@ -506,6 +505,16 @@ int usb_drv_send(int ep, void *ptr, int len)
logf("usb_drv_send(%d,%x,%d): ", ep, (int)ptr, len);
ep &= 0x7f;
+
+ if (ep == 0 && got_set_configuration) {
+ got_set_configuration = 0;
+ if (len != 0)
+ panicf("usb_drv_send: GSC, but len!=0");
+ /* Tell the HW we handled the request */
+ USB_DEV_CTRL |= USB_DEV_CTRL_APCSR_DONE;
+ return 0;
+ }
+
ep_send(ep, ptr, len);
while (endpoints[ep][0].state & EP_STATE_BUSY)
wakeup_wait(&endpoints[ep][0].complete, TIMEOUT_BLOCK);
@@ -671,9 +680,6 @@ static void usb_tick(void)
}
if (rde_timer > 2) {
- logf("usb_tick: flushing EP0 IN\n");
- /* FIXME: flushing EP0 here papers over a bug somewhere */
- USB_IEP_CTRL(0) |= USB_EP_CTRL_FLUSH;
logf("usb_tick: re-enabling RDE\n");
USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
rde_timer = 0;
@@ -728,12 +734,10 @@ void INT_USB(void)
};
logf("set config\n");
+ got_set_configuration = 1;
set_config.wValue = USB_DEV_STS & USB_DEV_STS_MASK_CFG;
usb_core_control_request(&set_config);
-
- /* Tell the HW we handled the request */
- USB_DEV_CTRL |= USB_DEV_CTRL_APCSR_DONE;
intr &= ~USB_DEV_INTR_SET_CONFIG;
}
if (intr & USB_DEV_INTR_EARLY_SUSPEND) {/* idle >3ms detected */