aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/platforms/lite5200.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ppc/platforms/lite5200.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/ppc/platforms/lite5200.c')
-rw-r--r--arch/ppc/platforms/lite5200.c236
1 files changed, 236 insertions, 0 deletions
diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
new file mode 100644
index 000000000000..b604cf8b3cae
--- /dev/null
+++ b/arch/ppc/platforms/lite5200.c
@@ -0,0 +1,236 @@
1/*
2 * arch/ppc/platforms/lite5200.c
3 *
4 * Platform support file for the Freescale LITE5200 based on MPC52xx.
5 * A maximum of this file should be moved to syslib/mpc52xx_?????
6 * so that new platform based on MPC52xx need a minimal platform file
7 * ( avoid code duplication )
8 *
9 *
10 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
11 *
12 * Based on the 2.4 code written by Kent Borg,
13 * Dale Farnsworth <dale.farnsworth@mvista.com> and
14 * Wolfgang Denk <wd@denx.de>
15 *
16 * Copyright 2004-2005 Sylvain Munaut <tnt@246tNt.com>
17 * Copyright 2003 Motorola Inc.
18 * Copyright 2003 MontaVista Software Inc.
19 * Copyright 2003 DENX Software Engineering (wd@denx.de)
20 *
21 * This file is licensed under the terms of the GNU General Public License
22 * version 2. This program is licensed "as is" without any warranty of any
23 * kind, whether express or implied.
24 */
25
26#include <linux/config.h>
27#include <linux/initrd.h>
28#include <linux/seq_file.h>
29#include <linux/kdev_t.h>
30#include <linux/root_dev.h>
31#include <linux/console.h>
32#include <linux/module.h>
33
34#include <asm/bootinfo.h>
35#include <asm/io.h>
36#include <asm/mpc52xx.h>
37#include <asm/ppc_sys.h>
38
39#include <syslib/mpc52xx_pci.h>
40
41
42extern int powersave_nap;
43
44/* Board data given by U-Boot */
45bd_t __res;
46EXPORT_SYMBOL(__res); /* For modules */
47
48
49/* ======================================================================== */
50/* Platform specific code */
51/* ======================================================================== */
52
53/* Supported PSC function in "preference" order */
54struct mpc52xx_psc_func mpc52xx_psc_functions[] = {
55 { .id = 0,
56 .func = "uart",
57 },
58 { .id = -1, /* End entry */
59 .func = NULL,
60 }
61 };
62
63
64static int
65lite5200_show_cpuinfo(struct seq_file *m)
66{
67 seq_printf(m, "machine\t\t: Freescale LITE5200\n");
68 return 0;
69}
70
71#ifdef CONFIG_PCI
72static int
73lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
74{
75 return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
76}
77#endif
78
79static void __init
80lite5200_setup_cpu(void)
81{
82 struct mpc52xx_cdm __iomem *cdm;
83 struct mpc52xx_gpio __iomem *gpio;
84 struct mpc52xx_intr __iomem *intr;
85 struct mpc52xx_xlb __iomem *xlb;
86
87 u32 port_config;
88 u32 intr_ctrl;
89
90 /* Map zones */
91 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
92 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
93 xlb = ioremap(MPC52xx_PA(MPC52xx_XLB_OFFSET), MPC52xx_XLB_SIZE);
94 intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE);
95
96 if (!cdm || !gpio || !xlb || !intr) {
97 printk("lite5200.c: Error while mapping CDM/GPIO/XLB/INTR during"
98 "lite5200_setup_cpu\n");
99 goto unmap_regs;
100 }
101
102 /* Use internal 48 Mhz */
103 out_8(&cdm->ext_48mhz_en, 0x00);
104 out_8(&cdm->fd_enable, 0x01);
105 if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */
106 out_be16(&cdm->fd_counters, 0x0001);
107 else
108 out_be16(&cdm->fd_counters, 0x5555);
109
110 /* Get port mux config */
111 port_config = in_be32(&gpio->port_config);
112
113 /* 48Mhz internal, pin is GPIO */
114 port_config &= ~0x00800000;
115
116 /* USB port */
117 port_config &= ~0x00007000; /* Differential mode - USB1 only */
118 port_config |= 0x00001000;
119
120 /* Commit port config */
121 out_be32(&gpio->port_config, port_config);
122
123 /* Configure the XLB Arbiter */
124 out_be32(&xlb->master_pri_enable, 0xff);
125 out_be32(&xlb->master_priority, 0x11111111);
126
127 /* Enable ram snooping for 1GB window */
128 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
129 out_be32(&xlb->snoop_window, MPC52xx_PCI_TARGET_MEM | 0x1d);
130
131 /* IRQ[0-3] setup : IRQ0 - Level Active Low */
132 /* IRQ[1-3] - Level Active High */
133 intr_ctrl = in_be32(&intr->ctrl);
134 intr_ctrl &= ~0x00ff0000;
135 intr_ctrl |= 0x00c00000;
136 out_be32(&intr->ctrl, intr_ctrl);
137
138 /* Unmap reg zone */
139unmap_regs:
140 if (cdm) iounmap(cdm);
141 if (gpio) iounmap(gpio);
142 if (xlb) iounmap(xlb);
143 if (intr) iounmap(intr);
144}
145
146static void __init
147lite5200_setup_arch(void)
148{
149 /* CPU & Port mux setup */
150 lite5200_setup_cpu();
151
152#ifdef CONFIG_PCI
153 /* PCI Bridge setup */
154 mpc52xx_find_bridges();
155#endif
156}
157
158void __init
159platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
160 unsigned long r6, unsigned long r7)
161{
162 /* Generic MPC52xx platform initialization */
163 /* TODO Create one and move a max of stuff in it.
164 Put this init in the syslib */
165
166 struct bi_record *bootinfo = find_bootinfo();
167
168 if (bootinfo)
169 parse_bootinfo(bootinfo);
170 else {
171 /* Load the bd_t board info structure */
172 if (r3)
173 memcpy((void*)&__res,(void*)(r3+KERNELBASE),
174 sizeof(bd_t));
175
176#ifdef CONFIG_BLK_DEV_INITRD
177 /* Load the initrd */
178 if (r4) {
179 initrd_start = r4 + KERNELBASE;
180 initrd_end = r5 + KERNELBASE;
181 }
182#endif
183
184 /* Load the command line */
185 if (r6) {
186 *(char *)(r7+KERNELBASE) = 0;
187 strcpy(cmd_line, (char *)(r6+KERNELBASE));
188 }
189 }
190
191 /* PPC Sys identification */
192 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
193
194 /* BAT setup */
195 mpc52xx_set_bat();
196
197 /* No ISA bus by default */
198 isa_io_base = 0;
199 isa_mem_base = 0;
200
201 /* Powersave */
202 /* This is provided as an example on how to do it. But you
203 need to be aware that NAP disable bus snoop and that may
204 be required for some devices to work properly, like USB ... */
205 /* powersave_nap = 1; */
206
207
208 /* Setup the ppc_md struct */
209 ppc_md.setup_arch = lite5200_setup_arch;
210 ppc_md.show_cpuinfo = lite5200_show_cpuinfo;
211 ppc_md.show_percpuinfo = NULL;
212 ppc_md.init_IRQ = mpc52xx_init_irq;
213 ppc_md.get_irq = mpc52xx_get_irq;
214
215#ifdef CONFIG_PCI
216 ppc_md.pci_map_irq = lite5200_map_irq;
217#endif
218
219 ppc_md.find_end_of_memory = mpc52xx_find_end_of_memory;
220 ppc_md.setup_io_mappings = mpc52xx_map_io;
221
222 ppc_md.restart = mpc52xx_restart;
223 ppc_md.power_off = mpc52xx_power_off;
224 ppc_md.halt = mpc52xx_halt;
225
226 /* No time keeper on the LITE5200 */
227 ppc_md.time_init = NULL;
228 ppc_md.get_rtc_time = NULL;
229 ppc_md.set_rtc_time = NULL;
230
231 ppc_md.calibrate_decr = mpc52xx_calibrate_decr;
232#ifdef CONFIG_SERIAL_TEXT_DEBUG
233 ppc_md.progress = mpc52xx_progress;
234#endif
235}
236