aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/Kconfig2
-rw-r--r--arch/microblaze/include/asm/irq.h11
-rw-r--r--arch/microblaze/include/asm/memblock.h14
-rw-r--r--arch/microblaze/include/asm/page.h11
-rw-r--r--arch/microblaze/include/asm/setup.h6
-rw-r--r--arch/microblaze/include/asm/thread_info.h2
-rw-r--r--arch/microblaze/include/asm/unistd.h5
-rw-r--r--arch/microblaze/kernel/early_printk.c4
-rw-r--r--arch/microblaze/kernel/entry.S2
-rw-r--r--arch/microblaze/kernel/intc.c52
-rw-r--r--arch/microblaze/kernel/irq.c11
-rw-r--r--arch/microblaze/kernel/module.c2
-rw-r--r--arch/microblaze/kernel/process.c6
-rw-r--r--arch/microblaze/kernel/prom.c3
-rw-r--r--arch/microblaze/kernel/reset.c43
-rw-r--r--arch/microblaze/kernel/setup.c18
-rw-r--r--arch/microblaze/kernel/syscall_table.S3
-rw-r--r--arch/microblaze/kernel/timer.c21
-rw-r--r--arch/microblaze/lib/Makefile1
-rw-r--r--arch/microblaze/lib/cmpdi2.c26
-rw-r--r--arch/microblaze/pci/iomap.c19
-rw-r--r--arch/microblaze/pci/pci-common.c4
22 files changed, 102 insertions, 164 deletions
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index e446bab2427b..74f23a460ba2 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -17,6 +17,8 @@ config MICROBLAZE
17 select HAVE_GENERIC_HARDIRQS 17 select HAVE_GENERIC_HARDIRQS
18 select GENERIC_IRQ_PROBE 18 select GENERIC_IRQ_PROBE
19 select GENERIC_IRQ_SHOW 19 select GENERIC_IRQ_SHOW
20 select GENERIC_PCI_IOMAP
21 select GENERIC_CPU_DEVICES
20 22
21config SWAP 23config SWAP
22 def_bool n 24 def_bool n
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h
index cc54187f3d38..a175132e4496 100644
--- a/arch/microblaze/include/asm/irq.h
+++ b/arch/microblaze/include/asm/irq.h
@@ -9,7 +9,14 @@
9#ifndef _ASM_MICROBLAZE_IRQ_H 9#ifndef _ASM_MICROBLAZE_IRQ_H
10#define _ASM_MICROBLAZE_IRQ_H 10#define _ASM_MICROBLAZE_IRQ_H
11 11
12#define NR_IRQS 32 12
13/*
14 * Linux IRQ# is currently offset by one to map to the hardware
15 * irq number. So hardware IRQ0 maps to Linux irq 1.
16 */
17#define NO_IRQ_OFFSET 1
18#define IRQ_OFFSET NO_IRQ_OFFSET
19#define NR_IRQS (32 + IRQ_OFFSET)
13#include <asm-generic/irq.h> 20#include <asm-generic/irq.h>
14 21
15/* This type is the placeholder for a hardware interrupt number. It has to 22/* This type is the placeholder for a hardware interrupt number. It has to
@@ -20,8 +27,6 @@ typedef unsigned long irq_hw_number_t;
20 27
21extern unsigned int nr_irq; 28extern unsigned int nr_irq;
22 29
23#define NO_IRQ (-1)
24
25struct pt_regs; 30struct pt_regs;
26extern void do_IRQ(struct pt_regs *regs); 31extern void do_IRQ(struct pt_regs *regs);
27 32
diff --git a/arch/microblaze/include/asm/memblock.h b/arch/microblaze/include/asm/memblock.h
deleted file mode 100644
index 20a8e257c77f..000000000000
--- a/arch/microblaze/include/asm/memblock.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8
9#ifndef _ASM_MICROBLAZE_MEMBLOCK_H
10#define _ASM_MICROBLAZE_MEMBLOCK_H
11
12#endif /* _ASM_MICROBLAZE_MEMBLOCK_H */
13
14
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index ed9d0f6e2cdb..a25e6b5e2ad4 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -174,15 +174,8 @@ extern int page_is_ram(unsigned long pfn);
174 174
175#define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr))) 175#define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr)))
176 176
177 177# define __pa(x) __virt_to_phys((unsigned long)(x))
178# ifndef CONFIG_MMU 178# define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
179# define __pa(vaddr) ((unsigned long) (vaddr))
180# define __va(paddr) ((void *) (paddr))
181# else /* CONFIG_MMU */
182# define __pa(x) __virt_to_phys((unsigned long)(x))
183# define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
184# endif /* CONFIG_MMU */
185
186 179
187/* Convert between virtual and physical address for MMU. */ 180/* Convert between virtual and physical address for MMU. */
188/* Handle MicroBlaze processor with virtual memory. */ 181/* Handle MicroBlaze processor with virtual memory. */
diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
index 904e5ef6a11b..6c72ed7eba98 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -26,12 +26,6 @@ int setup_early_printk(char *opt);
26void remap_early_printk(void); 26void remap_early_printk(void);
27void disable_early_printk(void); 27void disable_early_printk(void);
28 28
29#if defined(CONFIG_EARLY_PRINTK)
30#define eprintk early_printk
31#else
32#define eprintk printk
33#endif
34
35void heartbeat(void); 29void heartbeat(void);
36void setup_heartbeat(void); 30void setup_heartbeat(void);
37 31
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h
index b73da2ac21b3..1a8ab6a5c03f 100644
--- a/arch/microblaze/include/asm/thread_info.h
+++ b/arch/microblaze/include/asm/thread_info.h
@@ -125,7 +125,6 @@ static inline struct thread_info *current_thread_info(void)
125#define TIF_MEMDIE 6 /* is terminating due to OOM killer */ 125#define TIF_MEMDIE 6 /* is terminating due to OOM killer */
126#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ 126#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
127#define TIF_SECCOMP 10 /* secure computing */ 127#define TIF_SECCOMP 10 /* secure computing */
128#define TIF_FREEZE 14 /* Freezing for suspend */
129 128
130/* true if poll_idle() is polling TIF_NEED_RESCHED */ 129/* true if poll_idle() is polling TIF_NEED_RESCHED */
131#define TIF_POLLING_NRFLAG 16 130#define TIF_POLLING_NRFLAG 16
@@ -137,7 +136,6 @@ static inline struct thread_info *current_thread_info(void)
137#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 136#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
138#define _TIF_IRET (1 << TIF_IRET) 137#define _TIF_IRET (1 << TIF_IRET)
139#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 138#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
140#define _TIF_FREEZE (1 << TIF_FREEZE)
141#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 139#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
142#define _TIF_SECCOMP (1 << TIF_SECCOMP) 140#define _TIF_SECCOMP (1 << TIF_SECCOMP)
143 141
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index 7d7092b917ac..d20ffbc86beb 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -391,8 +391,11 @@
391#define __NR_clock_adjtime 373 391#define __NR_clock_adjtime 373
392#define __NR_syncfs 374 392#define __NR_syncfs 374
393#define __NR_setns 375 393#define __NR_setns 375
394#define __NR_sendmmsg 376
395#define __NR_process_vm_readv 377
396#define __NR_process_vm_writev 378
394 397
395#define __NR_syscalls 376 398#define __NR_syscalls 379
396 399
397#ifdef __KERNEL__ 400#ifdef __KERNEL__
398#ifndef __ASSEMBLY__ 401#ifndef __ASSEMBLY__
diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
index d26d92d47754..8356e47631c4 100644
--- a/arch/microblaze/kernel/early_printk.c
+++ b/arch/microblaze/kernel/early_printk.c
@@ -50,9 +50,9 @@ static void early_printk_uartlite_write(struct console *unused,
50 const char *s, unsigned n) 50 const char *s, unsigned n)
51{ 51{
52 while (*s && n-- > 0) { 52 while (*s && n-- > 0) {
53 early_printk_uartlite_putc(*s);
54 if (*s == '\n') 53 if (*s == '\n')
55 early_printk_uartlite_putc('\r'); 54 early_printk_uartlite_putc('\r');
55 early_printk_uartlite_putc(*s);
56 s++; 56 s++;
57 } 57 }
58} 58}
@@ -94,9 +94,9 @@ static void early_printk_uart16550_write(struct console *unused,
94 const char *s, unsigned n) 94 const char *s, unsigned n)
95{ 95{
96 while (*s && n-- > 0) { 96 while (*s && n-- > 0) {
97 early_printk_uart16550_putc(*s);
98 if (*s == '\n') 97 if (*s == '\n')
99 early_printk_uart16550_putc('\r'); 98 early_printk_uart16550_putc('\r');
99 early_printk_uart16550_putc(*s);
100 s++; 100 s++;
101 } 101 }
102} 102}
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index ca15bc5c7449..66e34a3bfe1b 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -468,7 +468,7 @@ C_ENTRY(sys_fork_wrapper):
468 addi r5, r0, SIGCHLD /* Arg 0: flags */ 468 addi r5, r0, SIGCHLD /* Arg 0: flags */
469 lwi r6, r1, PT_R1 /* Arg 1: child SP (use parent's) */ 469 lwi r6, r1, PT_R1 /* Arg 1: child SP (use parent's) */
470 addik r7, r1, 0 /* Arg 2: parent context */ 470 addik r7, r1, 0 /* Arg 2: parent context */
471 add r8. r0, r0 /* Arg 3: (unused) */ 471 add r8, r0, r0 /* Arg 3: (unused) */
472 add r9, r0, r0; /* Arg 4: (unused) */ 472 add r9, r0, r0; /* Arg 4: (unused) */
473 brid do_fork /* Do real work (tail-call) */ 473 brid do_fork /* Do real work (tail-call) */
474 add r10, r0, r0; /* Arg 5: (unused) */ 474 add r10, r0, r0; /* Arg 5: (unused) */
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
index eb41441c7fd0..44b177e2ab12 100644
--- a/arch/microblaze/kernel/intc.c
+++ b/arch/microblaze/kernel/intc.c
@@ -42,8 +42,9 @@ unsigned int nr_irq;
42 42
43static void intc_enable_or_unmask(struct irq_data *d) 43static void intc_enable_or_unmask(struct irq_data *d)
44{ 44{
45 unsigned long mask = 1 << d->irq; 45 unsigned long mask = 1 << d->hwirq;
46 pr_debug("enable_or_unmask: %d\n", d->irq); 46
47 pr_debug("enable_or_unmask: %ld\n", d->hwirq);
47 out_be32(INTC_BASE + SIE, mask); 48 out_be32(INTC_BASE + SIE, mask);
48 49
49 /* ack level irqs because they can't be acked during 50 /* ack level irqs because they can't be acked during
@@ -56,20 +57,21 @@ static void intc_enable_or_unmask(struct irq_data *d)
56 57
57static void intc_disable_or_mask(struct irq_data *d) 58static void intc_disable_or_mask(struct irq_data *d)
58{ 59{
59 pr_debug("disable: %d\n", d->irq); 60 pr_debug("disable: %ld\n", d->hwirq);
60 out_be32(INTC_BASE + CIE, 1 << d->irq); 61 out_be32(INTC_BASE + CIE, 1 << d->hwirq);
61} 62}
62 63
63static void intc_ack(struct irq_data *d) 64static void intc_ack(struct irq_data *d)
64{ 65{
65 pr_debug("ack: %d\n", d->irq); 66 pr_debug("ack: %ld\n", d->hwirq);
66 out_be32(INTC_BASE + IAR, 1 << d->irq); 67 out_be32(INTC_BASE + IAR, 1 << d->hwirq);
67} 68}
68 69
69static void intc_mask_ack(struct irq_data *d) 70static void intc_mask_ack(struct irq_data *d)
70{ 71{
71 unsigned long mask = 1 << d->irq; 72 unsigned long mask = 1 << d->hwirq;
72 pr_debug("disable_and_ack: %d\n", d->irq); 73
74 pr_debug("disable_and_ack: %ld\n", d->hwirq);
73 out_be32(INTC_BASE + CIE, mask); 75 out_be32(INTC_BASE + CIE, mask);
74 out_be32(INTC_BASE + IAR, mask); 76 out_be32(INTC_BASE + IAR, mask);
75} 77}
@@ -91,7 +93,7 @@ unsigned int get_irq(struct pt_regs *regs)
91 * order to handle multiple interrupt controllers. It currently 93 * order to handle multiple interrupt controllers. It currently
92 * is hardcoded to check for interrupts only on the first INTC. 94 * is hardcoded to check for interrupts only on the first INTC.
93 */ 95 */
94 irq = in_be32(INTC_BASE + IVR); 96 irq = in_be32(INTC_BASE + IVR) + NO_IRQ_OFFSET;
95 pr_debug("get_irq: %d\n", irq); 97 pr_debug("get_irq: %d\n", irq);
96 98
97 return irq; 99 return irq;
@@ -99,7 +101,7 @@ unsigned int get_irq(struct pt_regs *regs)
99 101
100void __init init_IRQ(void) 102void __init init_IRQ(void)
101{ 103{
102 u32 i, j, intr_type; 104 u32 i, intr_mask;
103 struct device_node *intc = NULL; 105 struct device_node *intc = NULL;
104#ifdef CONFIG_SELFMOD_INTC 106#ifdef CONFIG_SELFMOD_INTC
105 unsigned int intc_baseaddr = 0; 107 unsigned int intc_baseaddr = 0;
@@ -113,35 +115,24 @@ void __init init_IRQ(void)
113 0 115 0
114 }; 116 };
115#endif 117#endif
116 const char * const intc_list[] = { 118 intc = of_find_compatible_node(NULL, NULL, "xlnx,xps-intc-1.00.a");
117 "xlnx,xps-intc-1.00.a",
118 NULL
119 };
120
121 for (j = 0; intc_list[j] != NULL; j++) {
122 intc = of_find_compatible_node(NULL, NULL, intc_list[j]);
123 if (intc)
124 break;
125 }
126 BUG_ON(!intc); 119 BUG_ON(!intc);
127 120
128 intc_baseaddr = be32_to_cpup(of_get_property(intc, 121 intc_baseaddr = be32_to_cpup(of_get_property(intc, "reg", NULL));
129 "reg", NULL));
130 intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE); 122 intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE);
131 nr_irq = be32_to_cpup(of_get_property(intc, 123 nr_irq = be32_to_cpup(of_get_property(intc,
132 "xlnx,num-intr-inputs", NULL)); 124 "xlnx,num-intr-inputs", NULL));
133 125
134 intr_type = 126 intr_mask =
135 be32_to_cpup(of_get_property(intc, 127 be32_to_cpup(of_get_property(intc, "xlnx,kind-of-intr", NULL));
136 "xlnx,kind-of-intr", NULL)); 128 if (intr_mask > (u32)((1ULL << nr_irq) - 1))
137 if (intr_type > (u32)((1ULL << nr_irq) - 1))
138 printk(KERN_INFO " ERROR: Mismatch in kind-of-intr param\n"); 129 printk(KERN_INFO " ERROR: Mismatch in kind-of-intr param\n");
139 130
140#ifdef CONFIG_SELFMOD_INTC 131#ifdef CONFIG_SELFMOD_INTC
141 selfmod_function((int *) arr_func, intc_baseaddr); 132 selfmod_function((int *) arr_func, intc_baseaddr);
142#endif 133#endif
143 printk(KERN_INFO "%s #0 at 0x%08x, num_irq=%d, edge=0x%x\n", 134 printk(KERN_INFO "XPS intc #0 at 0x%08x, num_irq=%d, edge=0x%x\n",
144 intc_list[j], intc_baseaddr, nr_irq, intr_type); 135 intc_baseaddr, nr_irq, intr_mask);
145 136
146 /* 137 /*
147 * Disable all external interrupts until they are 138 * Disable all external interrupts until they are
@@ -155,8 +146,8 @@ void __init init_IRQ(void)
155 /* Turn on the Master Enable. */ 146 /* Turn on the Master Enable. */
156 out_be32(intc_baseaddr + MER, MER_HIE | MER_ME); 147 out_be32(intc_baseaddr + MER, MER_HIE | MER_ME);
157 148
158 for (i = 0; i < nr_irq; ++i) { 149 for (i = IRQ_OFFSET; i < (nr_irq + IRQ_OFFSET); ++i) {
159 if (intr_type & (0x00000001 << i)) { 150 if (intr_mask & (0x00000001 << (i - IRQ_OFFSET))) {
160 irq_set_chip_and_handler_name(i, &intc_dev, 151 irq_set_chip_and_handler_name(i, &intc_dev,
161 handle_edge_irq, "edge"); 152 handle_edge_irq, "edge");
162 irq_clear_status_flags(i, IRQ_LEVEL); 153 irq_clear_status_flags(i, IRQ_LEVEL);
@@ -165,5 +156,6 @@ void __init init_IRQ(void)
165 handle_level_irq, "level"); 156 handle_level_irq, "level");
166 irq_set_status_flags(i, IRQ_LEVEL); 157 irq_set_status_flags(i, IRQ_LEVEL);
167 } 158 }
159 irq_get_irq_data(i)->hwirq = i - IRQ_OFFSET;
168 } 160 }
169} 161}
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
index e5d63a89b9b2..bbebcae72c02 100644
--- a/arch/microblaze/kernel/irq.c
+++ b/arch/microblaze/kernel/irq.c
@@ -33,11 +33,12 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
33 irq_enter(); 33 irq_enter();
34 irq = get_irq(regs); 34 irq = get_irq(regs);
35next_irq: 35next_irq:
36 BUG_ON(irq == -1U); 36 BUG_ON(!irq);
37 generic_handle_irq(irq); 37 /* Substract 1 because of get_irq */
38 generic_handle_irq(irq + IRQ_OFFSET - NO_IRQ_OFFSET);
38 39
39 irq = get_irq(regs); 40 irq = get_irq(regs);
40 if (irq != -1U) { 41 if (irq) {
41 pr_debug("next irq: %d\n", irq); 42 pr_debug("next irq: %d\n", irq);
42 ++concurrent_irq; 43 ++concurrent_irq;
43 goto next_irq; 44 goto next_irq;
@@ -52,13 +53,13 @@ next_irq:
52 intc without any cascades or any connection that's why mapping is 1:1 */ 53 intc without any cascades or any connection that's why mapping is 1:1 */
53unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq) 54unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq)
54{ 55{
55 return hwirq; 56 return hwirq + IRQ_OFFSET;
56} 57}
57EXPORT_SYMBOL_GPL(irq_create_mapping); 58EXPORT_SYMBOL_GPL(irq_create_mapping);
58 59
59unsigned int irq_create_of_mapping(struct device_node *controller, 60unsigned int irq_create_of_mapping(struct device_node *controller,
60 const u32 *intspec, unsigned int intsize) 61 const u32 *intspec, unsigned int intsize)
61{ 62{
62 return intspec[0]; 63 return intspec[0] + IRQ_OFFSET;
63} 64}
64EXPORT_SYMBOL_GPL(irq_create_of_mapping); 65EXPORT_SYMBOL_GPL(irq_create_of_mapping);
diff --git a/arch/microblaze/kernel/module.c b/arch/microblaze/kernel/module.c
index 142426f631bb..f39257a5abcf 100644
--- a/arch/microblaze/kernel/module.c
+++ b/arch/microblaze/kernel/module.c
@@ -100,7 +100,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
100 break; 100 break;
101 101
102 case R_MICROBLAZE_64_NONE: 102 case R_MICROBLAZE_64_NONE:
103 pr_debug("R_MICROBLAZE_NONE\n"); 103 pr_debug("R_MICROBLAZE_64_NONE\n");
104 break; 104 break;
105 105
106 case R_MICROBLAZE_NONE: 106 case R_MICROBLAZE_NONE:
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 95cc295976a7..7dcb5bfffb75 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -103,10 +103,12 @@ void cpu_idle(void)
103 if (!idle) 103 if (!idle)
104 idle = default_idle; 104 idle = default_idle;
105 105
106 tick_nohz_stop_sched_tick(1); 106 tick_nohz_idle_enter();
107 rcu_idle_enter();
107 while (!need_resched()) 108 while (!need_resched())
108 idle(); 109 idle();
109 tick_nohz_restart_sched_tick(); 110 rcu_idle_exit();
111 tick_nohz_idle_exit();
110 112
111 preempt_enable_no_resched(); 113 preempt_enable_no_resched();
112 schedule(); 114 schedule();
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 977484add216..80d314e81901 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -122,7 +122,6 @@ void __init early_init_devtree(void *params)
122 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line); 122 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
123 123
124 /* Scan memory nodes and rebuild MEMBLOCKs */ 124 /* Scan memory nodes and rebuild MEMBLOCKs */
125 memblock_init();
126 of_scan_flat_dt(early_init_dt_scan_root, NULL); 125 of_scan_flat_dt(early_init_dt_scan_root, NULL);
127 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 126 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
128 127
@@ -130,7 +129,7 @@ void __init early_init_devtree(void *params)
130 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); 129 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
131 parse_early_param(); 130 parse_early_param();
132 131
133 memblock_analyze(); 132 memblock_allow_resize();
134 133
135 pr_debug("Phys. mem: %lx\n", (unsigned long) memblock_phys_mem_size()); 134 pr_debug("Phys. mem: %lx\n", (unsigned long) memblock_phys_mem_size());
136 135
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index bd8ccab5ceff..88a01636f785 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -19,50 +19,11 @@
19static int handle; /* reset pin handle */ 19static int handle; /* reset pin handle */
20static unsigned int reset_val; 20static unsigned int reset_val;
21 21
22static int of_reset_gpio_handle(void)
23{
24 int ret; /* variable which stored handle reset gpio pin */
25 struct device_node *root; /* root node */
26 struct device_node *gpio; /* gpio node */
27 struct gpio_chip *gc;
28 u32 flags;
29 const void *gpio_spec;
30
31 /* find out root node */
32 root = of_find_node_by_path("/");
33
34 /* give me handle for gpio node to be possible allocate pin */
35 ret = of_parse_phandles_with_args(root, "hard-reset-gpios",
36 "#gpio-cells", 0, &gpio, &gpio_spec);
37 if (ret) {
38 pr_debug("%s: can't parse gpios property\n", __func__);
39 goto err0;
40 }
41
42 gc = of_node_to_gpiochip(gpio);
43 if (!gc) {
44 pr_debug("%s: gpio controller %s isn't registered\n",
45 root->full_name, gpio->full_name);
46 ret = -ENODEV;
47 goto err1;
48 }
49
50 ret = gc->of_xlate(gc, root, gpio_spec, &flags);
51 if (ret < 0)
52 goto err1;
53
54 ret += gc->base;
55err1:
56 of_node_put(gpio);
57err0:
58 pr_debug("%s exited with status %d\n", __func__, ret);
59 return ret;
60}
61
62void of_platform_reset_gpio_probe(void) 22void of_platform_reset_gpio_probe(void)
63{ 23{
64 int ret; 24 int ret;
65 handle = of_reset_gpio_handle(); 25 handle = of_get_named_gpio(of_find_node_by_path("/"),
26 "hard-reset-gpios", 0);
66 27
67 if (!gpio_is_valid(handle)) { 28 if (!gpio_is_valid(handle)) {
68 printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n", 29 printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n",
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 0e654a12d37e..604cd9dd1333 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -145,32 +145,32 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
145 setup_early_printk(NULL); 145 setup_early_printk(NULL);
146#endif 146#endif
147 147
148 eprintk("Ramdisk addr 0x%08x, ", ram); 148 printk("Ramdisk addr 0x%08x, ", ram);
149 if (fdt) 149 if (fdt)
150 eprintk("FDT at 0x%08x\n", fdt); 150 printk("FDT at 0x%08x\n", fdt);
151 else 151 else
152 eprintk("Compiled-in FDT at 0x%08x\n", 152 printk("Compiled-in FDT at 0x%08x\n",
153 (unsigned int)_fdt_start); 153 (unsigned int)_fdt_start);
154 154
155#ifdef CONFIG_MTD_UCLINUX 155#ifdef CONFIG_MTD_UCLINUX
156 eprintk("Found romfs @ 0x%08x (0x%08x)\n", 156 printk("Found romfs @ 0x%08x (0x%08x)\n",
157 romfs_base, romfs_size); 157 romfs_base, romfs_size);
158 eprintk("#### klimit %p ####\n", old_klimit); 158 printk("#### klimit %p ####\n", old_klimit);
159 BUG_ON(romfs_size < 0); /* What else can we do? */ 159 BUG_ON(romfs_size < 0); /* What else can we do? */
160 160
161 eprintk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", 161 printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n",
162 romfs_size, romfs_base, (unsigned)&_ebss); 162 romfs_size, romfs_base, (unsigned)&_ebss);
163 163
164 eprintk("New klimit: 0x%08x\n", (unsigned)klimit); 164 printk("New klimit: 0x%08x\n", (unsigned)klimit);
165#endif 165#endif
166 166
167#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 167#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
168 if (msr) 168 if (msr)
169 eprintk("!!!Your kernel has setup MSR instruction but " 169 printk("!!!Your kernel has setup MSR instruction but "
170 "CPU don't have it %x\n", msr); 170 "CPU don't have it %x\n", msr);
171#else 171#else
172 if (!msr) 172 if (!msr)
173 eprintk("!!!Your kernel not setup MSR instruction but " 173 printk("!!!Your kernel not setup MSR instruction but "
174 "CPU have it %x\n", msr); 174 "CPU have it %x\n", msr);
175#endif 175#endif
176 176
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 8789daa2a346..6a2b294ef6dc 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -380,3 +380,6 @@ ENTRY(sys_call_table)
380 .long sys_clock_adjtime 380 .long sys_clock_adjtime
381 .long sys_syncfs 381 .long sys_syncfs
382 .long sys_setns /* 375 */ 382 .long sys_setns /* 375 */
383 .long sys_sendmmsg
384 .long sys_process_vm_readv
385 .long sys_process_vm_writev
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index af74b1113aab..3cb0bf640135 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -243,7 +243,7 @@ static int timer_initialized;
243 243
244void __init time_init(void) 244void __init time_init(void)
245{ 245{
246 u32 irq, i = 0; 246 u32 irq;
247 u32 timer_num = 1; 247 u32 timer_num = 1;
248 struct device_node *timer = NULL; 248 struct device_node *timer = NULL;
249 const void *prop; 249 const void *prop;
@@ -258,33 +258,24 @@ void __init time_init(void)
258 0 258 0
259 }; 259 };
260#endif 260#endif
261 const char * const timer_list[] = { 261 timer = of_find_compatible_node(NULL, NULL, "xlnx,xps-timer-1.00.a");
262 "xlnx,xps-timer-1.00.a",
263 NULL
264 };
265
266 for (i = 0; timer_list[i] != NULL; i++) {
267 timer = of_find_compatible_node(NULL, NULL, timer_list[i]);
268 if (timer)
269 break;
270 }
271 BUG_ON(!timer); 262 BUG_ON(!timer);
272 263
273 timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL)); 264 timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL));
274 timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE); 265 timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE);
275 irq = be32_to_cpup(of_get_property(timer, "interrupts", NULL)); 266 irq = irq_of_parse_and_map(timer, 0);
276 timer_num = be32_to_cpup(of_get_property(timer, 267 timer_num = be32_to_cpup(of_get_property(timer,
277 "xlnx,one-timer-only", NULL)); 268 "xlnx,one-timer-only", NULL));
278 if (timer_num) { 269 if (timer_num) {
279 eprintk(KERN_EMERG "Please enable two timers in HW\n"); 270 printk(KERN_EMERG "Please enable two timers in HW\n");
280 BUG(); 271 BUG();
281 } 272 }
282 273
283#ifdef CONFIG_SELFMOD_TIMER 274#ifdef CONFIG_SELFMOD_TIMER
284 selfmod_function((int *) arr_func, timer_baseaddr); 275 selfmod_function((int *) arr_func, timer_baseaddr);
285#endif 276#endif
286 printk(KERN_INFO "%s #0 at 0x%08x, irq=%d\n", 277 printk(KERN_INFO "XPS timer #0 at 0x%08x, irq=%d\n",
287 timer_list[i], timer_baseaddr, irq); 278 timer_baseaddr, irq);
288 279
289 /* If there is clock-frequency property than use it */ 280 /* If there is clock-frequency property than use it */
290 prop = of_get_property(timer, "clock-frequency", NULL); 281 prop = of_get_property(timer, "clock-frequency", NULL);
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index c13067b243c3..844960e8ae18 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -20,6 +20,7 @@ lib-y += uaccess_old.o
20 20
21lib-y += ashldi3.o 21lib-y += ashldi3.o
22lib-y += ashrdi3.o 22lib-y += ashrdi3.o
23lib-y += cmpdi2.o
23lib-y += divsi3.o 24lib-y += divsi3.o
24lib-y += lshrdi3.o 25lib-y += lshrdi3.o
25lib-y += modsi3.o 26lib-y += modsi3.o
diff --git a/arch/microblaze/lib/cmpdi2.c b/arch/microblaze/lib/cmpdi2.c
new file mode 100644
index 000000000000..a708400ea7b7
--- /dev/null
+++ b/arch/microblaze/lib/cmpdi2.c
@@ -0,0 +1,26 @@
1#include <linux/module.h>
2
3#include "libgcc.h"
4
5word_type __cmpdi2(long long a, long long b)
6{
7 const DWunion au = {
8 .ll = a
9 };
10 const DWunion bu = {
11 .ll = b
12 };
13
14 if (au.s.high < bu.s.high)
15 return 0;
16 else if (au.s.high > bu.s.high)
17 return 2;
18
19 if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
20 return 0;
21 else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
22 return 2;
23
24 return 1;
25}
26EXPORT_SYMBOL(__cmpdi2);
diff --git a/arch/microblaze/pci/iomap.c b/arch/microblaze/pci/iomap.c
index 57acda852f5a..b07abbac0319 100644
--- a/arch/microblaze/pci/iomap.c
+++ b/arch/microblaze/pci/iomap.c
@@ -10,25 +10,6 @@
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/pci-bridge.h> 11#include <asm/pci-bridge.h>
12 12
13void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
14{
15 resource_size_t start = pci_resource_start(dev, bar);
16 resource_size_t len = pci_resource_len(dev, bar);
17 unsigned long flags = pci_resource_flags(dev, bar);
18
19 if (!len)
20 return NULL;
21 if (max && len > max)
22 len = max;
23 if (flags & IORESOURCE_IO)
24 return ioport_map(start, len);
25 if (flags & IORESOURCE_MEM)
26 return ioremap(start, len);
27 /* What? */
28 return NULL;
29}
30EXPORT_SYMBOL(pci_iomap);
31
32void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 13void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
33{ 14{
34 if (isa_vaddr_is_ioport(addr)) 15 if (isa_vaddr_is_ioport(addr))
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 016d420f0ec7..85f2ac1230a8 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -247,7 +247,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
247 line, pin); 247 line, pin);
248 248
249 virq = irq_create_mapping(NULL, line); 249 virq = irq_create_mapping(NULL, line);
250 if (virq != NO_IRQ) 250 if (virq)
251 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 251 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
252 } else { 252 } else {
253 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 253 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
@@ -258,7 +258,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
258 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 258 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
259 oirq.size); 259 oirq.size);
260 } 260 }
261 if (virq == NO_IRQ) { 261 if (!virq) {
262 pr_debug(" Failed to map !\n"); 262 pr_debug(" Failed to map !\n");
263 return -1; 263 return -1;
264 } 264 }