Root/target/linux/mpc83xx/patches-2.6.33/003-boot_rb600.patch

1--- a/arch/powerpc/boot/rb600.c
2+++ b/arch/powerpc/boot/rb600.c
3@@ -0,0 +1,80 @@
4+/*
5+ * The RouterBOARD platform -- for booting RB600(A) RouterBOARDs.
6+ *
7+ * Author: Michael Guntsche <mike@it-loops.com>
8+ *
9+ * Copyright (c) 2009 Michael Guntsche
10+ *
11+ * This program is free software; you can redistribute it and/or modify it
12+ * under the terms of the GNU General Public License version 2 as published
13+ * by the Free Software Foundation.
14+ */
15+
16+#include "ops.h"
17+#include "types.h"
18+#include "io.h"
19+#include "stdio.h"
20+#include <libfdt.h>
21+
22+BSS_STACK(4*1024);
23+
24+u64 memsize64;
25+const void *fw_dtb;
26+
27+static void rb600_fixups(void)
28+{
29+ const u32 *reg, *timebase, *clock;
30+ int node, size;
31+ void *chosen;
32+ const char* bootargs;
33+
34+ dt_fixup_memory(0, memsize64);
35+
36+ /* Set the MAC addresses. */
37+ node = fdt_path_offset(fw_dtb, "/soc8343@e0000000/ethernet@24000");
38+ reg = fdt_getprop(fw_dtb, node, "mac-address", &size);
39+ dt_fixup_mac_address_by_alias("ethernet1", (const u8 *)reg);
40+
41+ node = fdt_path_offset(fw_dtb, "/soc8343@e0000000/ethernet@25000");
42+ reg = fdt_getprop(fw_dtb, node, "mac-address", &size);
43+ dt_fixup_mac_address_by_alias("ethernet0", (const u8 *)reg);
44+
45+ /* Find the CPU timebase and clock frequencies. */
46+ node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "cpu", sizeof("cpu"));
47+ timebase = fdt_getprop(fw_dtb, node, "timebase-frequency", &size);
48+ clock = fdt_getprop(fw_dtb, node, "clock-frequency", &size);
49+ dt_fixup_cpu_clocks(*clock, *timebase, 0);
50+
51+ /* Fixup chosen
52+ * The bootloader reads the kernelparm segment and adds the content to
53+ * bootargs. This is needed to specify root and other boot flags.
54+ */
55+ chosen = finddevice("/chosen");
56+ node = fdt_path_offset(fw_dtb, "/chosen");
57+ bootargs = fdt_getprop(fw_dtb, node, "bootargs", &size);
58+ setprop_str(chosen, "bootargs", bootargs);
59+}
60+
61+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
62+ unsigned long r6, unsigned long r7)
63+{
64+ const u32 *reg;
65+ int node, size;
66+
67+ fw_dtb = (const void *)r3;
68+
69+ /* Find the memory range. */
70+ node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "memory", sizeof("memory"));
71+ reg = fdt_getprop(fw_dtb, node, "reg", &size);
72+ memsize64 = reg[1];
73+
74+ /* Now we have the memory size; initialize the heap. */
75+ simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64);
76+
77+ /* Prepare the device tree and find the console. */
78+ fdt_init(_dtb_start);
79+ serial_console_init();
80+
81+ /* Remaining fixups... */
82+ platform_ops.fixups = rb600_fixups;
83+}
84

Archive Download this file



interactive