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>
22 #include <mm/mmu_decl.h>
24 #include <sysdev/mv64x60.h>
26 #define MV64x60_MPP_CNTL_0 0x0000
27 #define MV64x60_MPP_CNTL_2 0x0008
29 #define MV64x60_GPP_IO_CNTL 0x0000
30 #define MV64x60_GPP_LEVEL_CNTL 0x0010
31 #define MV64x60_GPP_VALUE_SET 0x0018
33 #define PLATFORM_NAME_MAX 32
35 static char prpmc2800_platform_name
[PLATFORM_NAME_MAX
];
37 static void __iomem
*mv64x60_mpp_reg_base
;
38 static void __iomem
*mv64x60_gpp_reg_base
;
40 static void __init
prpmc2800_setup_arch(void)
42 struct device_node
*np
;
44 const unsigned int *reg
;
47 * ioremap mpp and gpp registers in case they are later
48 * needed by prpmc2800_reset_board().
50 np
= of_find_compatible_node(NULL
, NULL
, "marvell,mv64360-mpp");
51 reg
= of_get_property(np
, "reg", NULL
);
52 paddr
= of_translate_address(np
, reg
);
54 mv64x60_mpp_reg_base
= ioremap(paddr
, reg
[1]);
56 np
= of_find_compatible_node(NULL
, NULL
, "marvell,mv64360-gpp");
57 reg
= of_get_property(np
, "reg", NULL
);
58 paddr
= of_translate_address(np
, reg
);
60 mv64x60_gpp_reg_base
= ioremap(paddr
, reg
[1]);
66 printk("Motorola %s\n", prpmc2800_platform_name
);
69 static void prpmc2800_reset_board(void)
75 temp
= in_le32(mv64x60_mpp_reg_base
+ MV64x60_MPP_CNTL_0
);
77 out_le32(mv64x60_mpp_reg_base
+ MV64x60_MPP_CNTL_0
, temp
);
79 temp
= in_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_LEVEL_CNTL
);
81 out_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_LEVEL_CNTL
, temp
);
83 temp
= in_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_IO_CNTL
);
85 out_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_IO_CNTL
, temp
);
87 temp
= in_le32(mv64x60_mpp_reg_base
+ MV64x60_MPP_CNTL_2
);
89 out_le32(mv64x60_mpp_reg_base
+ MV64x60_MPP_CNTL_2
, temp
);
91 temp
= in_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_LEVEL_CNTL
);
93 out_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_LEVEL_CNTL
, temp
);
95 temp
= in_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_IO_CNTL
);
97 out_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_IO_CNTL
, temp
);
99 out_le32(mv64x60_gpp_reg_base
+ MV64x60_GPP_VALUE_SET
, 0x00080004);
102 static void prpmc2800_restart(char *cmd
)
104 volatile ulong i
= 10000000;
106 prpmc2800_reset_board();
109 panic("restart failed\n");
112 #ifdef CONFIG_NOT_COHERENT_CACHE
113 #define PPRPM2800_COHERENCY_SETTING "off"
115 #define PPRPM2800_COHERENCY_SETTING "on"
118 void prpmc2800_show_cpuinfo(struct seq_file
*m
)
120 seq_printf(m
, "Vendor\t\t: Motorola\n");
121 seq_printf(m
, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING
);
125 * Called very early, device-tree isn't unflattened
127 static int __init
prpmc2800_probe(void)
129 unsigned long root
= of_get_flat_dt_root();
130 unsigned long len
= PLATFORM_NAME_MAX
;
133 if (!of_flat_dt_is_compatible(root
, "motorola,PrPMC2800"))
136 /* Update ppc_md.name with name from dt */
137 m
= of_get_flat_dt_prop(root
, "model", &len
);
139 strncpy(prpmc2800_platform_name
, m
,
140 min((int)len
, PLATFORM_NAME_MAX
- 1));
142 _set_L2CR(_get_L2CR() | L2CR_L2E
);
146 define_machine(prpmc2800
){
147 .name
= prpmc2800_platform_name
,
148 .probe
= prpmc2800_probe
,
149 .setup_arch
= prpmc2800_setup_arch
,
150 .init_early
= mv64x60_init_early
,
151 .show_cpuinfo
= prpmc2800_show_cpuinfo
,
152 .init_IRQ
= mv64x60_init_irq
,
153 .get_irq
= mv64x60_get_irq
,
154 .restart
= prpmc2800_restart
,
155 .calibrate_decr
= generic_calibrate_decr
,