Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'microblaze-3.14-rc1' of git://git.monstr.eu/linux-2.6-microblaze

Pull microblaze patches from Michal Simek:
- add CCF support
- fix BS=0 compilation
- wire up defconfig
- some minor cleanups and fixes

* tag 'microblaze-3.14-rc1' of git://git.monstr.eu/linux-2.6-microblaze:
microblaze: Add missing v8.50.a version
microblaze: Fix missing bracket in printk
microblaze: Fix compilation error for BS=0
microblaze: Disable stack protection from bootloader
microblaze: Define read/write{b,w,l}_relaxed MMIO
microblaze: timer: Do not initialized system timer twice
microblaze: timer: Use generic sched_clock implementation
microblaze: Add NOTES section to linker script
microblaze: Add support for CCF
microblaze: Simplify fcpu helper function
microblaze/uapi: Use Kbuild logic to include <asm-generic/types.h>
microblaze: Remove duplicate declarations of _stext[] and _etext[]
microblaze: Remove _fdt_start casts
microblaze: Wire up defconfig to mmu_defconfig

+118 -52
+2
arch/microblaze/Kconfig
··· 26 26 select GENERIC_CPU_DEVICES 27 27 select GENERIC_ATOMIC64 28 28 select GENERIC_CLOCKEVENTS 29 + select COMMON_CLK 30 + select GENERIC_SCHED_CLOCK 29 31 select GENERIC_IDLE_POLL_SETUP 30 32 select MODULES_USE_ELF_RELA 31 33 select CLONE_BACKWARDS3
+2
arch/microblaze/Makefile
··· 1 + KBUILD_DEFCONFIG := mmu_defconfig 2 + 1 3 ifeq ($(CONFIG_MMU),y) 2 4 UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" 3 5 else
+6 -3
arch/microblaze/include/asm/cpuinfo.h
··· 91 91 92 92 /* fwd declarations of the various CPUinfo populators */ 93 93 void setup_cpuinfo(void); 94 + void setup_cpuinfo_clk(void); 94 95 95 96 void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu); 96 97 void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu); 97 98 98 99 static inline unsigned int fcpu(struct device_node *cpu, char *n) 99 100 { 100 - const __be32 *val; 101 - return (val = of_get_property(cpu, n, NULL)) ? 102 - be32_to_cpup(val) : 0; 101 + u32 val = 0; 102 + 103 + of_property_read_u32(cpu, n, &val); 104 + 105 + return val; 103 106 } 104 107 105 108 #endif /* _ASM_MICROBLAZE_CPUINFO_H */
+8
arch/microblaze/include/asm/io.h
··· 342 342 #define iowrite32_rep(p, src, count) \ 343 343 outsl((unsigned long) (p), (src), (count)) 344 344 345 + #define readb_relaxed readb 346 + #define readw_relaxed readw 347 + #define readl_relaxed readl 348 + 349 + #define writeb_relaxed writeb 350 + #define writew_relaxed writew 351 + #define writel_relaxed writel 352 + 345 353 #endif /* _ASM_MICROBLAZE_IO_H */
-1
arch/microblaze/include/asm/sections.h
··· 16 16 # ifndef __ASSEMBLY__ 17 17 extern char _ssbss[], _esbss[]; 18 18 extern unsigned long __ivt_start[], __ivt_end[]; 19 - extern char _etext[], _stext[]; 20 19 21 20 extern u32 _fdt_start[], _fdt_end[]; 22 21
+2 -1
arch/microblaze/include/uapi/asm/Kbuild
··· 1 1 # UAPI Header export list 2 2 include include/uapi/asm-generic/Kbuild.asm 3 3 4 + generic-y += types.h 5 + 4 6 header-y += auxvec.h 5 7 header-y += bitsperlong.h 6 8 header-y += byteorder.h ··· 33 31 header-y += swab.h 34 32 header-y += termbits.h 35 33 header-y += termios.h 36 - header-y += types.h 37 34 header-y += unistd.h
-1
arch/microblaze/include/uapi/asm/types.h
··· 1 - #include <asm-generic/types.h>
-3
arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
··· 112 112 CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK); 113 113 114 114 CI(fpga_family_code, TARGET_FAMILY); 115 - 116 - /* take timebase-frequency from DTS */ 117 - ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency"); 118 115 }
-2
arch/microblaze/kernel/cpu/cpuinfo-static.c
··· 113 113 ci->num_rd_brk = fcpu(cpu, "xlnx,number-of-rd-addr-brk"); 114 114 ci->num_wr_brk = fcpu(cpu, "xlnx,number-of-wr-addr-brk"); 115 115 116 - ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency"); 117 - 118 116 ci->pvr_user1 = fcpu(cpu, "xlnx,pvr-user1"); 119 117 ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2"); 120 118
+22 -2
arch/microblaze/kernel/cpu/cpuinfo.c
··· 8 8 * for more details. 9 9 */ 10 10 11 + #include <linux/clk.h> 11 12 #include <linux/init.h> 12 13 #include <asm/cpuinfo.h> 13 14 #include <asm/pvr.h> ··· 40 39 {"8.30.a", 0x17}, 41 40 {"8.40.a", 0x18}, 42 41 {"8.40.b", 0x19}, 42 + {"8.50.a", 0x1a}, 43 43 {"9.0", 0x1b}, 44 44 {"9.1", 0x1d}, 45 45 {NULL, 0}, ··· 70 68 }; 71 69 72 70 struct cpuinfo cpuinfo; 71 + static struct device_node *cpu; 73 72 74 73 void __init setup_cpuinfo(void) 75 74 { 76 - struct device_node *cpu = NULL; 77 - 78 75 cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu"); 79 76 if (!cpu) 80 77 pr_err("You don't have cpu!!!\n"); ··· 102 101 if (cpuinfo.mmu_privins) 103 102 pr_warn("%s: Stream instructions enabled" 104 103 " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__); 104 + } 105 + 106 + void __init setup_cpuinfo_clk(void) 107 + { 108 + struct clk *clk; 109 + 110 + clk = of_clk_get(cpu, 0); 111 + if (IS_ERR(clk)) { 112 + pr_err("ERROR: CPU CCF input clock not found\n"); 113 + /* take timebase-frequency from DTS */ 114 + cpuinfo.cpu_clock_freq = fcpu(cpu, "timebase-frequency"); 115 + } else { 116 + cpuinfo.cpu_clock_freq = clk_get_rate(clk); 117 + } 118 + 119 + if (!cpuinfo.cpu_clock_freq) { 120 + pr_err("ERROR: CPU clock frequency not setup\n"); 121 + BUG(); 122 + } 105 123 }
+4
arch/microblaze/kernel/head.S
··· 64 64 #endif 65 65 66 66 mts rmsr, r0 67 + /* Disable stack protection from bootloader */ 68 + mts rslr, r0 69 + addi r8, r0, 0xFFFFFFF 70 + mts rshr, r8 67 71 /* 68 72 * According to Xilinx, msrclr instruction behaves like 'mfs rX,rpc' 69 73 * if the msrclr instruction is not enabled. We use this to detect
+37 -12
arch/microblaze/kernel/hw_exception_handler.S
··· 147 147 or r3, r0, NUM_TO_REG (regnum); 148 148 149 149 /* Shift right instruction depending on available configuration */ 150 - #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0 151 - #define BSRLI(rD, rA, imm) \ 152 - bsrli rD, rA, imm 153 - #else 154 - #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA) 150 + #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL == 0 155 151 /* Only the used shift constants defined here - add more if needed */ 156 152 #define BSRLI2(rD, rA) \ 157 153 srl rD, rA; /* << 1 */ \ 158 154 srl rD, rD; /* << 2 */ 155 + #define BSRLI4(rD, rA) \ 156 + BSRLI2(rD, rA); \ 157 + BSRLI2(rD, rD) 159 158 #define BSRLI10(rD, rA) \ 160 159 srl rD, rA; /* << 1 */ \ 161 160 srl rD, rD; /* << 2 */ \ ··· 169 170 #define BSRLI20(rD, rA) \ 170 171 BSRLI10(rD, rA); \ 171 172 BSRLI10(rD, rD) 173 + 174 + .macro bsrli, rD, rA, IMM 175 + .if (\IMM) == 2 176 + BSRLI2(\rD, \rA) 177 + .elseif (\IMM) == 10 178 + BSRLI10(\rD, \rA) 179 + .elseif (\IMM) == 12 180 + BSRLI2(\rD, \rA) 181 + BSRLI10(\rD, \rD) 182 + .elseif (\IMM) == 14 183 + BSRLI4(\rD, \rA) 184 + BSRLI10(\rD, \rD) 185 + .elseif (\IMM) == 20 186 + BSRLI20(\rD, \rA) 187 + .elseif (\IMM) == 24 188 + BSRLI4(\rD, \rA) 189 + BSRLI20(\rD, \rD) 190 + .elseif (\IMM) == 28 191 + BSRLI4(\rD, \rA) 192 + BSRLI4(\rD, \rD) 193 + BSRLI20(\rD, \rD) 194 + .else 195 + .error "BSRLI shift macros \IMM" 196 + .endif 197 + .endm 172 198 #endif 199 + 173 200 #endif /* CONFIG_MMU */ 174 201 175 202 .extern other_exception_handler /* Defined in exception.c */ ··· 629 604 ex4: 630 605 tophys(r4,r4) 631 606 /* Create L1 (pgdir/pmd) address */ 632 - BSRLI(r5,r3, PGDIR_SHIFT - 2) 607 + bsrli r5, r3, PGDIR_SHIFT - 2 633 608 andi r5, r5, PAGE_SIZE - 4 634 609 /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 635 610 or r4, r4, r5 ··· 638 613 beqi r5, ex2 /* Bail if no table */ 639 614 640 615 tophys(r5,r5) 641 - BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ 616 + bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ 642 617 andi r6, r6, PAGE_SIZE - 4 643 618 or r5, r5, r6 644 619 lwi r4, r5, 0 /* Get Linux PTE */ ··· 730 705 ex6: 731 706 tophys(r4,r4) 732 707 /* Create L1 (pgdir/pmd) address */ 733 - BSRLI(r5,r3, PGDIR_SHIFT - 2) 708 + bsrli r5, r3, PGDIR_SHIFT - 2 734 709 andi r5, r5, PAGE_SIZE - 4 735 710 /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 736 711 or r4, r4, r5 ··· 739 714 beqi r5, ex7 /* Bail if no table */ 740 715 741 716 tophys(r5,r5) 742 - BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ 717 + bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ 743 718 andi r6, r6, PAGE_SIZE - 4 744 719 or r5, r5, r6 745 720 lwi r4, r5, 0 /* Get Linux PTE */ ··· 801 776 ex9: 802 777 tophys(r4,r4) 803 778 /* Create L1 (pgdir/pmd) address */ 804 - BSRLI(r5,r3, PGDIR_SHIFT - 2) 779 + bsrli r5, r3, PGDIR_SHIFT - 2 805 780 andi r5, r5, PAGE_SIZE - 4 806 781 /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 807 782 or r4, r4, r5 ··· 810 785 beqi r5, ex10 /* Bail if no table */ 811 786 812 787 tophys(r5,r5) 813 - BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ 788 + bsrli r6, r3, PTE_SHIFT /* Compute PTE address */ 814 789 andi r6, r6, PAGE_SIZE - 4 815 790 or r5, r5, r6 816 791 lwi r4, r5, 0 /* Get Linux PTE */ ··· 947 922 .ent _unaligned_data_exception 948 923 _unaligned_data_exception: 949 924 andi r8, r3, 0x3E0; /* Mask and extract the register operand */ 950 - BSRLI(r8,r8,2); /* r8 >> 2 = register operand * 8 */ 925 + bsrli r8, r8, 2; /* r8 >> 2 = register operand * 8 */ 951 926 andi r6, r3, 0x400; /* Extract ESR[S] */ 952 927 bneid r6, ex_sw_vm; 953 928 andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */
+6 -4
arch/microblaze/kernel/setup.c
··· 9 9 */ 10 10 11 11 #include <linux/init.h> 12 + #include <linux/clk-provider.h> 12 13 #include <linux/clocksource.h> 13 14 #include <linux/string.h> 14 15 #include <linux/seq_file.h> ··· 137 136 lockdep_init(); 138 137 139 138 /* initialize device tree for usage in early_printk */ 140 - early_init_devtree((void *)_fdt_start); 139 + early_init_devtree(_fdt_start); 141 140 142 141 #ifdef CONFIG_EARLY_PRINTK 143 142 setup_early_printk(NULL); ··· 153 152 if (fdt) 154 153 pr_info("FDT at 0x%08x\n", fdt); 155 154 else 156 - pr_info("Compiled-in FDT at 0x%08x\n", 157 - (unsigned int)_fdt_start); 155 + pr_info("Compiled-in FDT at %p\n", _fdt_start); 158 156 159 157 #ifdef CONFIG_MTD_UCLINUX 160 158 pr_info("Found romfs @ 0x%08x (0x%08x)\n", ··· 175 175 #else 176 176 if (!msr) { 177 177 pr_info("!!!Your kernel not setup MSR instruction but "); 178 - pr_cont"CPU have it %x\n", msr); 178 + pr_cont("CPU have it %x\n", msr); 179 179 } 180 180 #endif 181 181 ··· 196 196 197 197 void __init time_init(void) 198 198 { 199 + of_clk_init(NULL); 200 + setup_cpuinfo_clk(); 199 201 clocksource_of_init(); 200 202 } 201 203
+28 -23
arch/microblaze/kernel/timer.c
··· 12 12 #include <linux/interrupt.h> 13 13 #include <linux/delay.h> 14 14 #include <linux/sched.h> 15 + #include <linux/sched_clock.h> 15 16 #include <linux/clk.h> 16 17 #include <linux/clockchips.h> 17 18 #include <linux/of_address.h> 18 19 #include <linux/of_irq.h> 19 20 #include <asm/cpuinfo.h> 20 - #include <linux/cnt32_to_63.h> 21 21 22 22 static void __iomem *timer_baseaddr; 23 23 ··· 167 167 clockevents_register_device(&clockevent_xilinx_timer); 168 168 } 169 169 170 + static u64 xilinx_clock_read(void) 171 + { 172 + return in_be32(timer_baseaddr + TCR1); 173 + } 174 + 170 175 static cycle_t xilinx_read(struct clocksource *cs) 171 176 { 172 177 /* reading actual value of timer 1 */ 173 - return (cycle_t) (in_be32(timer_baseaddr + TCR1)); 178 + return (cycle_t)xilinx_clock_read(); 174 179 } 175 180 176 181 static struct timecounter xilinx_tc = { ··· 227 222 return 0; 228 223 } 229 224 230 - /* 231 - * We have to protect accesses before timer initialization 232 - * and return 0 for sched_clock function below. 233 - */ 234 - static int timer_initialized; 235 - 236 225 static void __init xilinx_timer_init(struct device_node *timer) 237 226 { 227 + struct clk *clk; 228 + static int initialized; 238 229 u32 irq; 239 230 u32 timer_num = 1; 240 - int ret; 231 + 232 + if (initialized) 233 + return; 234 + 235 + initialized = 1; 241 236 242 237 timer_baseaddr = of_iomap(timer, 0); 243 238 if (!timer_baseaddr) { ··· 255 250 256 251 pr_info("%s: irq=%d\n", timer->full_name, irq); 257 252 258 - /* If there is clock-frequency property than use it */ 259 - ret = of_property_read_u32(timer, "clock-frequency", &timer_clock_freq); 260 - if (ret < 0) 253 + clk = of_clk_get(timer, 0); 254 + if (IS_ERR(clk)) { 255 + pr_err("ERROR: timer CCF input clock not found\n"); 256 + /* If there is clock-frequency property than use it */ 257 + of_property_read_u32(timer, "clock-frequency", 258 + &timer_clock_freq); 259 + } else { 260 + timer_clock_freq = clk_get_rate(clk); 261 + } 262 + 263 + if (!timer_clock_freq) { 264 + pr_err("ERROR: Using CPU clock frequency\n"); 261 265 timer_clock_freq = cpuinfo.cpu_clock_freq; 266 + } 262 267 263 268 freq_div_hz = timer_clock_freq / HZ; 264 269 ··· 278 263 #endif 279 264 xilinx_clocksource_init(); 280 265 xilinx_clockevent_init(); 281 - timer_initialized = 1; 282 - } 283 266 284 - unsigned long long notrace sched_clock(void) 285 - { 286 - if (timer_initialized) { 287 - struct clocksource *cs = &clocksource_microblaze; 288 - 289 - cycle_t cyc = cnt32_to_63(cs->read(NULL)) & LLONG_MAX; 290 - return clocksource_cyc2ns(cyc, cs->mult, cs->shift); 291 - } 292 - return 0; 267 + sched_clock_register(xilinx_clock_read, 32, timer_clock_freq); 293 268 } 294 269 295 270 CLOCKSOURCE_OF_DECLARE(xilinx_timer, "xlnx,xps-timer-1.00.a",
+1
arch/microblaze/kernel/vmlinux.lds.S
··· 51 51 . = ALIGN(16); 52 52 RODATA 53 53 EXCEPTION_TABLE(16) 54 + NOTES 54 55 55 56 /* 56 57 * sdata2 section can go anywhere, but must be word aligned