summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/pcm-as3525.c10
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c2
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c2
-rw-r--r--firmware/target/arm/as3525/system-target.h4
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.c21
5 files changed, 15 insertions, 24 deletions
diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c
index 4033a9b88d..cefca0fbe5 100644
--- a/firmware/target/arm/as3525/pcm-as3525.c
+++ b/firmware/target/arm/as3525/pcm-as3525.c
@@ -180,7 +180,7 @@ const void * pcm_play_dma_get_peak_buffer(int *count)
180void * pcm_dma_addr(void *addr) 180void * pcm_dma_addr(void *addr)
181{ 181{
182 if (addr != NULL) 182 if (addr != NULL)
183 addr = UNCACHED_ADDR(addr); 183 addr = AS3525_UNCACHED_ADDR(addr);
184 return addr; 184 return addr;
185} 185}
186#endif 186#endif
@@ -271,7 +271,7 @@ static void rec_dma_callback(void)
271 rec_dma_start_addr += rec_dma_transfer_size; 271 rec_dma_start_addr += rec_dma_transfer_size;
272 272
273 /* the 2nd channel is silent when recording microphone on as3525v1 */ 273 /* the 2nd channel is silent when recording microphone on as3525v1 */
274 mono2stereo(UNCACHED_ADDR((int16_t*)rec_dma_start_addr)); 274 mono2stereo(AS3525_UNCACHED_ADDR((int16_t*)rec_dma_start_addr));
275 275
276 if(!rec_dma_size) 276 if(!rec_dma_size)
277 { 277 {
@@ -294,7 +294,7 @@ void pcm_rec_dma_record_more(void *start, size_t size)
294 dump_dcache_range(start, size); 294 dump_dcache_range(start, size);
295 rec_dma_start_addr = start; 295 rec_dma_start_addr = start;
296#if CONFIG_CPU == AS3525 296#if CONFIG_CPU == AS3525
297 mono_samples = UNCACHED_ADDR(start); 297 mono_samples = AS3525_UNCACHED_ADDR(start);
298#endif 298#endif
299 rec_dma_size = size; 299 rec_dma_size = size;
300} 300}
@@ -319,7 +319,7 @@ void pcm_rec_dma_start(void *addr, size_t size)
319 dump_dcache_range(addr, size); 319 dump_dcache_range(addr, size);
320 rec_dma_start_addr = addr; 320 rec_dma_start_addr = addr;
321#if CONFIG_CPU == AS3525 321#if CONFIG_CPU == AS3525
322 mono_samples = UNCACHED_ADDR(addr); 322 mono_samples = AS3525_UNCACHED_ADDR(addr);
323#endif 323#endif
324 rec_dma_size = size; 324 rec_dma_size = size;
325 325
@@ -359,7 +359,7 @@ void pcm_rec_dma_init(void)
359const void * pcm_rec_dma_get_peak_buffer(void) 359const void * pcm_rec_dma_get_peak_buffer(void)
360{ 360{
361 pcm_rec_lock(); 361 pcm_rec_lock();
362 int16_t *addr = UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1)); 362 int16_t *addr = AS3525_UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1));
363 mono2stereo(addr); 363 mono2stereo(addr);
364 pcm_rec_unlock(); 364 pcm_rec_unlock();
365 365
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c
index 57ad16bcb2..81dc637617 100644
--- a/firmware/target/arm/as3525/sd-as3525.c
+++ b/firmware/target/arm/as3525/sd-as3525.c
@@ -138,7 +138,7 @@ static volatile unsigned int transfer_error[NUM_VOLUMES];
138 138
139#define UNALIGNED_NUM_SECTORS 10 139#define UNALIGNED_NUM_SECTORS 10
140static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ 140static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */
141static unsigned char *uncached_buffer = UNCACHED_ADDR(&aligned_buffer[0]); 141static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]);
142 142
143 143
144static inline void mci_delay(void) { udelay(1000) ; } 144static inline void mci_delay(void) { udelay(1000) ; }
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index b61f4dd25f..3e370850d6 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -325,7 +325,7 @@
325 325
326#define UNALIGNED_NUM_SECTORS 10 326#define UNALIGNED_NUM_SECTORS 10
327static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ 327static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */
328static unsigned char *uncached_buffer = UNCACHED_ADDR(&aligned_buffer[0]); 328static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]);
329 329
330static void init_controller(void); 330static void init_controller(void);
331static int sd_wait_for_state(const int drive, unsigned int state); 331static int sd_wait_for_state(const int drive, unsigned int state);
diff --git a/firmware/target/arm/as3525/system-target.h b/firmware/target/arm/as3525/system-target.h
index 38e2028f65..11e89d9f2c 100644
--- a/firmware/target/arm/as3525/system-target.h
+++ b/firmware/target/arm/as3525/system-target.h
@@ -39,9 +39,9 @@
39#endif 39#endif
40 40
41#ifdef BOOTLOADER 41#ifdef BOOTLOADER
42#define UNCACHED_ADDR(a) (a) 42#define AS3525_UNCACHED_ADDR(a) (a)
43#else 43#else
44#define UNCACHED_ADDR(a) ((typeof(a)) ((uintptr_t)(a) + 0x10000000)) 44#define AS3525_UNCACHED_ADDR(a) ((typeof(a)) ((uintptr_t)(a) + 0x10000000))
45#endif 45#endif
46 46
47#ifdef SANSA_C200V2 47#ifdef SANSA_C200V2
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c
index 4c72368a83..ca1d8cbb07 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525.c
@@ -386,7 +386,7 @@ static void usb_phy_resume(void)
386 386
387static void setup_desc_init(struct usb_dev_setup_buf *desc) 387static void setup_desc_init(struct usb_dev_setup_buf *desc)
388{ 388{
389 struct usb_dev_setup_buf *uc_desc = UNCACHED_ADDR(desc); 389 struct usb_dev_setup_buf *uc_desc = AS3525_UNCACHED_ADDR(desc);
390 390
391 uc_desc->status = USB_DMA_DESC_BS_HST_RDY; 391 uc_desc->status = USB_DMA_DESC_BS_HST_RDY;
392 uc_desc->resv = 0xffffffff; 392 uc_desc->resv = 0xffffffff;
@@ -397,7 +397,7 @@ static void setup_desc_init(struct usb_dev_setup_buf *desc)
397static void dma_desc_init(int ep, int dir) 397static void dma_desc_init(int ep, int dir)
398{ 398{
399 struct usb_dev_dma_desc *desc = &dmadescs[ep][dir]; 399 struct usb_dev_dma_desc *desc = &dmadescs[ep][dir];
400 struct usb_dev_dma_desc *uc_desc = UNCACHED_ADDR(desc); 400 struct usb_dev_dma_desc *uc_desc = AS3525_UNCACHED_ADDR(desc);
401 401
402 endpoints[ep][dir].uc_desc = uc_desc; 402 endpoints[ep][dir].uc_desc = uc_desc;
403 403
@@ -626,15 +626,6 @@ void usb_drv_cancel_all_transfers(void)
626 restore_irq(flags); 626 restore_irq(flags);
627} 627}
628 628
629static void *virt_to_bus(void *addr)
630{
631 unsigned int x = (long)addr;
632
633 x -= (x & 0x40000000) >> 2; /* fix uncached address */
634
635 return (void*)x;
636}
637
638int usb_drv_recv(int ep, void *ptr, int len) 629int usb_drv_recv(int ep, void *ptr, int len)
639{ 630{
640 struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc; 631 struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc;
@@ -660,7 +651,7 @@ int usb_drv_recv(int ep, void *ptr, int len)
660 uc_desc->status |= USB_DMA_DESC_ZERO_LEN; 651 uc_desc->status |= USB_DMA_DESC_ZERO_LEN;
661 uc_desc->data_ptr = 0; 652 uc_desc->data_ptr = 0;
662 } else { 653 } else {
663 uc_desc->data_ptr = virt_to_bus(ptr); 654 uc_desc->data_ptr = ptr;
664 } 655 }
665 USB_OEP_DESC_PTR(ep) = (int)&dmadescs[ep][1]; 656 USB_OEP_DESC_PTR(ep) = (int)&dmadescs[ep][1];
666 USB_OEP_STS(ep) = USB_EP_STAT_OUT_RCVD; /* clear status */ 657 USB_OEP_STS(ep) = USB_EP_STAT_OUT_RCVD; /* clear status */
@@ -677,7 +668,7 @@ char *make_hex(char *data, int len)
677{ 668{
678 int i; 669 int i;
679 if (!((int)data & 0x40000000)) 670 if (!((int)data & 0x40000000))
680 data = UNCACHED_ADDR(data); /* don't pollute the cache */ 671 data = AS3525_UNCACHED_ADDR(data); /* don't pollute the cache */
681 672
682 if (len > 512) 673 if (len > 512)
683 len = 512; 674 len = 512;
@@ -712,7 +703,7 @@ void ep_send(int ep, void *ptr, int len)
712 if (len == 0) 703 if (len == 0)
713 uc_desc->status |= USB_DMA_DESC_ZERO_LEN; 704 uc_desc->status |= USB_DMA_DESC_ZERO_LEN;
714 705
715 uc_desc->data_ptr = virt_to_bus(ptr); 706 uc_desc->data_ptr = ptr;
716 707
717 USB_IEP_DESC_PTR(ep) = (int)&dmadescs[ep][0]; 708 USB_IEP_DESC_PTR(ep) = (int)&dmadescs[ep][0];
718 USB_IEP_STS(ep) = 0xffffffff; /* clear status */ 709 USB_IEP_STS(ep) = 0xffffffff; /* clear status */
@@ -785,7 +776,7 @@ static void handle_in_ep(int ep)
785 776
786static void handle_out_ep(int ep) 777static void handle_out_ep(int ep)
787{ 778{
788 struct usb_ctrlrequest *req = (void*)UNCACHED_ADDR(&setup_desc->data1); 779 struct usb_ctrlrequest *req = (void*)AS3525_UNCACHED_ADDR(&setup_desc->data1);
789 int ep_sts = USB_OEP_STS(ep) & ~USB_OEP_STS_MASK(ep); 780 int ep_sts = USB_OEP_STS(ep) & ~USB_OEP_STS_MASK(ep);
790 struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc; 781 struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc;
791 782