aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lantiq/prom.c
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2012-04-13 14:56:13 -0400
committerRalf Baechle <ralf@linux-mips.org>2012-05-21 09:31:49 -0400
commita0392222d9a374588803454c4d2211108c64d4e4 (patch)
treebad591d5d0d2015f50084b8c5c2480c098def308 /arch/mips/lantiq/prom.c
parentcd93b4895ea51dcd15c96801aa21e71f793e3af3 (diff)
OF: MIPS: lantiq: implement OF support
Activate USE_OF, add a sample DTS file and convert the core soc code to OF. Signed-off-by: John Crispin <blogic@openwrt.org> Cc: linux-mips@linux-mips.org Cc: devicetree-discuss@lists.ozlabs.org Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/3803/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lantiq/prom.c')
-rw-r--r--arch/mips/lantiq/prom.c57
1 files changed, 44 insertions, 13 deletions
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index cd568921f191..413ed53a4ae1 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/export.h> 9#include <linux/export.h>
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/of_platform.h>
11#include <asm/bootinfo.h> 12#include <asm/bootinfo.h>
12#include <asm/time.h> 13#include <asm/time.h>
13 14
@@ -16,13 +17,15 @@
16#include "prom.h" 17#include "prom.h"
17#include "clk.h" 18#include "clk.h"
18 19
19static struct ltq_soc_info soc_info; 20/* access to the ebu needs to be locked between different drivers */
21DEFINE_SPINLOCK(ebu_lock);
22EXPORT_SYMBOL_GPL(ebu_lock);
20 23
21unsigned int ltq_get_cpu_ver(void) 24/*
22{ 25 * this struct is filled by the soc specific detection code and holds
23 return soc_info.rev; 26 * information about the specific soc type, revision and name
24} 27 */
25EXPORT_SYMBOL(ltq_get_cpu_ver); 28static struct ltq_soc_info soc_info;
26 29
27unsigned int ltq_get_soc_type(void) 30unsigned int ltq_get_soc_type(void)
28{ 31{
@@ -57,16 +60,28 @@ static void __init prom_init_cmdline(void)
57 } 60 }
58} 61}
59 62
60void __init prom_init(void) 63void __init plat_mem_setup(void)
61{ 64{
62 struct clk *clk; 65 ioport_resource.start = IOPORT_RESOURCE_START;
66 ioport_resource.end = IOPORT_RESOURCE_END;
67 iomem_resource.start = IOMEM_RESOURCE_START;
68 iomem_resource.end = IOMEM_RESOURCE_END;
69
70 set_io_port_base((unsigned long) KSEG1);
71
72 /*
73 * Load the builtin devicetree. This causes the chosen node to be
74 * parsed resulting in our memory appearing
75 */
76 __dt_setup_arch(&__dtb_start);
77}
63 78
79void __init prom_init(void)
80{
81 /* call the soc specific detetcion code and get it to fill soc_info */
64 ltq_soc_detect(&soc_info); 82 ltq_soc_detect(&soc_info);
65 clk_init(); 83 snprintf(soc_info.sys_type, LTQ_SYS_TYPE_LEN - 1, "%s rev %s",
66 clk = clk_get(0, "cpu"); 84 soc_info.name, soc_info.rev_type);
67 snprintf(soc_info.sys_type, LTQ_SYS_TYPE_LEN - 1, "%s rev1.%d",
68 soc_info.name, soc_info.rev);
69 clk_put(clk);
70 soc_info.sys_type[LTQ_SYS_TYPE_LEN - 1] = '\0'; 85 soc_info.sys_type[LTQ_SYS_TYPE_LEN - 1] = '\0';
71 pr_info("SoC: %s\n", soc_info.sys_type); 86 pr_info("SoC: %s\n", soc_info.sys_type);
72 prom_init_cmdline(); 87 prom_init_cmdline();
@@ -76,3 +91,19 @@ void __init prom_init(void)
76 panic("failed to register_vsmp_smp_ops()"); 91 panic("failed to register_vsmp_smp_ops()");
77#endif 92#endif
78} 93}
94
95int __init plat_of_setup(void)
96{
97 static struct of_device_id of_ids[3];
98
99 if (!of_have_populated_dt())
100 panic("device tree not present");
101
102 strncpy(of_ids[0].compatible, soc_info.compatible,
103 sizeof(of_ids[0].compatible));
104 strncpy(of_ids[1].compatible, "simple-bus",
105 sizeof(of_ids[1].compatible));
106 return of_platform_bus_probe(NULL, of_ids, NULL);
107}
108
109arch_initcall(plat_of_setup);