From 8fad84c17d387fc457d30d8bf7c719e9b05eb960 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 12 Nov 2013 20:22:44 +0100 Subject: [PATCH 01/14] microblaze: Wire up defconfig to mmu_defconfig Without this, "make defconfig" fails with *** Can't find default configuration "arch/microblaze/defconfig"! All other architectures either set KBUILD_DEFCONFIG, or provide arch/*/defconfig. Signed-off-by: Geert Uytterhoeven Signed-off-by: Michal Simek --- arch/microblaze/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile index 40350a3c24e9..a69eaf2ab130 100644 --- a/arch/microblaze/Makefile +++ b/arch/microblaze/Makefile @@ -1,3 +1,5 @@ +KBUILD_DEFCONFIG := mmu_defconfig + ifeq ($(CONFIG_MMU),y) UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" else From 7746c99f031daf15eb66993ed3e556e123efd7a5 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 12 Nov 2013 20:42:18 +0100 Subject: [PATCH 02/14] microblaze: Remove _fdt_start casts _fdt_start is an array, i.e. a pointer. Signed-off-by: Geert Uytterhoeven Cc: Michal Simek Cc: microblaze-uclinux@itee.uq.edu.au Signed-off-by: Michal Simek --- arch/microblaze/kernel/setup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 8de8ebc309f1..603e22fec6d5 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c @@ -136,7 +136,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram, lockdep_init(); /* initialize device tree for usage in early_printk */ - early_init_devtree((void *)_fdt_start); + early_init_devtree(_fdt_start); #ifdef CONFIG_EARLY_PRINTK setup_early_printk(NULL); @@ -152,8 +152,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram, if (fdt) pr_info("FDT at 0x%08x\n", fdt); else - pr_info("Compiled-in FDT at 0x%08x\n", - (unsigned int)_fdt_start); + pr_info("Compiled-in FDT at %p\n", _fdt_start); #ifdef CONFIG_MTD_UCLINUX pr_info("Found romfs @ 0x%08x (0x%08x)\n", From 64aff1d651f06206a181e9a3883da913edf43b77 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 12 Nov 2013 20:42:19 +0100 Subject: [PATCH 03/14] microblaze: Remove duplicate declarations of _stext[] and _etext[] They're already provided by . Signed-off-by: Geert Uytterhoeven Cc: Michal Simek Cc: microblaze-uclinux@itee.uq.edu.au Signed-off-by: Michal Simek --- arch/microblaze/include/asm/sections.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/microblaze/include/asm/sections.h b/arch/microblaze/include/asm/sections.h index c07ed5d2a820..1b281d3ea734 100644 --- a/arch/microblaze/include/asm/sections.h +++ b/arch/microblaze/include/asm/sections.h @@ -16,7 +16,6 @@ # ifndef __ASSEMBLY__ extern char _ssbss[], _esbss[]; extern unsigned long __ivt_start[], __ivt_end[]; -extern char _etext[], _stext[]; extern u32 _fdt_start[], _fdt_end[]; From fd43769ee5c3c6b4d702b358ea472581b0976ed3 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 25 Nov 2013 09:55:16 +0100 Subject: [PATCH 04/14] microblaze/uapi: Use Kbuild logic to include Signed-off-by: Geert Uytterhoeven Cc: Michal Simek Cc: microblaze-uclinux@itee.uq.edu.au Signed-off-by: Michal Simek --- arch/microblaze/include/uapi/asm/Kbuild | 3 ++- arch/microblaze/include/uapi/asm/types.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 arch/microblaze/include/uapi/asm/types.h diff --git a/arch/microblaze/include/uapi/asm/Kbuild b/arch/microblaze/include/uapi/asm/Kbuild index 6d7d7f4aaae8..1aac99f87df1 100644 --- a/arch/microblaze/include/uapi/asm/Kbuild +++ b/arch/microblaze/include/uapi/asm/Kbuild @@ -1,6 +1,8 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm +generic-y += types.h + header-y += auxvec.h header-y += bitsperlong.h header-y += byteorder.h @@ -31,5 +33,4 @@ header-y += statfs.h header-y += swab.h header-y += termbits.h header-y += termios.h -header-y += types.h header-y += unistd.h diff --git a/arch/microblaze/include/uapi/asm/types.h b/arch/microblaze/include/uapi/asm/types.h deleted file mode 100644 index b9e79bc580dd..000000000000 --- a/arch/microblaze/include/uapi/asm/types.h +++ /dev/null @@ -1 +0,0 @@ -#include From 21ecc1f1d2e01ddbd75c3db208236628474a43e1 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 7 Jan 2014 11:45:07 +0100 Subject: [PATCH 05/14] microblaze: Simplify fcpu helper function Use of_property_read_u32() instead of all of_get_property with big endian conversion. Signed-off-by: Michal Simek --- arch/microblaze/include/asm/cpuinfo.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h index 7d6831ac8a46..7161fb575861 100644 --- a/arch/microblaze/include/asm/cpuinfo.h +++ b/arch/microblaze/include/asm/cpuinfo.h @@ -97,9 +97,11 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu); static inline unsigned int fcpu(struct device_node *cpu, char *n) { - const __be32 *val; - return (val = of_get_property(cpu, n, NULL)) ? - be32_to_cpup(val) : 0; + u32 val = 0; + + of_property_read_u32(cpu, n, &val); + + return val; } #endif /* _ASM_MICROBLAZE_CPUINFO_H */ From c1120542b99a67a620cd8a298975d76dca5a13f0 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 18 Dec 2013 17:18:48 +0100 Subject: [PATCH 06/14] microblaze: Add support for CCF Add support for CCF for Microblaze. Old binding: system_timer: system-timer@41c00000 { clock-frequency = <75000000>; ... } New binding: system_timer: system-timer@41c00000 { clocks = <&clk_bus>; ... } Both should be supported for a while Microblaze clock binding: clocks { #address-cells = <1>; #size-cells = <0>; clk_bus: bus { #clock-cells = <0>; clock-frequency = <75000000>; clock-output-names = "bus"; compatible = "fixed-clock"; reg = <1>; } ; clk_cpu: cpu { #clock-cells = <0>; clock-frequency = <75000000>; clock-output-names = "cpu"; compatible = "fixed-clock"; reg = <0>; } ; } ; Signed-off-by: Michal Simek --- arch/microblaze/Kconfig | 1 + arch/microblaze/include/asm/cpuinfo.h | 1 + arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c | 3 --- arch/microblaze/kernel/cpu/cpuinfo-static.c | 2 -- arch/microblaze/kernel/cpu/cpuinfo.c | 23 +++++++++++++++++-- arch/microblaze/kernel/setup.c | 3 +++ arch/microblaze/kernel/timer.c | 18 +++++++++++---- 7 files changed, 40 insertions(+), 11 deletions(-) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index e23cccde9c27..a715eeaf9959 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -26,6 +26,7 @@ config MICROBLAZE select GENERIC_CPU_DEVICES select GENERIC_ATOMIC64 select GENERIC_CLOCKEVENTS + select COMMON_CLK select GENERIC_IDLE_POLL_SETUP select MODULES_USE_ELF_RELA select CLONE_BACKWARDS3 diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h index 7161fb575861..3337417fcdca 100644 --- a/arch/microblaze/include/asm/cpuinfo.h +++ b/arch/microblaze/include/asm/cpuinfo.h @@ -91,6 +91,7 @@ extern struct cpuinfo cpuinfo; /* fwd declarations of the various CPUinfo populators */ void setup_cpuinfo(void); +void setup_cpuinfo_clk(void); void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu); void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu); diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c index ee4689415410..93c26cf50de5 100644 --- a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c +++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c @@ -112,7 +112,4 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu) CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK); CI(fpga_family_code, TARGET_FAMILY); - - /* take timebase-frequency from DTS */ - ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency"); } diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c index 592bb2e838c4..4854285b26e7 100644 --- a/arch/microblaze/kernel/cpu/cpuinfo-static.c +++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c @@ -113,8 +113,6 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu) ci->num_rd_brk = fcpu(cpu, "xlnx,number-of-rd-addr-brk"); ci->num_wr_brk = fcpu(cpu, "xlnx,number-of-wr-addr-brk"); - ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency"); - ci->pvr_user1 = fcpu(cpu, "xlnx,pvr-user1"); ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2"); diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c index c9203b1007aa..ce1cfed731ea 100644 --- a/arch/microblaze/kernel/cpu/cpuinfo.c +++ b/arch/microblaze/kernel/cpu/cpuinfo.c @@ -8,6 +8,7 @@ * for more details. */ +#include #include #include #include @@ -68,11 +69,10 @@ const struct family_string_key family_string_lookup[] = { }; struct cpuinfo cpuinfo; +static struct device_node *cpu; void __init setup_cpuinfo(void) { - struct device_node *cpu = NULL; - cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu"); if (!cpu) pr_err("You don't have cpu!!!\n"); @@ -102,3 +102,22 @@ void __init setup_cpuinfo(void) pr_warn("%s: Stream instructions enabled" " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__); } + +void __init setup_cpuinfo_clk(void) +{ + struct clk *clk; + + clk = of_clk_get(cpu, 0); + if (IS_ERR(clk)) { + pr_err("ERROR: CPU CCF input clock not found\n"); + /* take timebase-frequency from DTS */ + cpuinfo.cpu_clock_freq = fcpu(cpu, "timebase-frequency"); + } else { + cpuinfo.cpu_clock_freq = clk_get_rate(clk); + } + + if (!cpuinfo.cpu_clock_freq) { + pr_err("ERROR: CPU clock frequency not setup\n"); + BUG(); + } +} diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 603e22fec6d5..9d972d2bd924 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -195,6 +196,8 @@ void __init machine_early_init(const char *cmdline, unsigned int ram, void __init time_init(void) { + of_clk_init(NULL); + setup_cpuinfo_clk(); clocksource_of_init(); } diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index 3e39b1082fdf..55b19400951f 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -230,9 +230,9 @@ static int timer_initialized; static void __init xilinx_timer_init(struct device_node *timer) { + struct clk *clk; u32 irq; u32 timer_num = 1; - int ret; timer_baseaddr = of_iomap(timer, 0); if (!timer_baseaddr) { @@ -250,10 +250,20 @@ static void __init xilinx_timer_init(struct device_node *timer) pr_info("%s: irq=%d\n", timer->full_name, irq); - /* If there is clock-frequency property than use it */ - ret = of_property_read_u32(timer, "clock-frequency", &timer_clock_freq); - if (ret < 0) + clk = of_clk_get(timer, 0); + if (IS_ERR(clk)) { + pr_err("ERROR: timer CCF input clock not found\n"); + /* If there is clock-frequency property than use it */ + of_property_read_u32(timer, "clock-frequency", + &timer_clock_freq); + } else { + timer_clock_freq = clk_get_rate(clk); + } + + if (!timer_clock_freq) { + pr_err("ERROR: Using CPU clock frequency\n"); timer_clock_freq = cpuinfo.cpu_clock_freq; + } freq_div_hz = timer_clock_freq / HZ; From 0f7e36406cd1d519ebde736f86731695b1bb3eb7 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 27 Jan 2014 10:50:42 +0100 Subject: [PATCH 07/14] microblaze: Add NOTES section to linker script Do not keep NOTES section align in proper location. 'readelf' shows that 'NOTE' is placed in wrong location which is out of virtual and physical load addresses. Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 1] .note.gnu.build-i NOTE 00000000 001000 000024 00 A 0 0 4 [ 2] .text PROGBITS c0000000 002000 284570 00 AX 0 0 16 [ 3] __fdt_blob PROGBITS c0284570 286570 008000 00 A 0 0 1 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x001000 0x00000000 0x00000000 0x00024 0x00024 R 0x1000 LOAD 0x002000 0xc0000000 0x08000000 0x315428 0x316000 RWE 0x1000 This patch move 'NOTE' section to the correct location. Checked with: "ARM: 6740/1: Place correctly notes section in the linker script" (sha1: dc810efb0ca5702c9d96782b99282d4b4383e877) and "[S390] incorrect note program header" (sha1: 7a2512b744e72377c3fa5976f06a3f343e155d1f) Signed-off-by: Michal Simek --- arch/microblaze/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index 936d01a689d7..be9488d69734 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S @@ -51,6 +51,7 @@ SECTIONS { . = ALIGN(16); RODATA EXCEPTION_TABLE(16) + NOTES /* * sdata2 section can go anywhere, but must be word aligned From 839396ab88e4ac0107a88cb85fa59a7ec3f94416 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 20 Dec 2013 10:16:40 +0100 Subject: [PATCH 08/14] microblaze: timer: Use generic sched_clock implementation Remove sched_clock from the driver and use sched_clock_register function. Inspired-by: "arch_timer: Move to generic sched_clock framework" (sha1: 65cd4f6c99c1170bd0114dbd71b978012ea44d28) Signed-off-by: Michal Simek --- arch/microblaze/Kconfig | 1 + arch/microblaze/kernel/timer.c | 27 ++++++++------------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index a715eeaf9959..c9f8bb4046d7 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -27,6 +27,7 @@ config MICROBLAZE select GENERIC_ATOMIC64 select GENERIC_CLOCKEVENTS select COMMON_CLK + select GENERIC_SCHED_CLOCK select GENERIC_IDLE_POLL_SETUP select MODULES_USE_ELF_RELA select CLONE_BACKWARDS3 diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index 55b19400951f..06609e01f1cf 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -12,12 +12,12 @@ #include #include #include +#include #include #include #include #include #include -#include static void __iomem *timer_baseaddr; @@ -167,10 +167,15 @@ static __init void xilinx_clockevent_init(void) clockevents_register_device(&clockevent_xilinx_timer); } +static u64 xilinx_clock_read(void) +{ + return in_be32(timer_baseaddr + TCR1); +} + static cycle_t xilinx_read(struct clocksource *cs) { /* reading actual value of timer 1 */ - return (cycle_t) (in_be32(timer_baseaddr + TCR1)); + return (cycle_t)xilinx_clock_read(); } static struct timecounter xilinx_tc = { @@ -222,12 +227,6 @@ static int __init xilinx_clocksource_init(void) return 0; } -/* - * We have to protect accesses before timer initialization - * and return 0 for sched_clock function below. - */ -static int timer_initialized; - static void __init xilinx_timer_init(struct device_node *timer) { struct clk *clk; @@ -273,18 +272,8 @@ static void __init xilinx_timer_init(struct device_node *timer) #endif xilinx_clocksource_init(); xilinx_clockevent_init(); - timer_initialized = 1; -} -unsigned long long notrace sched_clock(void) -{ - if (timer_initialized) { - struct clocksource *cs = &clocksource_microblaze; - - cycle_t cyc = cnt32_to_63(cs->read(NULL)) & LLONG_MAX; - return clocksource_cyc2ns(cyc, cs->mult, cs->shift); - } - return 0; + sched_clock_register(xilinx_clock_read, 32, timer_clock_freq); } CLOCKSOURCE_OF_DECLARE(xilinx_timer, "xlnx,xps-timer-1.00.a", From 03fe0d3c27ed37d936eaa61e10ce56f8b15361a7 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 27 Jan 2014 10:41:59 +0100 Subject: [PATCH 09/14] microblaze: timer: Do not initialized system timer twice Only one system timer can be setup. Do not initialize more system timers. Signed-off-by: Michal Simek --- arch/microblaze/kernel/timer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index 06609e01f1cf..fb0c61443f19 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -230,9 +230,15 @@ static int __init xilinx_clocksource_init(void) static void __init xilinx_timer_init(struct device_node *timer) { struct clk *clk; + static int initialized; u32 irq; u32 timer_num = 1; + if (initialized) + return; + + initialized = 1; + timer_baseaddr = of_iomap(timer, 0); if (!timer_baseaddr) { pr_err("ERROR: invalid timer base address\n"); From 17578ea198a9b9210ba7846029624d57be6acea2 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 20 Nov 2013 13:59:40 +0100 Subject: [PATCH 10/14] microblaze: Define read/write{b,w,l}_relaxed MMIO More and more ARM specific drivers is using MMIO readX/writeX_relaxed IO functions and Microblaze can shared some drivers with ARM too. This patch adds relaxed IO accessor macros to prevent compilation failures. Signed-off-by: Michal Simek --- arch/microblaze/include/asm/io.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index 2565cb94f32f..a2cea7206077 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h @@ -342,4 +342,12 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) #define iowrite32_rep(p, src, count) \ outsl((unsigned long) (p), (src), (count)) +#define readb_relaxed readb +#define readw_relaxed readw +#define readl_relaxed readl + +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel + #endif /* _ASM_MICROBLAZE_IO_H */ From 34b9c07a3b644760159571ee99d0f7fc67b83a8d Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 23 Aug 2013 07:16:50 +0200 Subject: [PATCH 11/14] microblaze: Disable stack protection from bootloader Microblaze without MMU can use stack protection in bootloader and kernel should clear this setting ASAP. Signed-off-by: Michal Simek --- arch/microblaze/kernel/head.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S index 817b7eec95b6..b7fb0438458c 100644 --- a/arch/microblaze/kernel/head.S +++ b/arch/microblaze/kernel/head.S @@ -64,6 +64,10 @@ real_start: #endif mts rmsr, r0 +/* Disable stack protection from bootloader */ + mts rslr, r0 + addi r8, r0, 0xFFFFFFF + mts rshr, r8 /* * According to Xilinx, msrclr instruction behaves like 'mfs rX,rpc' * if the msrclr instruction is not enabled. We use this to detect From 52ade599e3440d188c20e57c3e34934784f9cb52 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 19 Nov 2013 16:20:34 +0100 Subject: [PATCH 12/14] microblaze: Fix compilation error for BS=0 This bug was introduced by: "microblaze: Do not used hardcoded value in exception handler" (sha1: 9f78d3b5ab97a22a7e836312c495804ee4bca4ab) System without barrel shifter are pretty rare that's why this bug has been fixed so late. Signed-off-by: Michal Simek --- arch/microblaze/kernel/hw_exception_handler.S | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S index fc6b89f4dd31..0b11a4469deb 100644 --- a/arch/microblaze/kernel/hw_exception_handler.S +++ b/arch/microblaze/kernel/hw_exception_handler.S @@ -147,15 +147,14 @@ or r3, r0, NUM_TO_REG (regnum); /* Shift right instruction depending on available configuration */ - #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0 - #define BSRLI(rD, rA, imm) \ - bsrli rD, rA, imm - #else - #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA) + #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL == 0 /* Only the used shift constants defined here - add more if needed */ #define BSRLI2(rD, rA) \ srl rD, rA; /* << 1 */ \ srl rD, rD; /* << 2 */ + #define BSRLI4(rD, rA) \ + BSRLI2(rD, rA); \ + BSRLI2(rD, rD) #define BSRLI10(rD, rA) \ srl rD, rA; /* << 1 */ \ srl rD, rD; /* << 2 */ \ @@ -170,7 +169,33 @@ #define BSRLI20(rD, rA) \ BSRLI10(rD, rA); \ BSRLI10(rD, rD) + + .macro bsrli, rD, rA, IMM + .if (\IMM) == 2 + BSRLI2(\rD, \rA) + .elseif (\IMM) == 10 + BSRLI10(\rD, \rA) + .elseif (\IMM) == 12 + BSRLI2(\rD, \rA) + BSRLI10(\rD, \rD) + .elseif (\IMM) == 14 + BSRLI4(\rD, \rA) + BSRLI10(\rD, \rD) + .elseif (\IMM) == 20 + BSRLI20(\rD, \rA) + .elseif (\IMM) == 24 + BSRLI4(\rD, \rA) + BSRLI20(\rD, \rD) + .elseif (\IMM) == 28 + BSRLI4(\rD, \rA) + BSRLI4(\rD, \rD) + BSRLI20(\rD, \rD) + .else + .error "BSRLI shift macros \IMM" + .endif + .endm #endif + #endif /* CONFIG_MMU */ .extern other_exception_handler /* Defined in exception.c */ @@ -604,7 +629,7 @@ ex_handler_done: ex4: tophys(r4,r4) /* Create L1 (pgdir/pmd) address */ - BSRLI(r5,r3, PGDIR_SHIFT - 2) + bsrli r5, r3, PGDIR_SHIFT - 2 andi r5, r5, PAGE_SIZE - 4 /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ or r4, r4, r5 @@ -613,7 +638,7 @@ ex_handler_done: beqi r5, ex2 /* Bail if no table */ tophys(r5,r5) - BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ + bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ andi r6, r6, PAGE_SIZE - 4 or r5, r5, r6 lwi r4, r5, 0 /* Get Linux PTE */ @@ -705,7 +730,7 @@ ex_handler_done: ex6: tophys(r4,r4) /* Create L1 (pgdir/pmd) address */ - BSRLI(r5,r3, PGDIR_SHIFT - 2) + bsrli r5, r3, PGDIR_SHIFT - 2 andi r5, r5, PAGE_SIZE - 4 /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ or r4, r4, r5 @@ -714,7 +739,7 @@ ex_handler_done: beqi r5, ex7 /* Bail if no table */ tophys(r5,r5) - BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ + bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ andi r6, r6, PAGE_SIZE - 4 or r5, r5, r6 lwi r4, r5, 0 /* Get Linux PTE */ @@ -776,7 +801,7 @@ ex_handler_done: ex9: tophys(r4,r4) /* Create L1 (pgdir/pmd) address */ - BSRLI(r5,r3, PGDIR_SHIFT - 2) + bsrli r5, r3, PGDIR_SHIFT - 2 andi r5, r5, PAGE_SIZE - 4 /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ or r4, r4, r5 @@ -785,7 +810,7 @@ ex_handler_done: beqi r5, ex10 /* Bail if no table */ tophys(r5,r5) - BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ + bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ andi r6, r6, PAGE_SIZE - 4 or r5, r5, r6 lwi r4, r5, 0 /* Get Linux PTE */ @@ -922,7 +947,7 @@ ex_handler_done: .ent _unaligned_data_exception _unaligned_data_exception: andi r8, r3, 0x3E0; /* Mask and extract the register operand */ - BSRLI(r8,r8,2); /* r8 >> 2 = register operand * 8 */ + bsrli r8, r8, 2; /* r8 >> 2 = register operand * 8 */ andi r6, r3, 0x400; /* Extract ESR[S] */ bneid r6, ex_sw_vm; andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */ From eae38104b2e56256930a65f0da45af98ee809f5a Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 19 Nov 2013 14:27:33 +0100 Subject: [PATCH 13/14] microblaze: Fix missing bracket in printk The error was introduced by the patch "microblaze: Fix coding style issues" (sha1: 6bd55f0bbaebb79b39e147aa864401fd0c94db82). Error message: arch/microblaze/kernel/setup.c: In function 'machine_early_init': arch/microblaze/kernel/setup.c:177:3: error: 'pr_cont' undeclared (first use in this function) arch/microblaze/kernel/setup.c:177:3: note: each undeclared identifier is reported only once for each function it appears in arch/microblaze/kernel/setup.c:177:10: error: expected ';' before string constant arch/microblaze/kernel/setup.c:177:33: error: expected statement before ')' token Signed-off-by: Michal Simek --- arch/microblaze/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 9d972d2bd924..67cc4b282cc1 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c @@ -175,7 +175,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram, #else if (!msr) { pr_info("!!!Your kernel not setup MSR instruction but "); - pr_cont"CPU have it %x\n", msr); + pr_cont("CPU have it %x\n", msr); } #endif From c0d68cea2db34a510f4d67b90aab1c48bc47461e Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 22 Nov 2013 09:01:10 +0100 Subject: [PATCH 14/14] microblaze: Add missing v8.50.a version Add PVR value for MB 8.50.a. Signed-off-by: Michal Simek --- arch/microblaze/kernel/cpu/cpuinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c index ce1cfed731ea..234acad79b9e 100644 --- a/arch/microblaze/kernel/cpu/cpuinfo.c +++ b/arch/microblaze/kernel/cpu/cpuinfo.c @@ -40,6 +40,7 @@ const struct cpu_ver_key cpu_ver_lookup[] = { {"8.30.a", 0x17}, {"8.40.a", 0x18}, {"8.40.b", 0x19}, + {"8.50.a", 0x1a}, {"9.0", 0x1b}, {"9.1", 0x1d}, {NULL, 0},