diff options
author | Alban Bedel <albeu@free.fr> | 2015-05-30 19:52:25 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-21 15:54:01 -0400 |
commit | 03c8c407a8c9ba1772ea7c086b7a0f7bceecdb65 (patch) | |
tree | e71058925bc6d52bf7ae682b371e7e1d501681b4 /arch/mips/ath79 | |
parent | fe41b466f9f4c45b3368dee4a50d7c77ae7f37f9 (diff) |
MIPS: ath79: Add basic device tree support
Add the bare minimum to load a device tree.
Signed-off-by: Alban Bedel <albeu@free.fr>
Cc: linux-mips@linux-mips.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath79')
-rw-r--r-- | arch/mips/ath79/machtypes.h | 1 | ||||
-rw-r--r-- | arch/mips/ath79/setup.c | 27 |
2 files changed, 27 insertions, 1 deletions
diff --git a/arch/mips/ath79/machtypes.h b/arch/mips/ath79/machtypes.h index 26254058c545..a13db3d15c8f 100644 --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/mips_machine.h> | 15 | #include <asm/mips_machine.h> |
16 | 16 | ||
17 | enum ath79_mach_type { | 17 | enum ath79_mach_type { |
18 | ATH79_MACH_GENERIC_OF = -1, /* Device tree board */ | ||
18 | ATH79_MACH_GENERIC = 0, | 19 | ATH79_MACH_GENERIC = 0, |
19 | ATH79_MACH_AP121, /* Atheros AP121 reference board */ | 20 | ATH79_MACH_AP121, /* Atheros AP121 reference board */ |
20 | ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ | 21 | ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ |
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index 74f1af7eeefc..01a644f174dd 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c | |||
@@ -17,12 +17,16 @@ | |||
17 | #include <linux/bootmem.h> | 17 | #include <linux/bootmem.h> |
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/of_platform.h> | ||
21 | #include <linux/of_fdt.h> | ||
20 | 22 | ||
21 | #include <asm/bootinfo.h> | 23 | #include <asm/bootinfo.h> |
22 | #include <asm/idle.h> | 24 | #include <asm/idle.h> |
23 | #include <asm/time.h> /* for mips_hpt_frequency */ | 25 | #include <asm/time.h> /* for mips_hpt_frequency */ |
24 | #include <asm/reboot.h> /* for _machine_{restart,halt} */ | 26 | #include <asm/reboot.h> /* for _machine_{restart,halt} */ |
25 | #include <asm/mips_machine.h> | 27 | #include <asm/mips_machine.h> |
28 | #include <asm/prom.h> | ||
29 | #include <asm/fw/fw.h> | ||
26 | 30 | ||
27 | #include <asm/mach-ath79/ath79.h> | 31 | #include <asm/mach-ath79/ath79.h> |
28 | #include <asm/mach-ath79/ar71xx_regs.h> | 32 | #include <asm/mach-ath79/ar71xx_regs.h> |
@@ -194,8 +198,19 @@ unsigned int get_c0_compare_int(void) | |||
194 | 198 | ||
195 | void __init plat_mem_setup(void) | 199 | void __init plat_mem_setup(void) |
196 | { | 200 | { |
201 | unsigned long fdt_start; | ||
202 | |||
197 | set_io_port_base(KSEG1); | 203 | set_io_port_base(KSEG1); |
198 | 204 | ||
205 | /* Get the position of the FDT passed by the bootloader */ | ||
206 | fdt_start = fw_getenvl("fdt_start"); | ||
207 | if (fdt_start) | ||
208 | __dt_setup_arch((void *)KSEG0ADDR(fdt_start)); | ||
209 | #ifdef CONFIG_BUILTIN_DTB | ||
210 | else | ||
211 | __dt_setup_arch(__dtb_start); | ||
212 | #endif | ||
213 | |||
199 | ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, | 214 | ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, |
200 | AR71XX_RESET_SIZE); | 215 | AR71XX_RESET_SIZE); |
201 | ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, | 216 | ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, |
@@ -203,7 +218,8 @@ void __init plat_mem_setup(void) | |||
203 | ath79_ddr_ctrl_init(); | 218 | ath79_ddr_ctrl_init(); |
204 | 219 | ||
205 | ath79_detect_sys_type(); | 220 | ath79_detect_sys_type(); |
206 | detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); | 221 | if (mips_machtype != ATH79_MACH_GENERIC_OF) |
222 | detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); | ||
207 | 223 | ||
208 | _machine_restart = ath79_restart; | 224 | _machine_restart = ath79_restart; |
209 | _machine_halt = ath79_halt; | 225 | _machine_halt = ath79_halt; |
@@ -235,6 +251,10 @@ void __init plat_time_init(void) | |||
235 | 251 | ||
236 | static int __init ath79_setup(void) | 252 | static int __init ath79_setup(void) |
237 | { | 253 | { |
254 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
255 | if (mips_machtype == ATH79_MACH_GENERIC_OF) | ||
256 | return 0; | ||
257 | |||
238 | ath79_gpio_init(); | 258 | ath79_gpio_init(); |
239 | ath79_register_uart(); | 259 | ath79_register_uart(); |
240 | ath79_register_wdt(); | 260 | ath79_register_wdt(); |
@@ -246,6 +266,11 @@ static int __init ath79_setup(void) | |||
246 | 266 | ||
247 | arch_initcall(ath79_setup); | 267 | arch_initcall(ath79_setup); |
248 | 268 | ||
269 | void __init device_tree_init(void) | ||
270 | { | ||
271 | unflatten_and_copy_device_tree(); | ||
272 | } | ||
273 | |||
249 | static void __init ath79_generic_init(void) | 274 | static void __init ath79_generic_init(void) |
250 | { | 275 | { |
251 | /* Nothing to do */ | 276 | /* Nothing to do */ |