ar71xx: add default network config for the AP121 boards
[openwrt.git] / target / linux / mpc83xx / patches-2.6.36 / 022-boot_rb333.patch
1 --- /dev/null
2 +++ b/arch/powerpc/boot/rb333.c
3 @@ -0,0 +1,73 @@
4 +/*
5 + * The RouterBOARD platform -- for booting RB333 RouterBOARDs.
6 + *
7 + * Author: Alexandros C. Couloumbis <alex@ozo.com>
8 + * Author: Michael Guntsche <mike@it-loops.com>
9 + *
10 + * Copyright (c) 2010 Alexandros C. Couloumbis
11 + * Copyright (c) 2009 Michael Guntsche
12 + *
13 + * This program is free software; you can redistribute it and/or modify it
14 + * under the terms of the GNU General Public License version 2 as published
15 + * by the Free Software Foundation.
16 + */
17 +
18 +#include "ops.h"
19 +#include "types.h"
20 +#include "io.h"
21 +#include "stdio.h"
22 +#include <libfdt.h>
23 +
24 +BSS_STACK(4*1024);
25 +
26 +u64 memsize64;
27 +const void *fw_dtb;
28 +
29 +static void rb333_fixups(void)
30 +{
31 + const u32 *reg, *timebase, *clock;
32 + int node, size;
33 + void *chosen;
34 + const char* bootargs;
35 +
36 + dt_fixup_memory(0, memsize64);
37 +
38 + /* Find the CPU timebase and clock frequencies. */
39 + node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "cpu", sizeof("cpu"));
40 + timebase = fdt_getprop(fw_dtb, node, "timebase-frequency", &size);
41 + clock = fdt_getprop(fw_dtb, node, "clock-frequency", &size);
42 + dt_fixup_cpu_clocks(*clock, *timebase, 0);
43 +
44 + /* Fixup chosen
45 + * The bootloader reads the kernelparm segment and adds the content to
46 + * bootargs. This is needed to specify root and other boot flags.
47 + */
48 + chosen = finddevice("/chosen");
49 + node = fdt_path_offset(fw_dtb, "/chosen");
50 + bootargs = fdt_getprop(fw_dtb, node, "bootargs", &size);
51 + setprop_str(chosen, "bootargs", bootargs);
52 +}
53 +
54 +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
55 + unsigned long r6, unsigned long r7)
56 +{
57 + const u32 *reg;
58 + int node, size;
59 +
60 + fw_dtb = (const void *)r3;
61 +
62 + /* Find the memory range. */
63 + node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "memory", sizeof("memory"));
64 + reg = fdt_getprop(fw_dtb, node, "reg", &size);
65 + memsize64 = reg[1];
66 +
67 + /* Now we have the memory size; initialize the heap. */
68 + simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64);
69 +
70 + /* Prepare the device tree and find the console. */
71 + fdt_init(_dtb_start);
72 + serial_console_init();
73 +
74 + /* Remaining fixups... */
75 + platform_ops.fixups = rb333_fixups;
76 +}
This page took 0.048928 seconds and 5 git commands to generate.