GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / powerpc / platforms / embedded6xx / prpmc2800.c
blob670035f49a6959c72af1b59ad800eab3edf631c6
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>
23 #include <mm/mmu_decl.h>
25 #include <sysdev/mv64x60.h>
27 #define MV64x60_MPP_CNTL_0 0x0000
28 #define MV64x60_MPP_CNTL_2 0x0008
30 #define MV64x60_GPP_IO_CNTL 0x0000
31 #define MV64x60_GPP_LEVEL_CNTL 0x0010
32 #define MV64x60_GPP_VALUE_SET 0x0018
34 #define PLATFORM_NAME_MAX 32
36 static char prpmc2800_platform_name[PLATFORM_NAME_MAX];
38 static void __iomem *mv64x60_mpp_reg_base;
39 static void __iomem *mv64x60_gpp_reg_base;
41 static void __init prpmc2800_setup_arch(void)
43 struct device_node *np;
44 phys_addr_t paddr;
45 const unsigned int *reg;
48 * ioremap mpp and gpp registers in case they are later
49 * needed by prpmc2800_reset_board().
51 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-mpp");
52 reg = of_get_property(np, "reg", NULL);
53 paddr = of_translate_address(np, reg);
54 of_node_put(np);
55 mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);
57 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp");
58 reg = of_get_property(np, "reg", NULL);
59 paddr = of_translate_address(np, reg);
60 of_node_put(np);
61 mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
63 #ifdef CONFIG_PCI
64 mv64x60_pci_init();
65 #endif
67 printk("Motorola %s\n", prpmc2800_platform_name);
70 static void prpmc2800_reset_board(void)
72 u32 temp;
74 local_irq_disable();
76 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0);
77 temp &= 0xFFFF0FFF;
78 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0, temp);
80 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
81 temp |= 0x00000004;
82 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
84 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
85 temp |= 0x00000004;
86 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
88 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2);
89 temp &= 0xFFFF0FFF;
90 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2, temp);
92 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
93 temp |= 0x00080000;
94 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
96 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
97 temp |= 0x00080000;
98 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
100 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_VALUE_SET, 0x00080004);
103 static void prpmc2800_restart(char *cmd)
105 volatile ulong i = 10000000;
107 prpmc2800_reset_board();
109 while (i-- > 0);
110 panic("restart failed\n");
113 #ifdef CONFIG_NOT_COHERENT_CACHE
114 #define PPRPM2800_COHERENCY_SETTING "off"
115 #else
116 #define PPRPM2800_COHERENCY_SETTING "on"
117 #endif
119 void prpmc2800_show_cpuinfo(struct seq_file *m)
121 seq_printf(m, "Vendor\t\t: Motorola\n");
122 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING);
126 * Called very early, device-tree isn't unflattened
128 static int __init prpmc2800_probe(void)
130 unsigned long root = of_get_flat_dt_root();
131 unsigned long len = PLATFORM_NAME_MAX;
132 void *m;
134 if (!of_flat_dt_is_compatible(root, "motorola,PrPMC2800"))
135 return 0;
137 /* Update ppc_md.name with name from dt */
138 m = of_get_flat_dt_prop(root, "model", &len);
139 if (m)
140 strncpy(prpmc2800_platform_name, m,
141 min((int)len, PLATFORM_NAME_MAX - 1));
143 _set_L2CR(_get_L2CR() | L2CR_L2E);
144 return 1;
147 define_machine(prpmc2800){
148 .name = prpmc2800_platform_name,
149 .probe = prpmc2800_probe,
150 .setup_arch = prpmc2800_setup_arch,
151 .init_early = mv64x60_init_early,
152 .show_cpuinfo = prpmc2800_show_cpuinfo,
153 .init_IRQ = mv64x60_init_irq,
154 .get_irq = mv64x60_get_irq,
155 .restart = prpmc2800_restart,
156 .calibrate_decr = generic_calibrate_decr,