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;
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);
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);
62 mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
68 printk("Motorola %s\n", prpmc2800_platform_name);
71 static void prpmc2800_reset_board(void)
77 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0);
79 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0, temp);
81 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
83 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
85 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
87 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
89 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2);
91 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2, temp);
93 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
95 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
97 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
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();
111 panic("restart failed\n");
114 #ifdef CONFIG_NOT_COHERENT_CACHE
115 #define PPRPM2800_COHERENCY_SETTING "off"
117 #define PPRPM2800_COHERENCY_SETTING "on"
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;
135 if (!of_flat_dt_is_compatible(root, "motorola,PrPMC2800"))
138 /* Update ppc_md.name with name from dt */
139 m = of_get_flat_dt_prop(root, "model", &len);
141 strncpy(prpmc2800_platform_name, m,
142 min((int)len, PLATFORM_NAME_MAX - 1));
144 _set_L2CR(_get_L2CR() | L2CR_L2E);
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,
159 .machine_kexec = default_machine_kexec,
160 .machine_kexec_prepare = default_machine_kexec_prepare,
161 .machine_crash_shutdown = default_machine_crash_shutdown,