2 * Board setup routines for the GEFanuc C2K board
4 * Author: Remi Machet <rmachet@slac.stanford.edu>
6 * Originated from prpmc2800.c
8 * 2008 (c) Stanford University
9 * 2007 (c) MontaVista, Software, Inc.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as published
13 * by the Free Software Foundation.
16 #include <linux/stddef.h>
17 #include <linux/kernel.h>
18 #include <linux/delay.h>
19 #include <linux/interrupt.h>
20 #include <linux/seq_file.h>
21 #include <linux/time.h>
23 #include <linux/kexec.h>
25 #include <asm/machdep.h>
27 #include <asm/system.h>
30 #include <mm/mmu_decl.h>
32 #include <sysdev/mv64x60.h>
34 #define MV64x60_MPP_CNTL_0 0x0000
35 #define MV64x60_MPP_CNTL_2 0x0008
37 #define MV64x60_GPP_IO_CNTL 0x0000
38 #define MV64x60_GPP_LEVEL_CNTL 0x0010
39 #define MV64x60_GPP_VALUE_SET 0x0018
41 static void __iomem *mv64x60_mpp_reg_base;
42 static void __iomem *mv64x60_gpp_reg_base;
44 static void __init c2k_setup_arch(void)
46 struct device_node *np;
48 const unsigned int *reg;
51 * ioremap mpp and gpp registers in case they are later
52 * needed by c2k_reset_board().
54 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-mpp");
55 reg = of_get_property(np, "reg", NULL);
56 paddr = of_translate_address(np, reg);
58 mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);
60 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp");
61 reg = of_get_property(np, "reg", NULL);
62 paddr = of_translate_address(np, reg);
64 mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
71 static void c2k_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 c2k_restart(char *cmd)
108 panic("restart failed\n");
111 #ifdef CONFIG_NOT_COHERENT_CACHE
112 #define COHERENCY_SETTING "off"
114 #define COHERENCY_SETTING "on"
117 void c2k_show_cpuinfo(struct seq_file *m)
119 seq_printf(m, "Vendor\t\t: GEFanuc\n");
120 seq_printf(m, "coherency\t: %s\n", COHERENCY_SETTING);
124 * Called very early, device-tree isn't unflattened
126 static int __init c2k_probe(void)
128 unsigned long root = of_get_flat_dt_root();
130 if (!of_flat_dt_is_compatible(root, "GEFanuc,C2K"))
133 printk(KERN_INFO "Detected a GEFanuc C2K board\n");
136 _set_L2CR(L2CR_L2E | L2CR_L2PE | L2CR_L2I);
140 define_machine(c2k) {
143 .setup_arch = c2k_setup_arch,
144 .init_early = mv64x60_init_early,
145 .show_cpuinfo = c2k_show_cpuinfo,
146 .init_IRQ = mv64x60_init_irq,
147 .get_irq = mv64x60_get_irq,
148 .restart = c2k_restart,
149 .calibrate_decr = generic_calibrate_decr,
151 .machine_kexec = default_machine_kexec,
152 .machine_kexec_prepare = default_machine_kexec_prepare,
153 .machine_crash_shutdown = default_machine_crash_shutdown,