aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-27 12:24:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-27 12:24:20 -0400
commit9ed3689bdceb0064ee6faf0e76f6467122794970 (patch)
tree059fbf494ac721faaefef1dd6e0131e9e576f6fb /arch
parent8aae36cdf12313cd9cc0e4799fe1ea64d3c623f3 (diff)
parent363922946f96ad1d6420107ebcfa9a95b659fe75 (diff)
Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
* 'next' of git://git.monstr.eu/linux-2.6-microblaze: microblaze: Do not show error message for 32 interrupt lines Revert "microblaze: PCI fix typo fault in of_node pointer moving into pci_bus" microblaze: PCI fix typo fault in of_node pointer moving into pci_bus microblaze: Add support for early console on mdm microblaze: Simplify early console binding from DT microblaze: Get early printk console earlier microblaze: Standardise cpuinfo output for cache policy microblaze: Unprivileged stream instruction awareness microblaze: trivial: Fix typo fault microblaze: exec: Remove redundant set_fs(USER_DS) microblaze: Remove duplicated prototype of start_thread() microblaze: Fix unaligned value saving to the stack for system with MMU microblaze/irqs: Do not trace arch_local_{*,irq_*} functions
Diffstat (limited to 'arch')
-rw-r--r--arch/microblaze/include/asm/cpuinfo.h1
-rw-r--r--arch/microblaze/include/asm/irqflags.h20
-rw-r--r--arch/microblaze/include/asm/processor.h3
-rw-r--r--arch/microblaze/include/asm/prom.h8
-rw-r--r--arch/microblaze/include/asm/pvr.h5
-rw-r--r--arch/microblaze/include/asm/setup.h1
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c1
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-static.c1
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo.c4
-rw-r--r--arch/microblaze/kernel/cpu/mb.c9
-rw-r--r--arch/microblaze/kernel/early_printk.c68
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S56
-rw-r--r--arch/microblaze/kernel/intc.c2
-rw-r--r--arch/microblaze/kernel/process.c1
-rw-r--r--arch/microblaze/kernel/prom.c97
-rw-r--r--arch/microblaze/kernel/setup.c5
16 files changed, 149 insertions, 133 deletions
diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h
index d8f013347a9e..7d6831ac8a46 100644
--- a/arch/microblaze/include/asm/cpuinfo.h
+++ b/arch/microblaze/include/asm/cpuinfo.h
@@ -38,6 +38,7 @@ struct cpuinfo {
38 u32 use_exc; 38 u32 use_exc;
39 u32 ver_code; 39 u32 ver_code;
40 u32 mmu; 40 u32 mmu;
41 u32 mmu_privins;
41 u32 endian; 42 u32 endian;
42 43
43 /* CPU caches */ 44 /* CPU caches */
diff --git a/arch/microblaze/include/asm/irqflags.h b/arch/microblaze/include/asm/irqflags.h
index c4532f032b3b..c9a6262832c4 100644
--- a/arch/microblaze/include/asm/irqflags.h
+++ b/arch/microblaze/include/asm/irqflags.h
@@ -14,7 +14,7 @@
14 14
15#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 15#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
16 16
17static inline unsigned long arch_local_irq_save(void) 17static inline notrace unsigned long arch_local_irq_save(void)
18{ 18{
19 unsigned long flags; 19 unsigned long flags;
20 asm volatile(" msrclr %0, %1 \n" 20 asm volatile(" msrclr %0, %1 \n"
@@ -25,7 +25,7 @@ static inline unsigned long arch_local_irq_save(void)
25 return flags; 25 return flags;
26} 26}
27 27
28static inline void arch_local_irq_disable(void) 28static inline notrace void arch_local_irq_disable(void)
29{ 29{
30 /* this uses r0 without declaring it - is that correct? */ 30 /* this uses r0 without declaring it - is that correct? */
31 asm volatile(" msrclr r0, %0 \n" 31 asm volatile(" msrclr r0, %0 \n"
@@ -35,7 +35,7 @@ static inline void arch_local_irq_disable(void)
35 : "memory"); 35 : "memory");
36} 36}
37 37
38static inline void arch_local_irq_enable(void) 38static inline notrace void arch_local_irq_enable(void)
39{ 39{
40 /* this uses r0 without declaring it - is that correct? */ 40 /* this uses r0 without declaring it - is that correct? */
41 asm volatile(" msrset r0, %0 \n" 41 asm volatile(" msrset r0, %0 \n"
@@ -47,7 +47,7 @@ static inline void arch_local_irq_enable(void)
47 47
48#else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ 48#else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
49 49
50static inline unsigned long arch_local_irq_save(void) 50static inline notrace unsigned long arch_local_irq_save(void)
51{ 51{
52 unsigned long flags, tmp; 52 unsigned long flags, tmp;
53 asm volatile (" mfs %0, rmsr \n" 53 asm volatile (" mfs %0, rmsr \n"
@@ -61,7 +61,7 @@ static inline unsigned long arch_local_irq_save(void)
61 return flags; 61 return flags;
62} 62}
63 63
64static inline void arch_local_irq_disable(void) 64static inline notrace void arch_local_irq_disable(void)
65{ 65{
66 unsigned long tmp; 66 unsigned long tmp;
67 asm volatile(" mfs %0, rmsr \n" 67 asm volatile(" mfs %0, rmsr \n"
@@ -74,7 +74,7 @@ static inline void arch_local_irq_disable(void)
74 : "memory"); 74 : "memory");
75} 75}
76 76
77static inline void arch_local_irq_enable(void) 77static inline notrace void arch_local_irq_enable(void)
78{ 78{
79 unsigned long tmp; 79 unsigned long tmp;
80 asm volatile(" mfs %0, rmsr \n" 80 asm volatile(" mfs %0, rmsr \n"
@@ -89,7 +89,7 @@ static inline void arch_local_irq_enable(void)
89 89
90#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ 90#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
91 91
92static inline unsigned long arch_local_save_flags(void) 92static inline notrace unsigned long arch_local_save_flags(void)
93{ 93{
94 unsigned long flags; 94 unsigned long flags;
95 asm volatile(" mfs %0, rmsr \n" 95 asm volatile(" mfs %0, rmsr \n"
@@ -100,7 +100,7 @@ static inline unsigned long arch_local_save_flags(void)
100 return flags; 100 return flags;
101} 101}
102 102
103static inline void arch_local_irq_restore(unsigned long flags) 103static inline notrace void arch_local_irq_restore(unsigned long flags)
104{ 104{
105 asm volatile(" mts rmsr, %0 \n" 105 asm volatile(" mts rmsr, %0 \n"
106 " nop \n" 106 " nop \n"
@@ -109,12 +109,12 @@ static inline void arch_local_irq_restore(unsigned long flags)
109 : "memory"); 109 : "memory");
110} 110}
111 111
112static inline bool arch_irqs_disabled_flags(unsigned long flags) 112static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
113{ 113{
114 return (flags & MSR_IE) == 0; 114 return (flags & MSR_IE) == 0;
115} 115}
116 116
117static inline bool arch_irqs_disabled(void) 117static inline notrace bool arch_irqs_disabled(void)
118{ 118{
119 return arch_irqs_disabled_flags(arch_local_save_flags()); 119 return arch_irqs_disabled_flags(arch_local_save_flags());
120} 120}
diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h
index aed2a6be8e27..7283bfb2f7e4 100644
--- a/arch/microblaze/include/asm/processor.h
+++ b/arch/microblaze/include/asm/processor.h
@@ -125,9 +125,6 @@ struct thread_struct {
125 .pgdir = swapper_pg_dir, \ 125 .pgdir = swapper_pg_dir, \
126} 126}
127 127
128/* Do necessary setup to start up a newly executed thread. */
129void start_thread(struct pt_regs *regs,
130 unsigned long pc, unsigned long usp);
131 128
132/* Free all resources held by a thread. */ 129/* Free all resources held by a thread. */
133extern inline void release_thread(struct task_struct *dead_task) 130extern inline void release_thread(struct task_struct *dead_task)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 9ad567e2d425..20c5e8e5121b 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -26,8 +26,12 @@
26#define HAVE_ARCH_DEVTREE_FIXUPS 26#define HAVE_ARCH_DEVTREE_FIXUPS
27 27
28/* Other Prototypes */ 28/* Other Prototypes */
29extern int early_uartlite_console(void); 29enum early_consoles {
30extern int early_uart16550_console(void); 30 UARTLITE = 1,
31 UART16550 = 2,
32};
33
34extern int of_early_console(void *version);
31 35
32/* 36/*
33 * OF address retreival & translation 37 * OF address retreival & translation
diff --git a/arch/microblaze/include/asm/pvr.h b/arch/microblaze/include/asm/pvr.h
index a10bec62e857..4bbdb4c03b57 100644
--- a/arch/microblaze/include/asm/pvr.h
+++ b/arch/microblaze/include/asm/pvr.h
@@ -111,16 +111,16 @@ struct pvr_s {
111/* Target family PVR mask */ 111/* Target family PVR mask */
112#define PVR10_TARGET_FAMILY_MASK 0xFF000000 112#define PVR10_TARGET_FAMILY_MASK 0xFF000000
113 113
114/* MMU descrtiption */ 114/* MMU description */
115#define PVR11_USE_MMU 0xC0000000 115#define PVR11_USE_MMU 0xC0000000
116#define PVR11_MMU_ITLB_SIZE 0x38000000 116#define PVR11_MMU_ITLB_SIZE 0x38000000
117#define PVR11_MMU_DTLB_SIZE 0x07000000 117#define PVR11_MMU_DTLB_SIZE 0x07000000
118#define PVR11_MMU_TLB_ACCESS 0x00C00000 118#define PVR11_MMU_TLB_ACCESS 0x00C00000
119#define PVR11_MMU_ZONES 0x003C0000 119#define PVR11_MMU_ZONES 0x003C0000
120#define PVR11_MMU_PRIVINS 0x00010000
120/* MSR Reset value PVR mask */ 121/* MSR Reset value PVR mask */
121#define PVR11_MSR_RESET_VALUE_MASK 0x000007FF 122#define PVR11_MSR_RESET_VALUE_MASK 0x000007FF
122 123
123
124/* PVR access macros */ 124/* PVR access macros */
125#define PVR_IS_FULL(_pvr) (_pvr.pvr[0] & PVR0_PVR_FULL_MASK) 125#define PVR_IS_FULL(_pvr) (_pvr.pvr[0] & PVR0_PVR_FULL_MASK)
126#define PVR_USE_BARREL(_pvr) (_pvr.pvr[0] & PVR0_USE_BARREL_MASK) 126#define PVR_USE_BARREL(_pvr) (_pvr.pvr[0] & PVR0_USE_BARREL_MASK)
@@ -216,6 +216,7 @@ struct pvr_s {
216#define PVR_MMU_DTLB_SIZE(_pvr) (_pvr.pvr[11] & PVR11_MMU_DTLB_SIZE) 216#define PVR_MMU_DTLB_SIZE(_pvr) (_pvr.pvr[11] & PVR11_MMU_DTLB_SIZE)
217#define PVR_MMU_TLB_ACCESS(_pvr) (_pvr.pvr[11] & PVR11_MMU_TLB_ACCESS) 217#define PVR_MMU_TLB_ACCESS(_pvr) (_pvr.pvr[11] & PVR11_MMU_TLB_ACCESS)
218#define PVR_MMU_ZONES(_pvr) (_pvr.pvr[11] & PVR11_MMU_ZONES) 218#define PVR_MMU_ZONES(_pvr) (_pvr.pvr[11] & PVR11_MMU_ZONES)
219#define PVR_MMU_PRIVINS(pvr) (pvr.pvr[11] & PVR11_MMU_PRIVINS)
219 220
220/* endian */ 221/* endian */
221#define PVR_ENDIAN(_pvr) (_pvr.pvr[0] & PVR0_ENDI) 222#define PVR_ENDIAN(_pvr) (_pvr.pvr[0] & PVR0_ENDI)
diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
index 8f3968971e4e..904e5ef6a11b 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -23,6 +23,7 @@ extern char cmd_line[COMMAND_LINE_SIZE];
23void early_printk(const char *fmt, ...); 23void early_printk(const char *fmt, ...);
24 24
25int setup_early_printk(char *opt); 25int setup_early_printk(char *opt);
26void remap_early_printk(void);
26void disable_early_printk(void); 27void disable_early_printk(void);
27 28
28#if defined(CONFIG_EARLY_PRINTK) 29#if defined(CONFIG_EARLY_PRINTK)
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
index f70a6047f08e..916aaedf1945 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
@@ -72,6 +72,7 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
72 CI(pvr_user2, USER2); 72 CI(pvr_user2, USER2);
73 73
74 CI(mmu, USE_MMU); 74 CI(mmu, USE_MMU);
75 CI(mmu_privins, MMU_PRIVINS);
75 CI(endian, ENDIAN); 76 CI(endian, ENDIAN);
76 77
77 CI(use_icache, USE_ICACHE); 78 CI(use_icache, USE_ICACHE);
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
index b16b994ca3d2..592bb2e838c4 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-static.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
@@ -119,6 +119,7 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
119 ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2"); 119 ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2");
120 120
121 ci->mmu = fcpu(cpu, "xlnx,use-mmu"); 121 ci->mmu = fcpu(cpu, "xlnx,use-mmu");
122 ci->mmu_privins = fcpu(cpu, "xlnx,mmu-privileged-instr");
122 ci->endian = fcpu(cpu, "xlnx,endianness"); 123 ci->endian = fcpu(cpu, "xlnx,endianness");
123 124
124 ci->ver_code = 0; 125 ci->ver_code = 0;
diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c
index c1640c52711f..44394d80a683 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo.c
@@ -88,4 +88,8 @@ void __init setup_cpuinfo(void)
88 printk(KERN_WARNING "%s: Unsupported PVR setting\n", __func__); 88 printk(KERN_WARNING "%s: Unsupported PVR setting\n", __func__);
89 set_cpuinfo_static(&cpuinfo, cpu); 89 set_cpuinfo_static(&cpuinfo, cpu);
90 } 90 }
91
92 if (cpuinfo.mmu_privins)
93 printk(KERN_WARNING "%s: Stream instructions enabled"
94 " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__);
91} 95}
diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
index b4048af02615..7b5dca7ed39d 100644
--- a/arch/microblaze/kernel/cpu/mb.c
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -97,6 +97,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
97 (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "", 97 (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
98 (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : ""); 98 (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
99 99
100 count += seq_printf(m,
101 "Stream-insns:\t%sprivileged\n",
102 cpuinfo.mmu_privins ? "un" : "");
103
100 if (cpuinfo.use_icache) 104 if (cpuinfo.use_icache)
101 count += seq_printf(m, 105 count += seq_printf(m,
102 "Icache:\t\t%ukB\tline length:\t%dB\n", 106 "Icache:\t\t%ukB\tline length:\t%dB\n",
@@ -110,10 +114,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
110 "Dcache:\t\t%ukB\tline length:\t%dB\n", 114 "Dcache:\t\t%ukB\tline length:\t%dB\n",
111 cpuinfo.dcache_size >> 10, 115 cpuinfo.dcache_size >> 10,
112 cpuinfo.dcache_line_length); 116 cpuinfo.dcache_line_length);
117 seq_printf(m, "Dcache-Policy:\t");
113 if (cpuinfo.dcache_wb) 118 if (cpuinfo.dcache_wb)
114 count += seq_printf(m, "\t\twrite-back\n"); 119 count += seq_printf(m, "write-back\n");
115 else 120 else
116 count += seq_printf(m, "\t\twrite-through\n"); 121 count += seq_printf(m, "write-through\n");
117 } else 122 } else
118 count += seq_printf(m, "Dcache:\t\tno\n"); 123 count += seq_printf(m, "Dcache:\t\tno\n");
119 124
diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
index c3616a080ebf..d26d92d47754 100644
--- a/arch/microblaze/kernel/early_printk.c
+++ b/arch/microblaze/kernel/early_printk.c
@@ -35,7 +35,7 @@ static void early_printk_uartlite_putc(char c)
35 * we'll never timeout on a working UART. 35 * we'll never timeout on a working UART.
36 */ 36 */
37 37
38 unsigned retries = 10000; 38 unsigned retries = 1000000;
39 /* read status bit - 0x8 offset */ 39 /* read status bit - 0x8 offset */
40 while (--retries && (in_be32(base_addr + 8) & (1 << 3))) 40 while (--retries && (in_be32(base_addr + 8) & (1 << 3)))
41 ; 41 ;
@@ -60,7 +60,7 @@ static void early_printk_uartlite_write(struct console *unused,
60static struct console early_serial_uartlite_console = { 60static struct console early_serial_uartlite_console = {
61 .name = "earlyser", 61 .name = "earlyser",
62 .write = early_printk_uartlite_write, 62 .write = early_printk_uartlite_write,
63 .flags = CON_PRINTBUFFER, 63 .flags = CON_PRINTBUFFER | CON_BOOT,
64 .index = -1, 64 .index = -1,
65}; 65};
66#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */ 66#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */
@@ -104,7 +104,7 @@ static void early_printk_uart16550_write(struct console *unused,
104static struct console early_serial_uart16550_console = { 104static struct console early_serial_uart16550_console = {
105 .name = "earlyser", 105 .name = "earlyser",
106 .write = early_printk_uart16550_write, 106 .write = early_printk_uart16550_write,
107 .flags = CON_PRINTBUFFER, 107 .flags = CON_PRINTBUFFER | CON_BOOT,
108 .index = -1, 108 .index = -1,
109}; 109};
110#endif /* CONFIG_SERIAL_8250_CONSOLE */ 110#endif /* CONFIG_SERIAL_8250_CONSOLE */
@@ -127,48 +127,56 @@ void early_printk(const char *fmt, ...)
127 127
128int __init setup_early_printk(char *opt) 128int __init setup_early_printk(char *opt)
129{ 129{
130 int version = 0;
131
130 if (early_console_initialized) 132 if (early_console_initialized)
131 return 1; 133 return 1;
132 134
133#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE 135 base_addr = of_early_console(&version);
134 base_addr = early_uartlite_console();
135 if (base_addr) { 136 if (base_addr) {
136 early_console_initialized = 1;
137#ifdef CONFIG_MMU 137#ifdef CONFIG_MMU
138 early_console_reg_tlb_alloc(base_addr); 138 early_console_reg_tlb_alloc(base_addr);
139#endif 139#endif
140 early_console = &early_serial_uartlite_console; 140 switch (version) {
141 early_printk("early_printk_console is enabled at 0x%08x\n", 141#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
142 base_addr); 142 case UARTLITE:
143 143 printk(KERN_INFO "Early console on uartlite "
144 /* register_console(early_console); */ 144 "at 0x%08x\n", base_addr);
145 145 early_console = &early_serial_uartlite_console;
146 return 0; 146 break;
147 } 147#endif
148#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */
149
150#ifdef CONFIG_SERIAL_8250_CONSOLE 148#ifdef CONFIG_SERIAL_8250_CONSOLE
151 base_addr = early_uart16550_console(); 149 case UART16550:
152 base_addr &= ~3; /* clear register offset */ 150 printk(KERN_INFO "Early console on uart16650 "
153 if (base_addr) { 151 "at 0x%08x\n", base_addr);
154 early_console_initialized = 1; 152 early_console = &early_serial_uart16550_console;
155#ifdef CONFIG_MMU 153 break;
156 early_console_reg_tlb_alloc(base_addr);
157#endif 154#endif
158 early_console = &early_serial_uart16550_console; 155 default:
159 156 printk(KERN_INFO "Unsupported early console %d\n",
160 early_printk("early_printk_console is enabled at 0x%08x\n", 157 version);
161 base_addr); 158 return 1;
162 159 }
163 /* register_console(early_console); */
164 160
161 register_console(early_console);
162 early_console_initialized = 1;
165 return 0; 163 return 0;
166 } 164 }
167#endif /* CONFIG_SERIAL_8250_CONSOLE */
168
169 return 1; 165 return 1;
170} 166}
171 167
168/* Remap early console to virtual address and do not allocate one TLB
169 * only for early console because of performance degression */
170void __init remap_early_printk(void)
171{
172 if (!early_console_initialized || !early_console)
173 return;
174 printk(KERN_INFO "early_printk_console remaping from 0x%x to ",
175 base_addr);
176 base_addr = (u32) ioremap(base_addr, PAGE_SIZE);
177 printk(KERN_CONT "0x%x\n", base_addr);
178}
179
172void __init disable_early_printk(void) 180void __init disable_early_printk(void)
173{ 181{
174 if (!early_console_initialized || !early_console) 182 if (!early_console_initialized || !early_console)
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index 56572e923a83..e62be8379604 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -1113,23 +1113,23 @@ lw_r10_vm: R3_TO_LWREG_VM_V (10);
1113lw_r11_vm: R3_TO_LWREG_VM_V (11); 1113lw_r11_vm: R3_TO_LWREG_VM_V (11);
1114lw_r12_vm: R3_TO_LWREG_VM_V (12); 1114lw_r12_vm: R3_TO_LWREG_VM_V (12);
1115lw_r13_vm: R3_TO_LWREG_VM_V (13); 1115lw_r13_vm: R3_TO_LWREG_VM_V (13);
1116lw_r14_vm: R3_TO_LWREG_VM (14); 1116lw_r14_vm: R3_TO_LWREG_VM_V (14);
1117lw_r15_vm: R3_TO_LWREG_VM_V (15); 1117lw_r15_vm: R3_TO_LWREG_VM_V (15);
1118lw_r16_vm: R3_TO_LWREG_VM (16); 1118lw_r16_vm: R3_TO_LWREG_VM_V (16);
1119lw_r17_vm: R3_TO_LWREG_VM_V (17); 1119lw_r17_vm: R3_TO_LWREG_VM_V (17);
1120lw_r18_vm: R3_TO_LWREG_VM_V (18); 1120lw_r18_vm: R3_TO_LWREG_VM_V (18);
1121lw_r19_vm: R3_TO_LWREG_VM (19); 1121lw_r19_vm: R3_TO_LWREG_VM_V (19);
1122lw_r20_vm: R3_TO_LWREG_VM (20); 1122lw_r20_vm: R3_TO_LWREG_VM_V (20);
1123lw_r21_vm: R3_TO_LWREG_VM (21); 1123lw_r21_vm: R3_TO_LWREG_VM_V (21);
1124lw_r22_vm: R3_TO_LWREG_VM (22); 1124lw_r22_vm: R3_TO_LWREG_VM_V (22);
1125lw_r23_vm: R3_TO_LWREG_VM (23); 1125lw_r23_vm: R3_TO_LWREG_VM_V (23);
1126lw_r24_vm: R3_TO_LWREG_VM (24); 1126lw_r24_vm: R3_TO_LWREG_VM_V (24);
1127lw_r25_vm: R3_TO_LWREG_VM (25); 1127lw_r25_vm: R3_TO_LWREG_VM_V (25);
1128lw_r26_vm: R3_TO_LWREG_VM (26); 1128lw_r26_vm: R3_TO_LWREG_VM_V (26);
1129lw_r27_vm: R3_TO_LWREG_VM (27); 1129lw_r27_vm: R3_TO_LWREG_VM_V (27);
1130lw_r28_vm: R3_TO_LWREG_VM (28); 1130lw_r28_vm: R3_TO_LWREG_VM_V (28);
1131lw_r29_vm: R3_TO_LWREG_VM (29); 1131lw_r29_vm: R3_TO_LWREG_VM_V (29);
1132lw_r30_vm: R3_TO_LWREG_VM (30); 1132lw_r30_vm: R3_TO_LWREG_VM_V (30);
1133lw_r31_vm: R3_TO_LWREG_VM_V (31); 1133lw_r31_vm: R3_TO_LWREG_VM_V (31);
1134 1134
1135sw_table_vm: 1135sw_table_vm:
@@ -1147,23 +1147,23 @@ sw_r10_vm: SWREG_TO_R3_VM_V (10);
1147sw_r11_vm: SWREG_TO_R3_VM_V (11); 1147sw_r11_vm: SWREG_TO_R3_VM_V (11);
1148sw_r12_vm: SWREG_TO_R3_VM_V (12); 1148sw_r12_vm: SWREG_TO_R3_VM_V (12);
1149sw_r13_vm: SWREG_TO_R3_VM_V (13); 1149sw_r13_vm: SWREG_TO_R3_VM_V (13);
1150sw_r14_vm: SWREG_TO_R3_VM (14); 1150sw_r14_vm: SWREG_TO_R3_VM_V (14);
1151sw_r15_vm: SWREG_TO_R3_VM_V (15); 1151sw_r15_vm: SWREG_TO_R3_VM_V (15);
1152sw_r16_vm: SWREG_TO_R3_VM (16); 1152sw_r16_vm: SWREG_TO_R3_VM_V (16);
1153sw_r17_vm: SWREG_TO_R3_VM_V (17); 1153sw_r17_vm: SWREG_TO_R3_VM_V (17);
1154sw_r18_vm: SWREG_TO_R3_VM_V (18); 1154sw_r18_vm: SWREG_TO_R3_VM_V (18);
1155sw_r19_vm: SWREG_TO_R3_VM (19); 1155sw_r19_vm: SWREG_TO_R3_VM_V (19);
1156sw_r20_vm: SWREG_TO_R3_VM (20); 1156sw_r20_vm: SWREG_TO_R3_VM_V (20);
1157sw_r21_vm: SWREG_TO_R3_VM (21); 1157sw_r21_vm: SWREG_TO_R3_VM_V (21);
1158sw_r22_vm: SWREG_TO_R3_VM (22); 1158sw_r22_vm: SWREG_TO_R3_VM_V (22);
1159sw_r23_vm: SWREG_TO_R3_VM (23); 1159sw_r23_vm: SWREG_TO_R3_VM_V (23);
1160sw_r24_vm: SWREG_TO_R3_VM (24); 1160sw_r24_vm: SWREG_TO_R3_VM_V (24);
1161sw_r25_vm: SWREG_TO_R3_VM (25); 1161sw_r25_vm: SWREG_TO_R3_VM_V (25);
1162sw_r26_vm: SWREG_TO_R3_VM (26); 1162sw_r26_vm: SWREG_TO_R3_VM_V (26);
1163sw_r27_vm: SWREG_TO_R3_VM (27); 1163sw_r27_vm: SWREG_TO_R3_VM_V (27);
1164sw_r28_vm: SWREG_TO_R3_VM (28); 1164sw_r28_vm: SWREG_TO_R3_VM_V (28);
1165sw_r29_vm: SWREG_TO_R3_VM (29); 1165sw_r29_vm: SWREG_TO_R3_VM_V (29);
1166sw_r30_vm: SWREG_TO_R3_VM (30); 1166sw_r30_vm: SWREG_TO_R3_VM_V (30);
1167sw_r31_vm: SWREG_TO_R3_VM_V (31); 1167sw_r31_vm: SWREG_TO_R3_VM_V (31);
1168#endif /* CONFIG_MMU */ 1168#endif /* CONFIG_MMU */
1169 1169
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
index c88f066f41bd..eb41441c7fd0 100644
--- a/arch/microblaze/kernel/intc.c
+++ b/arch/microblaze/kernel/intc.c
@@ -134,7 +134,7 @@ void __init init_IRQ(void)
134 intr_type = 134 intr_type =
135 be32_to_cpup(of_get_property(intc, 135 be32_to_cpup(of_get_property(intc,
136 "xlnx,kind-of-intr", NULL)); 136 "xlnx,kind-of-intr", NULL));
137 if (intr_type >= (1 << (nr_irq + 1))) 137 if (intr_type > (u32)((1ULL << nr_irq) - 1))
138 printk(KERN_INFO " ERROR: Mismatch in kind-of-intr param\n"); 138 printk(KERN_INFO " ERROR: Mismatch in kind-of-intr param\n");
139 139
140#ifdef CONFIG_SELFMOD_INTC 140#ifdef CONFIG_SELFMOD_INTC
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 968648a81c1e..dbb812421d8a 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -237,7 +237,6 @@ unsigned long get_wchan(struct task_struct *p)
237/* Set up a thread for executing a new program */ 237/* Set up a thread for executing a new program */
238void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp) 238void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp)
239{ 239{
240 set_fs(USER_DS);
241 regs->pc = pc; 240 regs->pc = pc;
242 regs->r1 = usp; 241 regs->r1 = usp;
243 regs->pt_mode = 0; 242 regs->pt_mode = 0;
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index b15cc219b1d9..977484add216 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -53,69 +53,58 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
53} 53}
54 54
55#ifdef CONFIG_EARLY_PRINTK 55#ifdef CONFIG_EARLY_PRINTK
56/* MS this is Microblaze specifig function */ 56char *stdout;
57static int __init early_init_dt_scan_serial(unsigned long node,
58 const char *uname, int depth, void *data)
59{
60 unsigned long l;
61 char *p;
62 const __be32 *addr;
63
64 pr_debug("search \"serial\", depth: %d, uname: %s\n", depth, uname);
65
66/* find all serial nodes */
67 if (strncmp(uname, "serial", 6) != 0)
68 return 0;
69
70/* find compatible node with uartlite */
71 p = of_get_flat_dt_prop(node, "compatible", &l);
72 if ((strncmp(p, "xlnx,xps-uartlite", 17) != 0) &&
73 (strncmp(p, "xlnx,opb-uartlite", 17) != 0) &&
74 (strncmp(p, "xlnx,axi-uartlite", 17) != 0))
75 return 0;
76
77 addr = of_get_flat_dt_prop(node, "reg", &l);
78 return be32_to_cpup(addr); /* return address */
79}
80 57
81/* this function is looking for early uartlite console - Microblaze specific */ 58int __init early_init_dt_scan_chosen_serial(unsigned long node,
82int __init early_uartlite_console(void)
83{
84 return of_scan_flat_dt(early_init_dt_scan_serial, NULL);
85}
86
87/* MS this is Microblaze specifig function */
88static int __init early_init_dt_scan_serial_full(unsigned long node,
89 const char *uname, int depth, void *data) 59 const char *uname, int depth, void *data)
90{ 60{
91 unsigned long l; 61 unsigned long l;
92 char *p; 62 char *p;
93 unsigned int addr;
94
95 pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
96
97/* find all serial nodes */
98 if (strncmp(uname, "serial", 6) != 0)
99 return 0;
100 63
101 early_init_dt_check_for_initrd(node); 64 pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);
102 65
103/* find compatible node with uartlite */ 66 if (depth == 1 && (strcmp(uname, "chosen") == 0 ||
104 p = of_get_flat_dt_prop(node, "compatible", &l); 67 strcmp(uname, "chosen@0") == 0)) {
105 68 p = of_get_flat_dt_prop(node, "linux,stdout-path", &l);
106 if ((strncmp(p, "xlnx,xps-uart16550", 18) != 0) && 69 if (p != NULL && l > 0)
107 (strncmp(p, "xlnx,axi-uart16550", 18) != 0)) 70 stdout = p; /* store pointer to stdout-path */
108 return 0; 71 }
109 72
110 addr = *(u32 *)of_get_flat_dt_prop(node, "reg", &l); 73 if (stdout && strstr(stdout, uname)) {
111 addr += *(u32 *)of_get_flat_dt_prop(node, "reg-offset", &l); 74 p = of_get_flat_dt_prop(node, "compatible", &l);
112 return be32_to_cpu(addr); /* return address */ 75 pr_debug("Compatible string: %s\n", p);
76
77 if ((strncmp(p, "xlnx,xps-uart16550", 18) == 0) ||
78 (strncmp(p, "xlnx,axi-uart16550", 18) == 0)) {
79 unsigned int addr;
80
81 *(u32 *)data = UART16550;
82
83 addr = *(u32 *)of_get_flat_dt_prop(node, "reg", &l);
84 addr += *(u32 *)of_get_flat_dt_prop(node,
85 "reg-offset", &l);
86 /* clear register offset */
87 return be32_to_cpu(addr) & ~3;
88 }
89 if ((strncmp(p, "xlnx,xps-uartlite", 17) == 0) ||
90 (strncmp(p, "xlnx,opb-uartlite", 17) == 0) ||
91 (strncmp(p, "xlnx,axi-uartlite", 17) == 0) ||
92 (strncmp(p, "xlnx,mdm", 8) == 0)) {
93 unsigned int *addrp;
94
95 *(u32 *)data = UARTLITE;
96
97 addrp = of_get_flat_dt_prop(node, "reg", &l);
98 return be32_to_cpup(addrp); /* return address */
99 }
100 }
101 return 0;
113} 102}
114 103
115/* this function is looking for early uartlite console - Microblaze specific */ 104/* this function is looking for early console - Microblaze specific */
116int __init early_uart16550_console(void) 105int __init of_early_console(void *version)
117{ 106{
118 return of_scan_flat_dt(early_init_dt_scan_serial_full, NULL); 107 return of_scan_flat_dt(early_init_dt_scan_chosen_serial, version);
119} 108}
120#endif 109#endif
121 110
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 8e2c09b7ff26..0e654a12d37e 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -59,6 +59,11 @@ void __init setup_arch(char **cmdline_p)
59 59
60 setup_memory(); 60 setup_memory();
61 61
62#ifdef CONFIG_EARLY_PRINTK
63 /* remap early console to virtual address */
64 remap_early_printk();
65#endif
66
62 xilinx_pci_init(); 67 xilinx_pci_init();
63 68
64#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER) 69#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER)