2 * arch/ppc/platforms/4xx/xilinx_ml300.c
4 * Xilinx ML300 evaluation board initialization
6 * Author: MontaVista Software, Inc.
9 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
14 #include <linux/config.h>
15 #include <linux/init.h>
16 #include <linux/irq.h>
17 #include <linux/tty.h>
18 #include <linux/serial.h>
19 #include <linux/serial_core.h>
20 #include <linux/serial_8250.h>
21 #include <linux/serialP.h>
23 #include <asm/machdep.h>
24 #include <asm/ppc_sys.h>
26 #include <syslib/gen550.h>
27 #include <platforms/4xx/xparameters/xparameters.h>
30 * As an overview of how the following functions (platform_init,
31 * ml300_map_io, ml300_setup_arch and ml300_init_IRQ) fit into the
32 * kernel startup procedure, here's a call tree:
34 * start_here arch/ppc/kernel/head_4xx.S
35 * early_init arch/ppc/kernel/setup.c
36 * machine_init arch/ppc/kernel/setup.c
37 * platform_init this file
38 * ppc4xx_init arch/ppc/syslib/ppc4xx_setup.c
41 * "setup some default ppc_md pointers"
42 * MMU_init arch/ppc/mm/init.c
43 * *ppc_md.setup_io_mappings == ml300_map_io this file
44 * ppc4xx_map_io arch/ppc/syslib/ppc4xx_setup.c
45 * start_kernel init/main.c
46 * setup_arch arch/ppc/kernel/setup.c
47 * #if defined(CONFIG_KGDB)
48 * *ppc_md.kgdb_map_scc() == gen550_kgdb_map_scc
50 * *ppc_md.setup_arch == ml300_setup_arch this file
51 * ppc4xx_setup_arch arch/ppc/syslib/ppc4xx_setup.c
52 * ppc4xx_find_bridges arch/ppc/syslib/ppc405_pci.c
53 * init_IRQ arch/ppc/kernel/irq.c
54 * *ppc_md.init_IRQ == ml300_init_IRQ this file
55 * ppc4xx_init_IRQ arch/ppc/syslib/ppc4xx_setup.c
56 * ppc4xx_pic_init arch/ppc/syslib/xilinx_pic.c
59 /* Board specifications structures */
60 struct ppc_sys_spec *cur_ppc_sys_spec;
61 struct ppc_sys_spec ppc_sys_specs[] = {
63 /* Only one entry, always assume the same design */
64 .ppc_sys_name = "Xilinx ML300 Reference Design",
68 .device_list = (enum ppc_sys_devices[])
75 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
77 static volatile unsigned *powerdown_base =
78 (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
81 xilinx_power_off(void)
84 out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
94 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
95 powerdown_base = ioremap((unsigned long) powerdown_base,
96 XPAR_POWER_0_POWERDOWN_HIGHADDR -
97 XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
101 /* Early serial support functions */
103 ml300_early_serial_init(int num, struct plat_serial8250_port *pdata)
105 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
106 struct uart_port serial_req;
108 memset(&serial_req, 0, sizeof(serial_req));
109 serial_req.mapbase = pdata->mapbase;
110 serial_req.membase = pdata->membase;
111 serial_req.irq = pdata->irq;
112 serial_req.uartclk = pdata->uartclk;
113 serial_req.regshift = pdata->regshift;
114 serial_req.iotype = pdata->iotype;
115 serial_req.flags = pdata->flags;
116 gen550_init(num, &serial_req);
121 ml300_early_serial_map(void)
123 #ifdef CONFIG_SERIAL_8250
124 struct plat_serial8250_port *pdata;
127 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(VIRTEX_UART);
128 while(pdata && pdata->flags)
130 pdata->membase = ioremap(pdata->mapbase, 0x100);
131 ml300_early_serial_init(i, pdata);
135 #endif /* CONFIG_SERIAL_8250 */
139 ml300_setup_arch(void)
141 ml300_early_serial_map();
142 ppc4xx_setup_arch(); /* calls ppc4xx_find_bridges() */
144 /* Identify the system */
145 printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
146 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
149 /* Called after board_setup_irq from ppc4xx_init_IRQ(). */
157 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
158 unsigned long r6, unsigned long r7)
160 ppc4xx_init(r3, r4, r5, r6, r7);
162 identify_ppc_sys_by_id(mfspr(SPRN_PVR));
164 ppc_md.setup_arch = ml300_setup_arch;
165 ppc_md.setup_io_mappings = ml300_map_io;
166 ppc_md.init_IRQ = ml300_init_irq;
168 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
169 ppc_md.power_off = xilinx_power_off;
173 ppc_md.early_serial_map = ml300_early_serial_map;