diff options
Diffstat (limited to 'arch/mips/ralink/of.c')
-rw-r--r-- | arch/mips/ralink/of.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c index 7c4598cb6de8..0d30dcd63246 100644 --- a/arch/mips/ralink/of.c +++ b/arch/mips/ralink/of.c | |||
@@ -53,6 +53,17 @@ void __init device_tree_init(void) | |||
53 | unflatten_and_copy_device_tree(); | 53 | unflatten_and_copy_device_tree(); |
54 | } | 54 | } |
55 | 55 | ||
56 | static int memory_dtb; | ||
57 | |||
58 | static int __init early_init_dt_find_memory(unsigned long node, | ||
59 | const char *uname, int depth, void *data) | ||
60 | { | ||
61 | if (depth == 1 && !strcmp(uname, "memory@0")) | ||
62 | memory_dtb = 1; | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
56 | void __init plat_mem_setup(void) | 67 | void __init plat_mem_setup(void) |
57 | { | 68 | { |
58 | set_io_port_base(KSEG1); | 69 | set_io_port_base(KSEG1); |
@@ -63,7 +74,12 @@ void __init plat_mem_setup(void) | |||
63 | */ | 74 | */ |
64 | __dt_setup_arch(__dtb_start); | 75 | __dt_setup_arch(__dtb_start); |
65 | 76 | ||
66 | if (soc_info.mem_size) | 77 | strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); |
78 | |||
79 | of_scan_flat_dt(early_init_dt_find_memory, NULL); | ||
80 | if (memory_dtb) | ||
81 | of_scan_flat_dt(early_init_dt_scan_memory, NULL); | ||
82 | else if (soc_info.mem_size) | ||
67 | add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M, | 83 | add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M, |
68 | BOOT_MEM_RAM); | 84 | BOOT_MEM_RAM); |
69 | else | 85 | else |
@@ -74,19 +90,9 @@ void __init plat_mem_setup(void) | |||
74 | 90 | ||
75 | static int __init plat_of_setup(void) | 91 | static int __init plat_of_setup(void) |
76 | { | 92 | { |
77 | static struct of_device_id of_ids[3]; | 93 | __dt_register_buses(soc_info.compatible, "palmbus"); |
78 | int len = sizeof(of_ids[0].compatible); | ||
79 | |||
80 | if (!of_have_populated_dt()) | ||
81 | panic("device tree not present"); | ||
82 | |||
83 | strlcpy(of_ids[0].compatible, soc_info.compatible, len); | ||
84 | strlcpy(of_ids[1].compatible, "palmbus", len); | ||
85 | |||
86 | if (of_platform_populate(NULL, of_ids, NULL, NULL)) | ||
87 | panic("failed to populate DT"); | ||
88 | 94 | ||
89 | /* make sure ithat the reset controller is setup early */ | 95 | /* make sure that the reset controller is setup early */ |
90 | ralink_rst_init(); | 96 | ralink_rst_init(); |
91 | 97 | ||
92 | return 0; | 98 | return 0; |