initial commit with v2.6.9
[linux-2.6.9-moxart.git] / arch / ppc / platforms / lite5200.c
blobdb6ea440c80a3930bfcc3c45ff53171499caaec9
1 /*
2 * arch/ppc/platforms/lite5200.c
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 )
9 *
10 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
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>
16 * Copyright 2004 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)
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.
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>
33 #include <asm/bootinfo.h>
34 #include <asm/io.h>
35 #include <asm/ocp.h>
36 #include <asm/mpc52xx.h>
39 extern int powersave_nap;
41 /* Board data given by U-Boot */
42 bd_t __res;
43 EXPORT_SYMBOL(__res); /* For modules */
46 /* ======================================================================== */
47 /* OCP device definition */
48 /* For board/shared resources like PSCs */
49 /* ======================================================================== */
50 /* Be sure not to load conficting devices : e.g. loading the UART drivers for
51 * PSC1 and then also loading a AC97 for this same PSC.
52 * For details about how to create an entry, look in the doc of the concerned
53 * driver ( eg drivers/serial/mpc52xx_uart.c for the PSC in uart mode )
56 struct ocp_def board_ocp[] = {
58 .vendor = OCP_VENDOR_FREESCALE,
59 .function = OCP_FUNC_PSC_UART,
60 .index = 0,
61 .paddr = MPC52xx_PSC1,
62 .irq = MPC52xx_PSC1_IRQ,
63 .pm = OCP_CPM_NA,
65 { /* Terminating entry */
66 .vendor = OCP_VENDOR_INVALID
71 /* ======================================================================== */
72 /* Platform specific code */
73 /* ======================================================================== */
75 static int
76 lite5200_show_cpuinfo(struct seq_file *m)
78 seq_printf(m, "machine\t\t: Freescale LITE5200\n");
79 return 0;
82 static void __init
83 lite5200_setup_cpu(void)
85 struct mpc52xx_intr *intr;
87 u32 intr_ctrl;
89 /* Map zones */
90 intr = (struct mpc52xx_intr *)
91 ioremap(MPC52xx_INTR,sizeof(struct mpc52xx_intr));
93 if (!intr) {
94 printk("lite5200.c: Error while mapping INTR during lite5200_setup_cpu\n");
95 goto unmap_regs;
98 /* IRQ[0-3] setup : IRQ0 - Level Active Low */
99 /* IRQ[1-3] - Level Active High */
100 intr_ctrl = in_be32(&intr->ctrl);
101 intr_ctrl &= ~0x00ff0000;
102 intr_ctrl |= 0x00c00000;
103 out_be32(&intr->ctrl, intr_ctrl);
105 /* Unmap reg zone */
106 unmap_regs:
107 if (intr) iounmap(intr);
110 static void __init
111 lite5200_setup_arch(void)
113 /* Add board OCP definitions */
114 mpc52xx_add_board_devices(board_ocp);
116 /* CPU & Port mux setup */
117 lite5200_setup_cpu();
120 void __init
121 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
122 unsigned long r6, unsigned long r7)
124 /* Generic MPC52xx platform initialization */
125 /* TODO Create one and move a max of stuff in it.
126 Put this init in the syslib */
128 struct bi_record *bootinfo = find_bootinfo();
130 if (bootinfo)
131 parse_bootinfo(bootinfo);
132 else {
133 /* Load the bd_t board info structure */
134 if (r3)
135 memcpy((void*)&__res,(void*)(r3+KERNELBASE),
136 sizeof(bd_t));
138 #ifdef CONFIG_BLK_DEV_INITRD
139 /* Load the initrd */
140 if (r4) {
141 initrd_start = r4 + KERNELBASE;
142 initrd_end = r5 + KERNELBASE;
144 #endif
146 /* Load the command line */
147 if (r6) {
148 *(char *)(r7+KERNELBASE) = 0;
149 strcpy(cmd_line, (char *)(r6+KERNELBASE));
153 /* BAT setup */
154 mpc52xx_set_bat();
156 /* No ISA bus AFAIK */
157 isa_io_base = 0;
158 isa_mem_base = 0;
160 /* Powersave */
161 powersave_nap = 1; /* We allow this platform to NAP */
163 /* Setup the ppc_md struct */
164 ppc_md.setup_arch = lite5200_setup_arch;
165 ppc_md.show_cpuinfo = lite5200_show_cpuinfo;
166 ppc_md.show_percpuinfo = NULL;
167 ppc_md.init_IRQ = mpc52xx_init_irq;
168 ppc_md.get_irq = mpc52xx_get_irq;
170 ppc_md.find_end_of_memory = mpc52xx_find_end_of_memory;
171 ppc_md.setup_io_mappings = mpc52xx_map_io;
173 ppc_md.restart = mpc52xx_restart;
174 ppc_md.power_off = mpc52xx_power_off;
175 ppc_md.halt = mpc52xx_halt;
177 /* No time keeper on the LITE5200 */
178 ppc_md.time_init = NULL;
179 ppc_md.get_rtc_time = NULL;
180 ppc_md.set_rtc_time = NULL;
182 ppc_md.calibrate_decr = mpc52xx_calibrate_decr;
183 #ifdef CONFIG_SERIAL_TEXT_DEBUG
184 ppc_md.progress = mpc52xx_progress;
185 #endif