aboutsummaryrefslogtreecommitdiffstats
path: root/arch/openrisc
diff options
context:
space:
mode:
authorStefan Kristiansson <stefan.kristiansson@saunalahti.fi>2011-11-10 10:38:29 -0500
committerJonas Bonn <jonas@southpole.se>2012-02-17 03:55:22 -0500
commitdec830189e1e192a80f574243a2dc31bdc1c4fc5 (patch)
tree864ae5fd9b3975805195eb2b0396d80e6a408425 /arch/openrisc
parent2e1c958de4e22b6badc13dba1a0ebaa5aa798664 (diff)
openrisc: enable passing of flattened device tree pointer
This patch enables passing a fdt pointer to the kernel. This makes for the kernel parameter API: void kernel(unsigned int fdt); which, in accordance with the OpenRISC ABI results in: r3 = pointer to fdt Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Signed-off-by: Jonas Bonn <jonas@southpole.se>
Diffstat (limited to 'arch/openrisc')
-rw-r--r--arch/openrisc/kernel/head.S17
-rw-r--r--arch/openrisc/kernel/setup.c18
2 files changed, 25 insertions, 10 deletions
diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
index c75018d22644..1088b5fca3bd 100644
--- a/arch/openrisc/kernel/head.S
+++ b/arch/openrisc/kernel/head.S
@@ -26,6 +26,7 @@
26#include <asm/cache.h> 26#include <asm/cache.h>
27#include <asm/spr_defs.h> 27#include <asm/spr_defs.h>
28#include <asm/asm-offsets.h> 28#include <asm/asm-offsets.h>
29#include <linux/of_fdt.h>
29 30
30#define tophys(rd,rs) \ 31#define tophys(rd,rs) \
31 l.movhi rd,hi(-KERNELBASE) ;\ 32 l.movhi rd,hi(-KERNELBASE) ;\
@@ -440,6 +441,9 @@ _dispatch_do_ipage_fault:
440 __HEAD 441 __HEAD
441 .global _start 442 .global _start
442_start: 443_start:
444 /* save kernel parameters */
445 l.or r25,r0,r3 /* pointer to fdt */
446
443 /* 447 /*
444 * ensure a deterministic start 448 * ensure a deterministic start
445 */ 449 */
@@ -471,7 +475,6 @@ _start:
471 CLEAR_GPR(r22) 475 CLEAR_GPR(r22)
472 CLEAR_GPR(r23) 476 CLEAR_GPR(r23)
473 CLEAR_GPR(r24) 477 CLEAR_GPR(r24)
474 CLEAR_GPR(r25)
475 CLEAR_GPR(r26) 478 CLEAR_GPR(r26)
476 CLEAR_GPR(r27) 479 CLEAR_GPR(r27)
477 CLEAR_GPR(r28) 480 CLEAR_GPR(r28)
@@ -565,6 +568,18 @@ enable_mmu:
565 // reset the simulation counters 568 // reset the simulation counters
566 l.nop 5 569 l.nop 5
567 570
571 /* check fdt header magic word */
572 l.lwz r3,0(r25) /* load magic from fdt into r3 */
573 l.movhi r4,hi(OF_DT_HEADER)
574 l.ori r4,r4,lo(OF_DT_HEADER)
575 l.sfeq r3,r4
576 l.bf _fdt_found
577 l.nop
578 /* magic number mismatch, set fdt pointer to null */
579 l.or r25,r0,r0
580_fdt_found:
581 /* pass fdt pointer to or32_early_setup in r3 */
582 l.or r3,r0,r25
568 LOAD_SYMBOL_2_GPR(r24, or32_early_setup) 583 LOAD_SYMBOL_2_GPR(r24, or32_early_setup)
569 l.jalr r24 584 l.jalr r24
570 l.nop 585 l.nop
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index 1422f747f52b..bf5eba22ce9e 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -207,18 +207,18 @@ void __init setup_cpuinfo(void)
207 * Handles the pointer to the device tree that this kernel is to use 207 * Handles the pointer to the device tree that this kernel is to use
208 * for establishing the available platform devices. 208 * for establishing the available platform devices.
209 * 209 *
210 * For now, this is limited to using the built-in device tree. In the future, 210 * Falls back on built-in device tree in case null pointer is passed.
211 * it is intended that this function will take a pointer to the device tree
212 * that is potentially built-in, but potentially also passed in by the
213 * bootloader, or discovered by some equally clever means...
214 */ 211 */
215 212
216void __init or32_early_setup(void) 213void __init or32_early_setup(unsigned int fdt)
217{ 214{
218 215 if (fdt) {
219 early_init_devtree(__dtb_start); 216 early_init_devtree((void*) fdt);
220 217 printk(KERN_INFO "FDT at 0x%08x\n", fdt);
221 printk(KERN_INFO "Compiled-in FDT at 0x%p\n", __dtb_start); 218 } else {
219 early_init_devtree(__dtb_start);
220 printk(KERN_INFO "Compiled-in FDT at %p\n", __dtb_start);
221 }
222} 222}
223 223
224static int __init openrisc_device_probe(void) 224static int __init openrisc_device_probe(void)