This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / arch / ppc / platforms / lite5200.c
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 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
33 #include <asm/bootinfo.h>
34 #include <asm/io.h>
35 #include <asm/ocp.h>
36 #include <asm/mpc52xx.h>
37
38
39 /* Board data given by U-Boot */
40 bd_t __res;
41 EXPORT_SYMBOL(__res);   /* For modules */
42
43
44 /* ======================================================================== */
45 /* OCP device definition                                                    */
46 /* For board/shared resources like PSCs                                     */
47 /* ======================================================================== */
48 /* Be sure not to load conficting devices : e.g. loading the UART drivers for
49  * PSC1 and then also loading a AC97 for this same PSC.
50  * For details about how to create an entry, look in the doc of the concerned
51  * driver ( eg drivers/serial/mpc52xx_uart.c for the PSC in uart mode )
52  */
53
54 struct ocp_def board_ocp[] = {
55         {
56                 .vendor         = OCP_VENDOR_FREESCALE,
57                 .function       = OCP_FUNC_PSC_UART,
58                 .index          = 0,
59                 .paddr          = MPC52xx_PSC1,
60                 .irq            = MPC52xx_PSC1_IRQ,
61                 .pm             = OCP_CPM_NA,
62         },
63         {       /* Terminating entry */
64                 .vendor         = OCP_VENDOR_INVALID
65         }
66 };
67         
68
69 /* ======================================================================== */
70 /* Platform specific code                                                   */
71 /* ======================================================================== */
72
73 static int
74 icecube_show_cpuinfo(struct seq_file *m)
75 {
76         seq_printf(m, "machine\t\t: Freescale LITE5200\n");
77         return 0;
78 }
79
80 static void __init
81 icecube_setup_arch(void)
82 {
83
84         /* Add board OCP definitions */
85         mpc52xx_add_board_devices(board_ocp);
86 }
87
88 void __init
89 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
90               unsigned long r6, unsigned long r7)
91 {
92         /* Generic MPC52xx platform initialization */
93         /* TODO Create one and move a max of stuff in it.
94            Put this init in the syslib */
95
96         struct bi_record *bootinfo = find_bootinfo();
97
98         if (bootinfo)
99                 parse_bootinfo(bootinfo);
100         else {
101                 /* Load the bd_t board info structure */
102                 if (r3)
103                         memcpy((void*)&__res,(void*)(r3+KERNELBASE),
104                                         sizeof(bd_t));
105
106 #ifdef CONFIG_BLK_DEV_INITRD
107                 /* Load the initrd */
108                 if (r4) {
109                         initrd_start = r4 + KERNELBASE;
110                         initrd_end = r5 + KERNELBASE;
111                 }
112 #endif
113         
114                 /* Load the command line */
115                 if (r6) {
116                         *(char *)(r7+KERNELBASE) = 0;
117                         strcpy(cmd_line, (char *)(r6+KERNELBASE));
118                 }
119         }
120
121         /* BAT setup */
122         mpc52xx_set_bat();
123         
124         /* No ISA bus AFAIK */
125         isa_io_base             = 0;
126         isa_mem_base            = 0;
127
128         /* Setup the ppc_md struct */
129         ppc_md.setup_arch       = icecube_setup_arch;
130         ppc_md.show_cpuinfo     = icecube_show_cpuinfo;
131         ppc_md.show_percpuinfo  = NULL;
132         ppc_md.init_IRQ         = mpc52xx_init_irq;
133         ppc_md.get_irq          = mpc52xx_get_irq;
134
135         ppc_md.find_end_of_memory = mpc52xx_find_end_of_memory;
136         ppc_md.setup_io_mappings  = mpc52xx_map_io;
137
138         ppc_md.restart          = mpc52xx_restart;
139         ppc_md.power_off        = mpc52xx_power_off;
140         ppc_md.halt             = mpc52xx_halt;
141         
142                 /* No time keeper on the IceCube */
143         ppc_md.time_init        = NULL;
144         ppc_md.get_rtc_time     = NULL;
145         ppc_md.set_rtc_time     = NULL;
146         
147         ppc_md.calibrate_decr   = mpc52xx_calibrate_decr;
148 #ifdef CONFIG_SERIAL_TEXT_DEBUG
149         ppc_md.progress         = mpc52xx_progress;
150 #endif
151 }
152