]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
avr32: use dlmalloc for DMA buffers
authorAndreas Bießmann <andreas.devel@googlemail.com>
Fri, 6 Feb 2015 22:06:39 +0000 (23:06 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 11:53:50 +0000 (13:53 +0200)
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
arch/avr32/include/asm/dma-mapping.h
arch/avr32/lib/board.c
include/configs/atngw100.h
include/configs/atngw100mkii.h
include/configs/atstk1002.h
include/configs/atstk1006.h
include/configs/favr-32-ezkit.h
include/configs/grasshopper.h
include/configs/hammerhead.h
include/configs/mimc200.h

index dbdd2fee3806c32e7c8a48597d0b603882cd7564..1cde8275f4f905ee8a2c3eeadc3045a01850ae9a 100644 (file)
@@ -14,7 +14,12 @@ enum dma_data_direction {
        DMA_TO_DEVICE           = 1,
        DMA_FROM_DEVICE         = 2,
 };
        DMA_TO_DEVICE           = 1,
        DMA_FROM_DEVICE         = 2,
 };
-extern void *dma_alloc_coherent(size_t len, unsigned long *handle);
+
+static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
+{
+       *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
+       return (void *)*handle;
+}
 
 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
                                           enum dma_data_direction dir)
 
 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
                                           enum dma_data_direction dir)
index bf0997f98dc3802626418d190bb3cec2e165992c..7d13ac534b835077eb46262ce32d5a776c65a3c5 100644 (file)
@@ -45,50 +45,6 @@ int cpu_mmc_init(bd_t *bd)
        return atmel_mci_init((void *)ATMEL_BASE_MMCI);
 }
 
        return atmel_mci_init((void *)ATMEL_BASE_MMCI);
 }
 
-#ifdef CONFIG_SYS_DMA_ALLOC_LEN
-#include <asm/arch/cacheflush.h>
-#include <asm/io.h>
-
-static unsigned long dma_alloc_start;
-static unsigned long dma_alloc_end;
-static unsigned long dma_alloc_brk;
-
-static void dma_alloc_init(void)
-{
-       unsigned long monitor_addr;
-
-       monitor_addr = CONFIG_SYS_MONITOR_BASE + gd->reloc_off;
-       dma_alloc_end = monitor_addr - CONFIG_SYS_MALLOC_LEN;
-       dma_alloc_start = dma_alloc_end - CONFIG_SYS_DMA_ALLOC_LEN;
-       dma_alloc_brk = dma_alloc_start;
-
-       printf("DMA: Using memory from 0x%08lx to 0x%08lx\n",
-              dma_alloc_start, dma_alloc_end);
-
-       invalidate_dcache_range((unsigned long)cached(dma_alloc_start),
-                               dma_alloc_end);
-}
-
-void *dma_alloc_coherent(size_t len, unsigned long *handle)
-{
-       unsigned long paddr = dma_alloc_brk;
-
-       if (dma_alloc_brk + len > dma_alloc_end)
-               return NULL;
-
-       dma_alloc_brk = ((paddr + len + CONFIG_SYS_DCACHE_LINESZ - 1)
-                        & ~(CONFIG_SYS_DCACHE_LINESZ - 1));
-
-       *handle = paddr;
-       return uncached(paddr);
-}
-#else
-static inline void dma_alloc_init(void)
-{
-
-}
-#endif
-
 static int init_baudrate(void)
 {
        gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
 static int init_baudrate(void)
 {
        gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
@@ -180,12 +136,6 @@ void board_init_f(ulong board_type)
        /* Reserve memory for malloc() */
        addr -= CONFIG_SYS_MALLOC_LEN;
 
        /* Reserve memory for malloc() */
        addr -= CONFIG_SYS_MALLOC_LEN;
 
-#ifdef CONFIG_SYS_DMA_ALLOC_LEN
-       /* Reserve DMA memory (must be cache aligned) */
-       addr &= ~(CONFIG_SYS_DCACHE_LINESZ - 1);
-       addr -= CONFIG_SYS_DMA_ALLOC_LEN;
-#endif
-
 #ifdef CONFIG_LCD
 #ifdef CONFIG_FB_ADDR
        printf("LCD: Frame buffer allocated at preset 0x%08x\n",
 #ifdef CONFIG_LCD
 #ifdef CONFIG_FB_ADDR
        printf("LCD: Frame buffer allocated at preset 0x%08x\n",
@@ -264,7 +214,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        /* The malloc area is right below the monitor image in RAM */
        mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
                        CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN);
        /* The malloc area is right below the monitor image in RAM */
        mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
                        CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN);
-       dma_alloc_init();
 
        enable_interrupts();
 
 
        enable_interrupts();
 
index 9c81e3199f916d49d498d6ce3c5a7bd68ec95aec..540e86ae478b76903997ca044341c59aca3b0b5d 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN               (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
index 7b4f9cf2063b8e147c8bdeb96555dc58937e583b..35eae769301c9b6b961b9ceb6788871eaa8d3f9d 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN          (256*1024)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN          (256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN       (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR           (EBI_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR           (EBI_SDRAM_BASE + 0x00400000)
index 8f3fd0bb00018e1cc6725642220cf775519eb10a..9e58238f1d136466721f26e7479208d1c60e366e 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN               (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
index bbe0aea8616f9e91c4ead982228c430ed476be56..25090a68fa719fe34b9e7d018d89798f443c03b6 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN               (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
index 338d3dc78239b30a2d71412812fcf0574ee8d827..75bff4ce288af391f6590be8c323dfc71c186996 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN               (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
index 73534addfc1bcf6581515b11f1b9a67f8df00794..83f0ed2a622b8b30c0df992296ec684e32d11a73 100644 (file)
                                         CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN          (256*1024)
                                         CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN          (256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN       (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR           (EBI_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR           (EBI_SDRAM_BASE + 0x00400000)
index 4f0603abc13290b05e61ee5382e975d4231eb8f1..0bc42f12e0ada1c63bc7256fb8fd70cb80a86657 100644 (file)
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
 
 
 #define CONFIG_SYS_MALLOC_LEN                  (256*1024)
 
-#define CONFIG_SYS_DMA_ALLOC_LEN               (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (CONFIG_SYS_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (CONFIG_SYS_SDRAM_BASE + 0x00400000)
index fc7ecfaee47605af7055ea6c3be2c429543496da..2fd3addc1ad9f780a00499ff6836758f9297a1a7 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (1024*1024)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN                  (1024*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN               (16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR                   (EBI_SDRAM_BASE + 0x00400000)