diff options
Diffstat (limited to 'arch/powerpc/platforms/52xx/efika-setup.c')
-rw-r--r-- | arch/powerpc/platforms/52xx/efika-setup.c | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/52xx/efika-setup.c b/arch/powerpc/platforms/52xx/efika-setup.c new file mode 100644 index 000000000000..110c980ed1e0 --- /dev/null +++ b/arch/powerpc/platforms/52xx/efika-setup.c | |||
@@ -0,0 +1,150 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Efika 5K2 platform setup | ||
4 | * Some code really inspired from the lite5200b platform. | ||
5 | * | ||
6 | * Copyright (C) 2006 bplan GmbH | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public License | ||
9 | * version 2. This program is licensed "as is" without any warranty of any | ||
10 | * kind, whether express or implied. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/errno.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/reboot.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/utsrelease.h> | ||
20 | #include <linux/seq_file.h> | ||
21 | #include <linux/root_dev.h> | ||
22 | #include <linux/initrd.h> | ||
23 | #include <linux/timer.h> | ||
24 | #include <linux/pci.h> | ||
25 | |||
26 | #include <asm/pgtable.h> | ||
27 | #include <asm/prom.h> | ||
28 | #include <asm/time.h> | ||
29 | #include <asm/machdep.h> | ||
30 | #include <asm/rtas.h> | ||
31 | #include <asm/of_device.h> | ||
32 | #include <asm/of_platform.h> | ||
33 | #include <asm/mpc52xx.h> | ||
34 | |||
35 | #include "efika.h" | ||
36 | |||
37 | static void efika_show_cpuinfo(struct seq_file *m) | ||
38 | { | ||
39 | struct device_node *root; | ||
40 | const char *revision = NULL; | ||
41 | const char *codegendescription = NULL; | ||
42 | const char *codegenvendor = NULL; | ||
43 | |||
44 | root = of_find_node_by_path("/"); | ||
45 | if (root) { | ||
46 | revision = get_property(root, "revision", NULL); | ||
47 | codegendescription = | ||
48 | get_property(root, "CODEGEN,description", NULL); | ||
49 | codegenvendor = get_property(root, "CODEGEN,vendor", NULL); | ||
50 | |||
51 | of_node_put(root); | ||
52 | } | ||
53 | |||
54 | if (codegendescription) | ||
55 | seq_printf(m, "machine\t\t: %s\n", codegendescription); | ||
56 | else | ||
57 | seq_printf(m, "machine\t\t: Efika\n"); | ||
58 | |||
59 | if (revision) | ||
60 | seq_printf(m, "revision\t: %s\n", revision); | ||
61 | |||
62 | if (codegenvendor) | ||
63 | seq_printf(m, "vendor\t\t: %s\n", codegenvendor); | ||
64 | |||
65 | of_node_put(root); | ||
66 | } | ||
67 | |||
68 | static void __init efika_setup_arch(void) | ||
69 | { | ||
70 | rtas_initialize(); | ||
71 | |||
72 | #ifdef CONFIG_BLK_DEV_INITRD | ||
73 | initrd_below_start_ok = 1; | ||
74 | |||
75 | if (initrd_start) | ||
76 | ROOT_DEV = Root_RAM0; | ||
77 | else | ||
78 | #endif | ||
79 | ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */ | ||
80 | |||
81 | efika_pcisetup(); | ||
82 | |||
83 | if (ppc_md.progress) | ||
84 | ppc_md.progress("Linux/PPC " UTS_RELEASE " runnung on Efika ;-)\n", 0x0); | ||
85 | } | ||
86 | |||
87 | static void __init efika_init(void) | ||
88 | { | ||
89 | struct device_node *np; | ||
90 | struct device_node *cnp = NULL; | ||
91 | const u32 *base; | ||
92 | |||
93 | /* Find every child of the SOC node and add it to of_platform */ | ||
94 | np = of_find_node_by_name(NULL, "builtin"); | ||
95 | if (np) { | ||
96 | char name[BUS_ID_SIZE]; | ||
97 | while ((cnp = of_get_next_child(np, cnp))) { | ||
98 | strcpy(name, cnp->name); | ||
99 | |||
100 | base = get_property(cnp, "reg", NULL); | ||
101 | if (base == NULL) | ||
102 | continue; | ||
103 | |||
104 | snprintf(name+strlen(name), BUS_ID_SIZE, "@%x", *base); | ||
105 | of_platform_device_create(cnp, name, NULL); | ||
106 | |||
107 | printk(KERN_INFO EFIKA_PLATFORM_NAME" : Added %s (type '%s' at '%s') to the known devices\n", name, cnp->type, cnp->full_name); | ||
108 | } | ||
109 | } | ||
110 | |||
111 | if (ppc_md.progress) | ||
112 | ppc_md.progress(" Have fun with your Efika! ", 0x7777); | ||
113 | } | ||
114 | |||
115 | static int __init efika_probe(void) | ||
116 | { | ||
117 | char *model = of_get_flat_dt_prop(of_get_flat_dt_root(), | ||
118 | "model", NULL); | ||
119 | |||
120 | if (model == NULL) | ||
121 | return 0; | ||
122 | if (strcmp(model, "EFIKA5K2")) | ||
123 | return 0; | ||
124 | |||
125 | ISA_DMA_THRESHOLD = ~0L; | ||
126 | DMA_MODE_READ = 0x44; | ||
127 | DMA_MODE_WRITE = 0x48; | ||
128 | |||
129 | return 1; | ||
130 | } | ||
131 | |||
132 | define_machine(efika) | ||
133 | { | ||
134 | .name = EFIKA_PLATFORM_NAME, | ||
135 | .probe = efika_probe, | ||
136 | .setup_arch = efika_setup_arch, | ||
137 | .init = efika_init, | ||
138 | .show_cpuinfo = efika_show_cpuinfo, | ||
139 | .init_IRQ = mpc52xx_init_irq, | ||
140 | .get_irq = mpc52xx_get_irq, | ||
141 | .restart = rtas_restart, | ||
142 | .power_off = rtas_power_off, | ||
143 | .halt = rtas_halt, | ||
144 | .set_rtc_time = rtas_set_rtc_time, | ||
145 | .get_rtc_time = rtas_get_rtc_time, | ||
146 | .progress = rtas_progress, | ||
147 | .get_boot_time = rtas_get_boot_time, | ||
148 | .calibrate_decr = generic_calibrate_decr, | ||
149 | .phys_mem_access_prot = pci_phys_mem_access_prot, | ||
150 | }; | ||