Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 909964ec authored by John Williams's avatar John Williams Committed by Michal Simek
Browse files

microblaze: Final support for statically linked DTB



If r7 is zero at kernel boot, or does not point to a valid DTB, then
we fall back to a DTB (assumed to be) linked statically in the kernel, instead
of blindly copying bogus cruft into the kernel DTB memory region

Signed-off-by: default avatarJohn Williams <john.williams@petalogix.com>
Signed-off-by: default avatarMichal Simek <monstr@monstr.eu>
parent 1170902b
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -16,6 +16,18 @@
#define _ASM_MICROBLAZE_PROM_H
#ifdef __KERNEL__

/* Definitions used by the flattened device tree */
#define OF_DT_HEADER		0xd00dfeed /* marker */
#define OF_DT_BEGIN_NODE	0x1 /* Start of node, full name */
#define OF_DT_END_NODE		0x2 /* End node */
#define OF_DT_PROP		0x3 /* Property: name off, size, content */
#define OF_DT_NOP		0x4 /* nop */
#define OF_DT_END		0x9

#define OF_DT_VERSION		0x10

#ifndef __ASSEMBLY__

#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/platform_device.h>
@@ -29,16 +41,6 @@
#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))

/* Definitions used by the flattened device tree */
#define OF_DT_HEADER		0xd00dfeed /* marker */
#define OF_DT_BEGIN_NODE	0x1 /* Start of node, full name */
#define OF_DT_END_NODE		0x2 /* End node */
#define OF_DT_PROP		0x3 /* Property: name off, size, content */
#define OF_DT_NOP		0x4 /* nop */
#define OF_DT_END		0x9

#define OF_DT_VERSION		0x10

/*
 * This is what gets passed to the kernel by prom_init or kexec
 *
@@ -309,5 +311,6 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
 */
#include <linux/of.h>

#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_MICROBLAZE_PROM_H */
+11 −4
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <linux/linkage.h>
#include <asm/thread_info.h>
#include <asm/page.h>
#include <asm/prom.h>		/* for OF_DT_HEADER */

#ifdef CONFIG_MMU
#include <asm/setup.h> /* COMMAND_LINE_SIZE */
@@ -54,11 +55,16 @@ ENTRY(_start)
	andi	r1, r1, ~2
	mts	rmsr, r1

/* save fdt to kernel location */
/* r7 stores pointer to fdt blob */
	beqi	r7, no_fdt_arg
/* r7 may point to an FDT, or there may be one linked in.
   if it's in r7, we've got to save it away ASAP.
   We ensure r7 points to a valid FDT, just in case the bootloader
   is broken or non-existent */
	beqi	r7, no_fdt_arg			/* NULL pointer?  don't copy */
	lw	r11, r0, r7			/* Does r7 point to a */
	rsubi	r11, r11, OF_DT_HEADER		/* valid FDT? */
	bnei	r11, no_fdt_arg			/* No - get out of here */
	or	r11, r0, r0 /* incremment */
	ori	r4, r0, TOPHYS(_fdt_start) /* save bram context */
	ori	r4, r0, TOPHYS(_fdt_start)
	ori	r3, r0, (0x4000 - 4)
_copy_fdt:
	lw	r12, r7, r11 /* r12 = r7 + r11 */
@@ -67,6 +73,7 @@ _copy_fdt:
	bgtid	r3, _copy_fdt /* loop for all entries */
	addik	r3, r3, -4 /* descrement loop */
no_fdt_arg:
	add	r7, r0, r0			/* Clear r7, just to be sure */

#ifdef CONFIG_MMU

+2 −1
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
#endif

	early_printk("Ramdisk addr 0x%08x, FDT 0x%08x\n", ram, fdt);
	if(fdt)
		printk(KERN_NOTICE "Found FDT at 0x%08x\n", fdt);

#ifdef CONFIG_MTD_UCLINUX