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