[POWERPC] Use common 52xx of_platform probe code for EFIKA
[linux-2.6/mini2440.git] / arch / powerpc / platforms / 52xx / efika-setup.c
blobd61ce84e201f8f2f4990e21c5724fad9356320a6
1 /*
3 * Efika 5K2 platform setup
4 * Some code really inspired from the lite5200b platform.
6 * Copyright (C) 2006 bplan GmbH
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.
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>
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>
35 #include "efika.h"
37 static void efika_show_cpuinfo(struct seq_file *m)
39 struct device_node *root;
40 const char *revision = NULL;
41 const char *codegendescription = NULL;
42 const char *codegenvendor = NULL;
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);
51 of_node_put(root);
54 if (codegendescription)
55 seq_printf(m, "machine\t\t: %s\n", codegendescription);
56 else
57 seq_printf(m, "machine\t\t: Efika\n");
59 if (revision)
60 seq_printf(m, "revision\t: %s\n", revision);
62 if (codegenvendor)
63 seq_printf(m, "vendor\t\t: %s\n", codegenvendor);
65 of_node_put(root);
68 static void __init efika_setup_arch(void)
70 rtas_initialize();
72 #ifdef CONFIG_BLK_DEV_INITRD
73 initrd_below_start_ok = 1;
75 if (initrd_start)
76 ROOT_DEV = Root_RAM0;
77 else
78 #endif
79 ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
81 efika_pcisetup();
83 if (ppc_md.progress)
84 ppc_md.progress("Linux/PPC " UTS_RELEASE " running on Efika ;-)\n", 0x0);
87 static int __init efika_probe(void)
89 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
90 "model", NULL);
92 if (model == NULL)
93 return 0;
94 if (strcmp(model, "EFIKA5K2"))
95 return 0;
97 ISA_DMA_THRESHOLD = ~0L;
98 DMA_MODE_READ = 0x44;
99 DMA_MODE_WRITE = 0x48;
101 return 1;
104 define_machine(efika)
106 .name = EFIKA_PLATFORM_NAME,
107 .probe = efika_probe,
108 .setup_arch = efika_setup_arch,
109 .init = mpc52xx_declare_of_platform_devices,
110 .show_cpuinfo = efika_show_cpuinfo,
111 .init_IRQ = mpc52xx_init_irq,
112 .get_irq = mpc52xx_get_irq,
113 .restart = rtas_restart,
114 .power_off = rtas_power_off,
115 .halt = rtas_halt,
116 .set_rtc_time = rtas_set_rtc_time,
117 .get_rtc_time = rtas_get_rtc_time,
118 .progress = rtas_progress,
119 .get_boot_time = rtas_get_boot_time,
120 .calibrate_decr = generic_calibrate_decr,
121 .phys_mem_access_prot = pci_phys_mem_access_prot,