forked from len0rd/rockbox
Enable HID support, clean up usb-drv-as3525.c a bit, add a workaround for weird Linux behaviour (don't have Windows to test with), we don't need to set up USB_PHY_EPx_INFO (OF doesn't bother either).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27164 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
df238bcaf5
commit
31cf6d5013
8 changed files with 34 additions and 65 deletions
|
@ -907,7 +907,8 @@ Lyre prototype 1 */
|
||||||
#define USB_HAS_BULK
|
#define USB_HAS_BULK
|
||||||
#elif (CONFIG_USBOTG == USBOTG_ARC) || \
|
#elif (CONFIG_USBOTG == USBOTG_ARC) || \
|
||||||
(CONFIG_USBOTG == USBOTG_JZ4740) || \
|
(CONFIG_USBOTG == USBOTG_JZ4740) || \
|
||||||
(CONFIG_USBOTG == USBOTG_M66591)
|
(CONFIG_USBOTG == USBOTG_M66591) || \
|
||||||
|
(CONFIG_USBOTG == USBOTG_AS3525)
|
||||||
#define USB_HAS_BULK
|
#define USB_HAS_BULK
|
||||||
#define USB_HAS_INTERRUPT
|
#define USB_HAS_INTERRUPT
|
||||||
#elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
|
#elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
|
||||||
|
@ -917,7 +918,8 @@ Lyre prototype 1 */
|
||||||
//#define USB_HAS_INTERRUPT -- seems to be broken
|
//#define USB_HAS_INTERRUPT -- seems to be broken
|
||||||
#endif /* CONFIG_USBOTG */
|
#endif /* CONFIG_USBOTG */
|
||||||
|
|
||||||
#if CONFIG_USBOTG == USBOTG_ARC
|
#if (CONFIG_USBOTG == USBOTG_ARC) || \
|
||||||
|
(CONFIG_USBOTG == USBOTG_AS3525)
|
||||||
#define USB_HAS_ISOCHRONOUS
|
#define USB_HAS_ISOCHRONOUS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,7 @@
|
||||||
//#define USB_ENABLE_SERIAL
|
//#define USB_ENABLE_SERIAL
|
||||||
#define USB_VENDOR_ID 0x0781
|
#define USB_VENDOR_ID 0x0781
|
||||||
#define USB_PRODUCT_ID 0x7452
|
#define USB_PRODUCT_ID 0x7452
|
||||||
|
#define HAVE_USB_HID_MOUSE
|
||||||
|
|
||||||
/* Define this if you have adjustable CPU frequency */
|
/* Define this if you have adjustable CPU frequency */
|
||||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
|
@ -172,6 +172,7 @@
|
||||||
#define USE_ROCKBOX_USB
|
#define USE_ROCKBOX_USB
|
||||||
#define USB_VENDOR_ID 0x0781
|
#define USB_VENDOR_ID 0x0781
|
||||||
#define USB_PRODUCT_ID 0x7433
|
#define USB_PRODUCT_ID 0x7433
|
||||||
|
#define HAVE_USB_HID_MOUSE
|
||||||
|
|
||||||
/* Define this if you have adjustable CPU frequency */
|
/* Define this if you have adjustable CPU frequency */
|
||||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
|
@ -191,6 +191,7 @@
|
||||||
#define USE_ROCKBOX_USB
|
#define USE_ROCKBOX_USB
|
||||||
#define USB_VENDOR_ID 0x0781
|
#define USB_VENDOR_ID 0x0781
|
||||||
#define USB_PRODUCT_ID 0x7423
|
#define USB_PRODUCT_ID 0x7423
|
||||||
|
#define HAVE_USB_HID_MOUSE
|
||||||
|
|
||||||
/* Define this if you have adjustable CPU frequency */
|
/* Define this if you have adjustable CPU frequency */
|
||||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
|
@ -194,6 +194,7 @@
|
||||||
#define USE_ROCKBOX_USB
|
#define USE_ROCKBOX_USB
|
||||||
#define USB_VENDOR_ID 0x0781
|
#define USB_VENDOR_ID 0x0781
|
||||||
#define USB_PRODUCT_ID 0x74c1
|
#define USB_PRODUCT_ID 0x74c1
|
||||||
|
#define HAVE_USB_HID_MOUSE
|
||||||
|
|
||||||
/* Define this if you have adjustable CPU frequency */
|
/* Define this if you have adjustable CPU frequency */
|
||||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
|
@ -140,6 +140,7 @@
|
||||||
#define USE_ROCKBOX_USB
|
#define USE_ROCKBOX_USB
|
||||||
#define USB_VENDOR_ID 0x0781
|
#define USB_VENDOR_ID 0x0781
|
||||||
#define USB_PRODUCT_ID 0x7431
|
#define USB_PRODUCT_ID 0x7431
|
||||||
|
#define HAVE_USB_HID_MOUSE
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_SSD1815
|
#define CONFIG_LCD LCD_SSD1815
|
||||||
|
|
||||||
|
|
|
@ -417,7 +417,6 @@ int usb_drv_recv(int ep, void *ptr, int len)
|
||||||
endpoints[ep][1].state |= EP_STATE_BUSY;
|
endpoints[ep][1].state |= EP_STATE_BUSY;
|
||||||
endpoints[ep][1].len = len;
|
endpoints[ep][1].len = len;
|
||||||
endpoints[ep][1].rc = -1;
|
endpoints[ep][1].rc = -1;
|
||||||
endpoints[ep][1].timeout = current_tick + HZ;
|
|
||||||
|
|
||||||
/* remove data buffer from cache */
|
/* remove data buffer from cache */
|
||||||
invalidate_dcache_range(ptr, len);
|
invalidate_dcache_range(ptr, len);
|
||||||
|
@ -437,10 +436,9 @@ int usb_drv_recv(int ep, void *ptr, int len)
|
||||||
|
|
||||||
/* Make sure receive DMA is on */
|
/* Make sure receive DMA is on */
|
||||||
if (!(USB_DEV_CTRL & USB_DEV_CTRL_RDE)){
|
if (!(USB_DEV_CTRL & USB_DEV_CTRL_RDE)){
|
||||||
logf("enabling receive DMA\n");
|
|
||||||
USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
|
USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
|
||||||
if (!(USB_DEV_CTRL & USB_DEV_CTRL_RDE))
|
if (!(USB_DEV_CTRL & USB_DEV_CTRL_RDE))
|
||||||
logf("failed to enable!\n");
|
logf("failed to enable RDE!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
USB_OEP_CTRL(ep) |= USB_EP_CTRL_CNAK; /* Go! */
|
USB_OEP_CTRL(ep) |= USB_EP_CTRL_CNAK; /* Go! */
|
||||||
|
@ -487,7 +485,15 @@ void ep_send(int ep, void *ptr, int len)
|
||||||
endpoints[ep][0].state |= EP_STATE_BUSY;
|
endpoints[ep][0].state |= EP_STATE_BUSY;
|
||||||
endpoints[ep][0].len = len;
|
endpoints[ep][0].len = len;
|
||||||
endpoints[ep][0].rc = -1;
|
endpoints[ep][0].rc = -1;
|
||||||
endpoints[ep][0].timeout = current_tick + HZ;
|
|
||||||
|
/*
|
||||||
|
* I'm seeing a problem where Linux sends two SETUP requests,
|
||||||
|
* but fails to read the response from the first one.
|
||||||
|
* We then have the response we wanted to send still in our fifo,
|
||||||
|
* so flush the fifo before sending on the control endpoint.
|
||||||
|
*/
|
||||||
|
if (ep == 0)
|
||||||
|
USB_IEP_CTRL(ep) |= USB_EP_CTRL_FLUSH;
|
||||||
|
|
||||||
/* Make sure data is committed to memory */
|
/* Make sure data is committed to memory */
|
||||||
clean_dcache_range(ptr, len);
|
clean_dcache_range(ptr, len);
|
||||||
|
@ -525,8 +531,8 @@ int usb_drv_send(int ep, void *ptr, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
ep_send(ep, ptr, len);
|
ep_send(ep, ptr, len);
|
||||||
while (endpoints[ep][0].state & EP_STATE_BUSY)
|
if (wakeup_wait(&endpoints[ep][0].complete, HZ) == OBJ_WAIT_TIMEDOUT)
|
||||||
wakeup_wait(&endpoints[ep][0].complete, TIMEOUT_BLOCK);
|
logf("send timed out!\n");
|
||||||
|
|
||||||
return endpoints[ep][0].rc;
|
return endpoints[ep][0].rc;
|
||||||
}
|
}
|
||||||
|
@ -647,17 +653,6 @@ static void handle_out_ep(int ep)
|
||||||
logf("ep%d OUT, status %x\n", ep, ep_sts);
|
logf("ep%d OUT, status %x\n", ep, ep_sts);
|
||||||
panicf("ep%d OUT 0x%x", ep, ep_sts);
|
panicf("ep%d OUT 0x%x", ep, ep_sts);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* HW automatically disables RDE, re-enable it */
|
|
||||||
/* THEORY: Because we only set up one DMA buffer... */
|
|
||||||
USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(USB_DEV_CTRL & USB_DEV_CTRL_RDE)){
|
|
||||||
logf("receive DMA is disabled!\n");
|
|
||||||
//USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -678,8 +673,6 @@ static void usb_tick(void)
|
||||||
{
|
{
|
||||||
static int rde_timer = 0;
|
static int rde_timer = 0;
|
||||||
static int rde_fails = 0;
|
static int rde_fails = 0;
|
||||||
struct usb_endpoint *eps = &endpoints[0][0];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (usb_enum_timeout != -1) {
|
if (usb_enum_timeout != -1) {
|
||||||
/*
|
/*
|
||||||
|
@ -689,42 +682,24 @@ static void usb_tick(void)
|
||||||
usb_remove_int();
|
usb_remove_int();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<2*USB_NUM_EPS; i++) {
|
|
||||||
if (!(eps[i].state & EP_STATE_BUSY) ||
|
|
||||||
!TIME_AFTER(current_tick, endpoints[i]))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* recv or send timed out */
|
|
||||||
if (eps[i].state & EP_STATE_ASYNC) {
|
|
||||||
eps[i].rc = -1;
|
|
||||||
wakeup_signal(&eps[i].complete);
|
|
||||||
} else {
|
|
||||||
usb_core_transfer_complete(i/2, i&1 ? USB_DIR_OUT : USB_DIR_IN,
|
|
||||||
-1, 0);
|
|
||||||
}
|
|
||||||
eps[i].state &= ~(EP_STATE_BUSY|EP_STATE_ASYNC);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (USB_DEV_CTRL & USB_DEV_CTRL_RDE)
|
if (USB_DEV_CTRL & USB_DEV_CTRL_RDE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(USB_DEV_STS & USB_DEV_STS_RXF_EMPTY)) {
|
if (!(USB_DEV_STS & USB_DEV_STS_RXF_EMPTY))
|
||||||
if (rde_timer == 0)
|
|
||||||
logf("usb_tick: fifo got filled\n");
|
|
||||||
rde_timer++;
|
rde_timer++;
|
||||||
}
|
|
||||||
|
|
||||||
if (rde_timer > 2) {
|
if (rde_timer < 2)
|
||||||
logf("usb_tick: re-enabling RDE\n");
|
return;
|
||||||
USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
|
|
||||||
rde_timer = 0;
|
logf("usb_tick: re-enabling RDE\n");
|
||||||
if (USB_DEV_CTRL & USB_DEV_CTRL_RDE) {
|
USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
|
||||||
rde_fails = 0;
|
rde_timer = 0;
|
||||||
} else {
|
if (USB_DEV_CTRL & USB_DEV_CTRL_RDE) {
|
||||||
rde_fails++;
|
rde_fails = 0;
|
||||||
if (rde_fails > 3)
|
} else {
|
||||||
panicf("usb_tick: failed to set RDE");
|
rde_fails++;
|
||||||
}
|
if (rde_fails > 3)
|
||||||
|
panicf("usb_tick: failed to set RDE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,18 +781,6 @@ void INT_USB(void)
|
||||||
if (spd == USB_DEV_STS_SPD_FS) logf("fs\n");
|
if (spd == USB_DEV_STS_SPD_FS) logf("fs\n");
|
||||||
if (spd == USB_DEV_STS_SPD_LS) logf("ls\n");
|
if (spd == USB_DEV_STS_SPD_LS) logf("ls\n");
|
||||||
|
|
||||||
USB_PHY_EP0_INFO = 0x00200000 |
|
|
||||||
USB_CSR_DIR_OUT |
|
|
||||||
USB_CSR_TYPE_CTL;
|
|
||||||
USB_PHY_EP1_INFO = 0x00200000 |
|
|
||||||
USB_CSR_DIR_IN |
|
|
||||||
USB_CSR_TYPE_CTL;
|
|
||||||
USB_PHY_EP2_INFO = 0x00200001 |
|
|
||||||
USB_CSR_DIR_IN |
|
|
||||||
USB_CSR_TYPE_BULK;
|
|
||||||
USB_PHY_EP3_INFO = 0x00200001 |
|
|
||||||
USB_CSR_DIR_IN |
|
|
||||||
USB_CSR_TYPE_BULK;
|
|
||||||
USB_DEV_CTRL |= USB_DEV_CTRL_APCSR_DONE;
|
USB_DEV_CTRL |= USB_DEV_CTRL_APCSR_DONE;
|
||||||
USB_IEP_CTRL(0) |= USB_EP_CTRL_ACT;
|
USB_IEP_CTRL(0) |= USB_EP_CTRL_ACT;
|
||||||
USB_OEP_CTRL(0) |= USB_EP_CTRL_ACT;
|
USB_OEP_CTRL(0) |= USB_EP_CTRL_ACT;
|
||||||
|
|
|
@ -308,7 +308,6 @@ struct usb_dev_setup_buf {
|
||||||
struct usb_endpoint
|
struct usb_endpoint
|
||||||
{
|
{
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
unsigned int timeout;
|
|
||||||
volatile unsigned int state;
|
volatile unsigned int state;
|
||||||
int rc;
|
int rc;
|
||||||
struct wakeup complete;
|
struct wakeup complete;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue