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