summaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-06-11 22:36:27 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-06-11 22:36:27 +0200
commitd1ca07111d6214c232b8f419f0daa98c6e0835f6 (patch)
treeee3fc1847197d5f161a5d68c9e00f7f6012c3f98 /arch/mips
parent63a9b9b25701775833f08984347901f4068b6957 (diff)
parente1e27870fa8498ce97436f81ff54ba2a41ff6f3f (diff)
downloadbarebox-d1ca07111d6214c232b8f419f0daa98c6e0835f6.tar.gz
barebox-d1ca07111d6214c232b8f419f0daa98c6e0835f6.tar.xz
Merge branch 'for-next/mips'
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig5
-rw-r--r--arch/mips/boot/dtb.c4
-rw-r--r--arch/mips/include/asm/addrspace.h20
-rw-r--r--arch/mips/include/asm/io.h6
-rw-r--r--arch/mips/include/asm/pbl_macros.h21
-rw-r--r--arch/mips/lib/c-r4k.c8
6 files changed, 48 insertions, 16 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index c2c555dc37..359f67883c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -25,6 +25,9 @@ config GENERIC_LINKER_SCRIPT
config HAS_NO_BOARD_HL_CODE
bool
+config PHYS_ADDR_T_64BIT
+ bool
+
menu "Machine selection"
config BUILTIN_DTB
@@ -275,6 +278,7 @@ config 64BIT
bool "64-bit barebox"
depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
select ARCH_DMA_ADDR_T_64BIT
+ select PHYS_ADDR_T_64BIT
help
Select this option if you want to build a 64-bit barebox.
@@ -337,6 +341,7 @@ config NMON_HELP
config MIPS_OPTIMIZED_STRING_FUNCTIONS
bool "use assembler optimized string functions"
+ depends on !64BIT
default y
help
Say yes here to use assembler optimized memcpy / memset functions.
diff --git a/arch/mips/boot/dtb.c b/arch/mips/boot/dtb.c
index e7633a5aff..3f7f466413 100644
--- a/arch/mips/boot/dtb.c
+++ b/arch/mips/boot/dtb.c
@@ -30,10 +30,10 @@ void of_add_memory_bank(struct device_node *node, bool dump, int r,
if (IS_ENABLED(CONFIG_MMU)) {
sprintf(str, "kseg0_ram%d", r);
- barebox_add_memory_bank(str, KSEG0 | base, size);
+ barebox_add_memory_bank(str, CKSEG0 | base, size);
} else {
sprintf(str, "kseg1_ram%d", r);
- barebox_add_memory_bank(str, KSEG1 | base, size);
+ barebox_add_memory_bank(str, CKSEG1 | base, size);
}
if (dump)
diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
index 17d480d083..dc44d7f790 100644
--- a/arch/mips/include/asm/addrspace.h
+++ b/arch/mips/include/asm/addrspace.h
@@ -73,6 +73,26 @@
#define CKSEG2ADDR(a) (CPHYSADDR(a) | CKSEG2)
#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3)
+/*
+ * Cache modes for XKPHYS address conversion macros
+ */
+#define K_CALG_COH_EXCL1_NOL2 0
+#define K_CALG_COH_SHRL1_NOL2 1
+#define K_CALG_UNCACHED 2
+#define K_CALG_NONCOHERENT 3
+#define K_CALG_COH_EXCL 4
+#define K_CALG_COH_SHAREABLE 5
+#define K_CALG_NOTUSED 6
+#define K_CALG_UNCACHED_ACCEL 7
+
+/*
+ * 64-bit address conversions
+ */
+#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
+#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
+#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
+#define PHYS_TO_XKPHYS(cm, a) (XKPHYS | (_ACAST64_(cm) << 59) | (a))
+
#else
#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 5a4cbf564a..c155199430 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -106,6 +106,12 @@ static inline void __raw_writel(u32 b, volatile void __iomem *addr)
#define out_be16(a, v) __raw_writew(__cpu_to_be16(v), a)
#define out_be32(a, v) __raw_writel(__cpu_to_be32(v), a)
+#ifdef CONFIG_64BIT
+#define IOMEM(addr) ((void __force __iomem *)PHYS_TO_XKSEG_UNCACHED(addr))
+#else
+#define IOMEM(addr) ((void __force __iomem *)CKSEG1ADDR(addr))
+#endif
+
#include <asm-generic/io.h>
#endif /* __ASM_MIPS_IO_H */
diff --git a/arch/mips/include/asm/pbl_macros.h b/arch/mips/include/asm/pbl_macros.h
index 37b150ac2b..18115c8489 100644
--- a/arch/mips/include/asm/pbl_macros.h
+++ b/arch/mips/include/asm/pbl_macros.h
@@ -134,21 +134,22 @@
subu t2, t1, t0 /* t2 <- size of pbl */
addu a2, a0, t2 /* a2 <- source end address */
+#define WSIZE 4
copy_loop:
/* copy from source address [a0] */
- lw t4, LONGSIZE * 0(a0)
- lw t5, LONGSIZE * 1(a0)
- lw t6, LONGSIZE * 2(a0)
- lw t7, LONGSIZE * 3(a0)
+ lw t4, WSIZE * 0(a0)
+ lw t5, WSIZE * 1(a0)
+ lw t6, WSIZE * 2(a0)
+ lw t7, WSIZE * 3(a0)
/* copy to target address [a1] */
- sw t4, LONGSIZE * 0(a1)
- sw t5, LONGSIZE * 1(a1)
- sw t6, LONGSIZE * 2(a1)
- sw t7, LONGSIZE * 3(a1)
- addi a0, LONGSIZE * 4
+ sw t4, WSIZE * 0(a1)
+ sw t5, WSIZE * 1(a1)
+ sw t6, WSIZE * 2(a1)
+ sw t7, WSIZE * 3(a1)
+ addi a0, WSIZE * 4
subu t3, a0, a2
blez t3, copy_loop
- addi a1, LONGSIZE * 4
+ addi a1, WSIZE * 4
copy_loop_exit:
diff --git a/arch/mips/lib/c-r4k.c b/arch/mips/lib/c-r4k.c
index 150205840d..cb0544a532 100644
--- a/arch/mips/lib/c-r4k.c
+++ b/arch/mips/lib/c-r4k.c
@@ -58,14 +58,14 @@ void flush_cache_all(void)
dcache_size = c->dcache.waysize * c->dcache.ways;
lsize = c->dcache.linesz;
- aend = (KSEG0 + dcache_size - 1) & ~(lsize - 1);
- for (addr = KSEG0; addr <= aend; addr += lsize)
+ aend = (CKSEG0 + dcache_size - 1) & ~(lsize - 1);
+ for (addr = CKSEG0; addr <= aend; addr += lsize)
cache_op(Index_Writeback_Inv_D, addr);
icache_size = c->icache.waysize * c->icache.ways;
lsize = c->icache.linesz;
- aend = (KSEG0 + icache_size - 1) & ~(lsize - 1);
- for (addr = KSEG0; addr <= aend; addr += lsize)
+ aend = (CKSEG0 + icache_size - 1) & ~(lsize - 1);
+ for (addr = CKSEG0; addr <= aend; addr += lsize)
cache_op(Index_Invalidate_I, addr);
/* secondatory cache skipped */