aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorRemi Machet <rmachet@slac.stanford.edu>2008-05-16 15:31:04 -0400
committerPaul Mackerras <paulus@samba.org>2008-06-08 23:42:27 -0400
commit46388c0d88add1c39926cd415039fe931edd5829 (patch)
tree5a7f755de93bb8fc2718f8eb099b0e4247c7d99f /arch/powerpc/platforms
parentc6ec08e03dd06b8dfa3f6d938b0a89c6ed8475c9 (diff)
powerpc: C2K board driver
Support for the C2K cPCI Single Board Computer from GEFanuc (PowerPC MPC7448 with a Marvell MV64460 chipset). All features of the board are not supported yet, but the board boots, flash works, all Ethernet ports are working and PCI devices are all found (USB and SATA on PCI1 do not work yet). Part 3 of 5: driver for the board. At this time it is very generic and similar to its original, the driver for the prpmc2800. Signed-off-by: Remi Machet <rmachet@slac.stanford.edu> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/embedded6xx/Makefile1
-rw-r--r--arch/powerpc/platforms/embedded6xx/c2k.c158
2 files changed, 159 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index 06524d3ffd2e..0773c08bd444 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_LINKSTATION) += linkstation.o ls_uart.o
6obj-$(CONFIG_STORCENTER) += storcenter.o 6obj-$(CONFIG_STORCENTER) += storcenter.o
7obj-$(CONFIG_PPC_HOLLY) += holly.o 7obj-$(CONFIG_PPC_HOLLY) += holly.o
8obj-$(CONFIG_PPC_PRPMC2800) += prpmc2800.o 8obj-$(CONFIG_PPC_PRPMC2800) += prpmc2800.o
9obj-$(CONFIG_PPC_C2K) += c2k.o
diff --git a/arch/powerpc/platforms/embedded6xx/c2k.c b/arch/powerpc/platforms/embedded6xx/c2k.c
new file mode 100644
index 000000000000..d0b25b8c39d1
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/c2k.c
@@ -0,0 +1,158 @@
1/*
2 * Board setup routines for the GEFanuc C2K board
3 *
4 * Author: Remi Machet <rmachet@slac.stanford.edu>
5 *
6 * Originated from prpmc2800.c
7 *
8 * 2008 (c) Stanford University
9 * 2007 (c) MontaVista, Software, Inc.
10 *
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.
14 */
15
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>
22#include <linux/of.h>
23#include <linux/kexec.h>
24
25#include <asm/machdep.h>
26#include <asm/prom.h>
27#include <asm/system.h>
28#include <asm/time.h>
29
30#include <mm/mmu_decl.h>
31
32#include <sysdev/mv64x60.h>
33
34#define MV64x60_MPP_CNTL_0 0x0000
35#define MV64x60_MPP_CNTL_2 0x0008
36
37#define MV64x60_GPP_IO_CNTL 0x0000
38#define MV64x60_GPP_LEVEL_CNTL 0x0010
39#define MV64x60_GPP_VALUE_SET 0x0018
40
41static void __iomem *mv64x60_mpp_reg_base;
42static void __iomem *mv64x60_gpp_reg_base;
43
44static void __init c2k_setup_arch(void)
45{
46 struct device_node *np;
47 phys_addr_t paddr;
48 const unsigned int *reg;
49
50 /*
51 * ioremap mpp and gpp registers in case they are later
52 * needed by c2k_reset_board().
53 */
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);
57 of_node_put(np);
58 mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);
59
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);
63 of_node_put(np);
64 mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
65
66#ifdef CONFIG_PCI
67 mv64x60_pci_init();
68#endif
69}
70
71static void c2k_reset_board(void)
72{
73 u32 temp;
74
75 local_irq_disable();
76
77 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0);
78 temp &= 0xFFFF0FFF;
79 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0, temp);
80
81 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
82 temp |= 0x00000004;
83 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
84
85 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
86 temp |= 0x00000004;
87 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
88
89 temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2);
90 temp &= 0xFFFF0FFF;
91 out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2, temp);
92
93 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);
94 temp |= 0x00080000;
95 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);
96
97 temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);
98 temp |= 0x00080000;
99 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);
100
101 out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_VALUE_SET, 0x00080004);
102}
103
104static void c2k_restart(char *cmd)
105{
106 c2k_reset_board();
107 msleep(100);
108 panic("restart failed\n");
109}
110
111#ifdef CONFIG_NOT_COHERENT_CACHE
112#define COHERENCY_SETTING "off"
113#else
114#define COHERENCY_SETTING "on"
115#endif
116
117void c2k_show_cpuinfo(struct seq_file *m)
118{
119 uint memsize = total_memory;
120
121 seq_printf(m, "Vendor\t\t: GEFanuc\n");
122 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
123 seq_printf(m, "coherency\t: %s\n", COHERENCY_SETTING);
124}
125
126/*
127 * Called very early, device-tree isn't unflattened
128 */
129static int __init c2k_probe(void)
130{
131 unsigned long root = of_get_flat_dt_root();
132
133 if (!of_flat_dt_is_compatible(root, "GEFanuc,C2K"))
134 return 0;
135
136 printk(KERN_INFO "Detected a GEFanuc C2K board\n");
137
138 _set_L2CR(0);
139 _set_L2CR(L2CR_L2E | L2CR_L2PE | L2CR_L2I);
140 return 1;
141}
142
143define_machine(c2k) {
144 .name = "C2K",
145 .probe = c2k_probe,
146 .setup_arch = c2k_setup_arch,
147 .init_early = mv64x60_init_early,
148 .show_cpuinfo = c2k_show_cpuinfo,
149 .init_IRQ = mv64x60_init_irq,
150 .get_irq = mv64x60_get_irq,
151 .restart = c2k_restart,
152 .calibrate_decr = generic_calibrate_decr,
153#ifdef CONFIG_KEXEC
154 .machine_kexec = default_machine_kexec,
155 .machine_kexec_prepare = default_machine_kexec_prepare,
156 .machine_crash_shutdown = default_machine_crash_shutdown,
157#endif
158};