2 * Xilinx ML300 evaluation board initialization
4 * Author: MontaVista Software, Inc.
7 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is licensed
9 * "as is" without any warranty of any kind, whether express or implied.
12 #include <linux/config.h>
13 #include <linux/init.h>
14 #include <linux/irq.h>
15 #include <linux/tty.h>
16 #include <linux/serial.h>
17 #include <linux/serial_core.h>
18 #include <linux/serial_8250.h>
19 #include <linux/serialP.h>
21 #include <asm/machdep.h>
22 #include <asm/ppc_sys.h>
24 #include <syslib/gen550.h>
25 #include <platforms/4xx/xparameters/xparameters.h>
28 * As an overview of how the following functions (platform_init,
29 * ml300_map_io, ml300_setup_arch and ml300_init_IRQ) fit into the
30 * kernel startup procedure, here's a call tree:
32 * start_here arch/ppc/kernel/head_4xx.S
33 * early_init arch/ppc/kernel/setup.c
34 * machine_init arch/ppc/kernel/setup.c
35 * platform_init this file
36 * ppc4xx_init arch/ppc/syslib/ppc4xx_setup.c
39 * "setup some default ppc_md pointers"
40 * MMU_init arch/ppc/mm/init.c
41 * *ppc_md.setup_io_mappings == ml300_map_io this file
42 * ppc4xx_map_io arch/ppc/syslib/ppc4xx_setup.c
43 * start_kernel init/main.c
44 * setup_arch arch/ppc/kernel/setup.c
45 * #if defined(CONFIG_KGDB)
46 * *ppc_md.kgdb_map_scc() == gen550_kgdb_map_scc
48 * *ppc_md.setup_arch == ml300_setup_arch this file
49 * ppc4xx_setup_arch arch/ppc/syslib/ppc4xx_setup.c
50 * ppc4xx_find_bridges arch/ppc/syslib/ppc405_pci.c
51 * init_IRQ arch/ppc/kernel/irq.c
52 * *ppc_md.init_IRQ == ml300_init_IRQ this file
53 * ppc4xx_init_IRQ arch/ppc/syslib/ppc4xx_setup.c
54 * ppc4xx_pic_init arch/ppc/syslib/xilinx_pic.c
57 /* Board specifications structures */
58 struct ppc_sys_spec *cur_ppc_sys_spec;
59 struct ppc_sys_spec ppc_sys_specs[] = {
61 /* Only one entry, always assume the same design */
62 .ppc_sys_name = "Xilinx ML300 Reference Design",
66 .device_list = (enum ppc_sys_devices[])
73 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
75 static volatile unsigned *powerdown_base =
76 (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
79 xilinx_power_off(void)
82 out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
92 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
93 powerdown_base = ioremap((unsigned long) powerdown_base,
94 XPAR_POWER_0_POWERDOWN_HIGHADDR -
95 XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
99 /* Early serial support functions */
101 ml300_early_serial_init(int num, struct plat_serial8250_port *pdata)
103 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
104 struct uart_port serial_req;
106 memset(&serial_req, 0, sizeof(serial_req));
107 serial_req.mapbase = pdata->mapbase;
108 serial_req.membase = pdata->membase;
109 serial_req.irq = pdata->irq;
110 serial_req.uartclk = pdata->uartclk;
111 serial_req.regshift = pdata->regshift;
112 serial_req.iotype = pdata->iotype;
113 serial_req.flags = pdata->flags;
114 gen550_init(num, &serial_req);
119 ml300_early_serial_map(void)
121 #ifdef CONFIG_SERIAL_8250
122 struct plat_serial8250_port *pdata;
125 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(VIRTEX_UART);
126 while(pdata && pdata->flags)
128 pdata->membase = ioremap(pdata->mapbase, 0x100);
129 ml300_early_serial_init(i, pdata);
133 #endif /* CONFIG_SERIAL_8250 */
137 ml300_setup_arch(void)
139 ml300_early_serial_map();
140 ppc4xx_setup_arch(); /* calls ppc4xx_find_bridges() */
142 /* Identify the system */
143 printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
144 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
147 /* Called after board_setup_irq from ppc4xx_init_IRQ(). */
155 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
156 unsigned long r6, unsigned long r7)
158 ppc4xx_init(r3, r4, r5, r6, r7);
160 identify_ppc_sys_by_id(mfspr(SPRN_PVR));
162 ppc_md.setup_arch = ml300_setup_arch;
163 ppc_md.setup_io_mappings = ml300_map_io;
164 ppc_md.init_IRQ = ml300_init_irq;
166 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
167 ppc_md.power_off = xilinx_power_off;
171 ppc_md.early_serial_map = ml300_early_serial_map;