Disintegrate asm/system.h for PowerPC
[linux-2.6.git] / arch / powerpc / platforms / embedded6xx / prpmc2800.c
blobd455f08bea53939e021219d3bb406cf1b18f9dc7
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/time.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;
43 phys_addr_t paddr;
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);
53 of_node_put(np);
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);
59 of_node_put(np);
60 mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
62 #ifdef CONFIG_PCI
63 mv64x60_pci_init();
64 #endif
66 printk("Motorola %s\n", prpmc2800_platform_name);
69 static void prpmc2800_reset_board(void)
71 u32 temp;
73 local_irq_disable();
75 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0);
76 temp &= 0xFFFF0FFF;
77 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0, temp);
79 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
80 temp |= 0x00000004;
81 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
83 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
84 temp |= 0x00000004;
85 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
87 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2);
88 temp &= 0xFFFF0FFF;
89 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2, temp);
91 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
92 temp |= 0x00080000;
93 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
95 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
96 temp |= 0x00080000;
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();
108 while (i-- > 0);
109 panic("restart failed\n");
112 #ifdef CONFIG_NOT_COHERENT_CACHE
113 #define PPRPM2800_COHERENCY_SETTING "off"
114 #else
115 #define PPRPM2800_COHERENCY_SETTING "on"
116 #endif
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;
131 void *m;
133 if (!of_flat_dt_is_compatible(root, "motorola,PrPMC2800"))
134 return 0;
136 /* Update ppc_md.name with name from dt */
137 m = of_get_flat_dt_prop(root, "model", &len);
138 if (m)
139 strncpy(prpmc2800_platform_name, m,
140 min((int)len, PLATFORM_NAME_MAX - 1));
142 _set_L2CR(_get_L2CR() | L2CR_L2E);
143 return 1;
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,