]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
nds32: ftmac100 support cache enable.
authorrick <rick@andestech.com>
Tue, 29 Aug 2017 02:12:02 +0000 (10:12 +0800)
committerAndes <uboot@andestech.com>
Thu, 21 Sep 2017 02:30:22 +0000 (10:30 +0800)
Enable cache and ftmac100 performance can be improved.

Signed-off-by: rick <rick@andestech.com>
arch/nds32/cpu/n1213/start.S
arch/nds32/include/asm/io.h
include/configs/adp-ae3xx.h
include/configs/adp-ag101p.h

index f9f999902c22b4067b5153199f7ce7b1c078e7a0..0d98d03fc33d18df025fb7b2ff8861cf6d79b06a 100644 (file)
@@ -119,19 +119,46 @@ set_ivb:
        /* set IVIC, vector size: 4 bytes, base: 0x0 */
        mtsr    $r0, $ivb
 /*
- * MMU_CTL NTC0 Cacheable/Write-Back
+ * MMU_CTL NTC0 Non-cacheable
  */
+       li      $r0, ~0x6
+       mfsr    $r1, $mr0
+       and     $r1, $r1, $r0
+       mtsr    $r1, $mr0
+
        li      $r0, ~0x3
        mfsr    $r1, $mr8
        and     $r1, $r1, $r0
        mtsr    $r1, $mr8
 #if (!defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF))
+/*
+ * MMU_CTL NTC0 Cacheable/Write-Back
+ */
        li      $r0, 0x4
        mfsr    $r1, $mr0
        or      $r1, $r1, $r0
        mtsr    $r1, $mr0
 #endif
 
+#ifndef CONFIG_SYS_DCACHE_OFF
+#ifdef CONFIG_ARCH_MAP_SYSMEM
+/*
+ * MMU_CTL NTC1 Non-cacheable
+ */
+       li      $r0, ~0x18
+       mfsr    $r1, $mr0
+       and     $r1, $r1, $r0
+       mtsr    $r1, $mr0
+/*
+ * MMU_CTL NTM1 mapping for partition 0
+ */
+       li      $r0, ~0x6000
+       mfsr    $r1, $mr0
+       and     $r1, $r1, $r0
+       mtsr    $r1, $mr0
+#endif
+#endif
+
 #if !defined(CONFIG_SYS_ICACHE_OFF)
        li      $r0, 0x1
        mfsr    $r1, $mr8
index b2c4d0ef8cf342e18f523920987e5f11917fb08e..e8ee9615264cf89c00e5e2f24680706d2c217495 100644 (file)
@@ -48,6 +48,27 @@ static inline void sync(void)
 #define MAP_WRBACK     (0)
 #define MAP_WRTHROUGH  (0)
 
+#ifdef CONFIG_ARCH_MAP_SYSMEM
+static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
+{
+       if(paddr <PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE)
+       paddr = paddr | 0x40000000;
+       return (void *)(uintptr_t)paddr;
+}
+
+static inline void *unmap_sysmem(const void *vaddr)
+{
+       phys_addr_t paddr = (phys_addr_t)vaddr;
+       paddr = paddr & ~0x40000000;
+       return (void *)(uintptr_t)paddr;
+}
+
+static inline phys_addr_t map_to_sysmem(const void *ptr)
+{
+       return (phys_addr_t)(uintptr_t)ptr;
+}
+#endif
+
 static inline void *
 map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
 {
index f47e45b433e831ab5392eb09661efe6124336da7..4378df502c10e6a742fb28068c23c45b742a3963 100644 (file)
@@ -23,8 +23,7 @@
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_PANIC_HANG
 
-#define CONFIG_SYS_ICACHE_OFF
-#define CONFIG_SYS_DCACHE_OFF
+#define CONFIG_ARCH_MAP_SYSMEM
 
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_BOOTP_SERVERIP
index bf713b806d1be30c4006739b6ba4d17be28e7f74..fad4d308e036463379383016b9170c129e6ce3c6 100644 (file)
@@ -22,8 +22,7 @@
 
 #define CONFIG_CMDLINE_EDITING
 
-#define CONFIG_SYS_ICACHE_OFF
-#define CONFIG_SYS_DCACHE_OFF
+#define CONFIG_ARCH_MAP_SYSMEM
 
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_BOOTP_SERVERIP