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
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>
20 #include <asm/system.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;
46 const unsigned int *reg;
47 const unsigned int *prop;
50 * ioremap mpp and gpp registers in case they are later
51 * needed by prpmc2800_reset_board().
53 np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-mpp");
54 reg = of_get_property(np, "reg", NULL);
55 paddr = of_translate_address(np, reg);
57 mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);
59 np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-gpp");
60 reg = of_get_property(np, "reg", NULL);
61 paddr = of_translate_address(np, reg);
63 mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
65 np = of_find_node_by_type(NULL, "cpu");
66 prop = of_get_property(np, "clock-frequency", NULL);
68 loops_per_jiffy = *prop / HZ;
75 printk("Motorola %s\n", prpmc2800_platform_name);
78 static void prpmc2800_reset_board(void)
84 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0);
86 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0, temp);
88 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
90 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
92 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
94 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
96 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2);
98 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2, temp);
100 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
102 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
104 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
106 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
108 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_VALUE_SET, 0x00080004);
111 static void prpmc2800_restart(char *cmd)
113 volatile ulong i = 10000000;
115 prpmc2800_reset_board();
118 panic("restart failed\n");
121 #ifdef CONFIG_NOT_COHERENT_CACHE
122 #define PPRPM2800_COHERENCY_SETTING "off"
124 #define PPRPM2800_COHERENCY_SETTING "on"
127 void prpmc2800_show_cpuinfo(struct seq_file *m)
129 uint memsize = total_memory;
131 seq_printf(m, "Vendor\t\t: Motorola\n");
132 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
133 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING);
137 * Called very early, device-tree isn't unflattened
139 static int __init prpmc2800_probe(void)
141 unsigned long root = of_get_flat_dt_root();
142 unsigned long len = PLATFORM_NAME_MAX;
145 if (!of_flat_dt_is_compatible(root, "motorola,PrPMC2800"))
148 /* Update ppc_md.name with name from dt */
149 m = of_get_flat_dt_prop(root, "model", &len);
151 strncpy(prpmc2800_platform_name, m,
152 min((int)len, PLATFORM_NAME_MAX - 1));
157 define_machine(prpmc2800){
158 .name = prpmc2800_platform_name,
159 .probe = prpmc2800_probe,
160 .setup_arch = prpmc2800_setup_arch,
161 .show_cpuinfo = prpmc2800_show_cpuinfo,
162 .init_IRQ = mv64x60_init_irq,
163 .get_irq = mv64x60_get_irq,
164 .restart = prpmc2800_restart,
165 .calibrate_decr = generic_calibrate_decr,
167 .machine_kexec = default_machine_kexec,
168 .machine_kexec_prepare = default_machine_kexec_prepare,
169 .machine_crash_shutdown = default_machine_crash_shutdown,