[POWERPC] Remove old includes from arch/ppc
[linux-2.6/mini2440.git] / arch / powerpc / platforms / embedded6xx / prpmc2800.c
blob54675648d6deb5482c442c471357805e14d1534a
1 /*
2 * Board setup routines for the Motorola PrPMC2800
4 * Author: Dale Farnsworth <dale@farnsworth.org>
6 * 2007 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 #include <linux/delay.h>
15 #include <linux/interrupt.h>
16 #include <linux/seq_file.h>
18 #include <asm/machdep.h>
19 #include <asm/prom.h>
20 #include <asm/system.h>
21 #include <asm/time.h>
22 #include <asm/kexec.h>
24 #include <mm/mmu_decl.h>
26 #include <sysdev/mv64x60.h>
28 #define MV64x60_MPP_CNTL_0 0x0000
29 #define MV64x60_MPP_CNTL_2 0x0008
31 #define MV64x60_GPP_IO_CNTL 0x0000
32 #define MV64x60_GPP_LEVEL_CNTL 0x0010
33 #define MV64x60_GPP_VALUE_SET 0x0018
35 #define PLATFORM_NAME_MAX 32
37 static char prpmc2800_platform_name[PLATFORM_NAME_MAX];
39 static void __iomem *mv64x60_mpp_reg_base;
40 static void __iomem *mv64x60_gpp_reg_base;
42 static void __init prpmc2800_setup_arch(void)
44 struct device_node *np;
45 phys_addr_t paddr;
46 const unsigned int *reg;
49 * ioremap mpp and gpp registers in case they are later
50 * needed by prpmc2800_reset_board().
52 np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-mpp");
53 reg = of_get_property(np, "reg", NULL);
54 paddr = of_translate_address(np, reg);
55 of_node_put(np);
56 mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);
58 np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-gpp");
59 reg = of_get_property(np, "reg", NULL);
60 paddr = of_translate_address(np, reg);
61 of_node_put(np);
62 mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
64 #ifdef CONFIG_PCI
65 mv64x60_pci_init();
66 #endif
68 printk("Motorola %s\n", prpmc2800_platform_name);
71 static void prpmc2800_reset_board(void)
73 u32 temp;
75 local_irq_disable();
77 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0);
78 temp &= 0xFFFF0FFF;
79 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0, temp);
81 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
82 temp |= 0x00000004;
83 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
85 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
86 temp |= 0x00000004;
87 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
89 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2);
90 temp &= 0xFFFF0FFF;
91 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2, temp);
93 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
94 temp |= 0x00080000;
95 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
97 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
98 temp |= 0x00080000;
99 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
101 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_VALUE_SET, 0x00080004);
104 static void prpmc2800_restart(char *cmd)
106 volatile ulong i = 10000000;
108 prpmc2800_reset_board();
110 while (i-- > 0);
111 panic("restart failed\n");
114 #ifdef CONFIG_NOT_COHERENT_CACHE
115 #define PPRPM2800_COHERENCY_SETTING "off"
116 #else
117 #define PPRPM2800_COHERENCY_SETTING "on"
118 #endif
120 void prpmc2800_show_cpuinfo(struct seq_file *m)
122 uint memsize = total_memory;
124 seq_printf(m, "Vendor\t\t: Motorola\n");
125 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
126 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING);
130 * Called very early, device-tree isn't unflattened
132 static int __init prpmc2800_probe(void)
134 unsigned long root = of_get_flat_dt_root();
135 unsigned long len = PLATFORM_NAME_MAX;
136 void *m;
138 if (!of_flat_dt_is_compatible(root, "motorola,PrPMC2800"))
139 return 0;
141 /* Update ppc_md.name with name from dt */
142 m = of_get_flat_dt_prop(root, "model", &len);
143 if (m)
144 strncpy(prpmc2800_platform_name, m,
145 min((int)len, PLATFORM_NAME_MAX - 1));
147 return 1;
150 define_machine(prpmc2800){
151 .name = prpmc2800_platform_name,
152 .probe = prpmc2800_probe,
153 .setup_arch = prpmc2800_setup_arch,
154 .show_cpuinfo = prpmc2800_show_cpuinfo,
155 .init_IRQ = mv64x60_init_irq,
156 .get_irq = mv64x60_get_irq,
157 .restart = prpmc2800_restart,
158 .calibrate_decr = generic_calibrate_decr,
159 #ifdef CONFIG_KEXEC
160 .machine_kexec = default_machine_kexec,
161 .machine_kexec_prepare = default_machine_kexec_prepare,
162 .machine_crash_shutdown = default_machine_crash_shutdown,
163 #endif