[IA64] remove dead BIO_VMERGE_BOUNDARY definition
[linux/fpc-iii.git] / arch / powerpc / platforms / embedded6xx / prpmc2800.c
blob4c485e984236d57ed2ae012efbe3ca55df9dad55
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,mv64360-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,mv64360-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 seq_printf(m, "Vendor\t\t: Motorola\n");
123 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING);
127 * Called very early, device-tree isn't unflattened
129 static int __init prpmc2800_probe(void)
131 unsigned long root = of_get_flat_dt_root();
132 unsigned long len = PLATFORM_NAME_MAX;
133 void *m;
135 if (!of_flat_dt_is_compatible(root, "motorola,PrPMC2800"))
136 return 0;
138 /* Update ppc_md.name with name from dt */
139 m = of_get_flat_dt_prop(root, "model", &len);
140 if (m)
141 strncpy(prpmc2800_platform_name, m,
142 min((int)len, PLATFORM_NAME_MAX - 1));
144 _set_L2CR(_get_L2CR() | L2CR_L2E);
145 return 1;
148 define_machine(prpmc2800){
149 .name = prpmc2800_platform_name,
150 .probe = prpmc2800_probe,
151 .setup_arch = prpmc2800_setup_arch,
152 .init_early = mv64x60_init_early,
153 .show_cpuinfo = prpmc2800_show_cpuinfo,
154 .init_IRQ = mv64x60_init_irq,
155 .get_irq = mv64x60_get_irq,
156 .restart = prpmc2800_restart,
157 .calibrate_decr = generic_calibrate_decr,
158 #ifdef CONFIG_KEXEC
159 .machine_kexec = default_machine_kexec,
160 .machine_kexec_prepare = default_machine_kexec_prepare,
161 .machine_crash_shutdown = default_machine_crash_shutdown,
162 #endif