From c8d6ff087d062bc4e1d7725a797218c434bc94ca Mon Sep 17 00:00:00 2001 From: funman Date: Wed, 19 May 2010 18:08:32 +0000 Subject: [PATCH] revert part of r26176 to avoid large static allocation we still need to convert uncached addresses to physical addresses git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26177 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/usb-drv-as3525.c | 13 +++++++++++-- firmware/usbstack/usb_storage.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c index 740526407..4c72368a8 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525.c +++ b/firmware/target/arm/as3525/usb-drv-as3525.c @@ -626,6 +626,15 @@ void usb_drv_cancel_all_transfers(void) restore_irq(flags); } +static void *virt_to_bus(void *addr) +{ + unsigned int x = (long)addr; + + x -= (x & 0x40000000) >> 2; /* fix uncached address */ + + return (void*)x; +} + int usb_drv_recv(int ep, void *ptr, int len) { struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc; @@ -651,7 +660,7 @@ int usb_drv_recv(int ep, void *ptr, int len) uc_desc->status |= USB_DMA_DESC_ZERO_LEN; uc_desc->data_ptr = 0; } else { - uc_desc->data_ptr = ptr; + uc_desc->data_ptr = virt_to_bus(ptr); } USB_OEP_DESC_PTR(ep) = (int)&dmadescs[ep][1]; USB_OEP_STS(ep) = USB_EP_STAT_OUT_RCVD; /* clear status */ @@ -703,7 +712,7 @@ void ep_send(int ep, void *ptr, int len) if (len == 0) uc_desc->status |= USB_DMA_DESC_ZERO_LEN; - uc_desc->data_ptr = ptr; + uc_desc->data_ptr = virt_to_bus(ptr); USB_IEP_DESC_PTR(ep) = (int)&dmadescs[ep][0]; USB_IEP_STS(ep) = 0xffffffff; /* clear status */ diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 8917a6714..3373bf41f 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -449,7 +449,7 @@ void usb_storage_init_connection(void) state = WAITING_FOR_COMMAND; #if CONFIG_CPU == IMX31L || defined(CPU_TCC77X) || defined(CPU_TCC780X) || \ - defined(BOOTLOADER) || CONFIG_CPU == DM320 || CONFIG_CPU == AS3525 + defined(BOOTLOADER) || CONFIG_CPU == DM320 static unsigned char _cbw_buffer[MAX_CBW_SIZE] USB_DEVBSS_ATTR __attribute__((aligned(32))); cbw_buffer = (void *)_cbw_buffer; -- 2.11.4.GIT