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/init.h>
13 #include <linux/irq.h>
14 #include <linux/tty.h>
15 #include <linux/serial.h>
16 #include <linux/serial_core.h>
17 #include <linux/serial_8250.h>
18 #include <linux/serialP.h>
20 #include <asm/machdep.h>
21 #include <asm/ppc_sys.h>
23 #include <syslib/gen550.h>
24 #include <platforms/4xx/xparameters/xparameters.h>
27 * As an overview of how the following functions (platform_init,
28 * ml300_map_io, ml300_setup_arch and ml300_init_IRQ) fit into the
29 * kernel startup procedure, here's a call tree:
31 * start_here arch/ppc/kernel/head_4xx.S
32 * early_init arch/ppc/kernel/setup.c
33 * machine_init arch/ppc/kernel/setup.c
34 * platform_init this file
35 * ppc4xx_init arch/ppc/syslib/ppc4xx_setup.c
38 * "setup some default ppc_md pointers"
39 * MMU_init arch/ppc/mm/init.c
40 * *ppc_md.setup_io_mappings == ml300_map_io this file
41 * ppc4xx_map_io arch/ppc/syslib/ppc4xx_setup.c
42 * start_kernel init/main.c
43 * setup_arch arch/ppc/kernel/setup.c
44 * #if defined(CONFIG_KGDB)
45 * *ppc_md.kgdb_map_scc() == gen550_kgdb_map_scc
47 * *ppc_md.setup_arch == ml300_setup_arch this file
48 * ppc4xx_setup_arch arch/ppc/syslib/ppc4xx_setup.c
49 * ppc4xx_find_bridges arch/ppc/syslib/ppc405_pci.c
50 * init_IRQ arch/ppc/kernel/irq.c
51 * *ppc_md.init_IRQ == ml300_init_IRQ this file
52 * ppc4xx_init_IRQ arch/ppc/syslib/ppc4xx_setup.c
53 * ppc4xx_pic_init arch/ppc/syslib/xilinx_pic.c
56 /* Board specifications structures */
57 struct ppc_sys_spec *cur_ppc_sys_spec;
58 struct ppc_sys_spec ppc_sys_specs[] = {
60 /* Only one entry, always assume the same design */
61 .ppc_sys_name = "Xilinx ML300 Reference Design",
65 .device_list = (enum ppc_sys_devices[])
72 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
74 static volatile unsigned *powerdown_base =
75 (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
78 xilinx_power_off(void)
81 out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
91 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
92 powerdown_base = ioremap((unsigned long) powerdown_base,
93 XPAR_POWER_0_POWERDOWN_HIGHADDR -
94 XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
98 /* Early serial support functions */
100 ml300_early_serial_init(int num, struct plat_serial8250_port *pdata)
102 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
103 struct uart_port serial_req;
105 memset(&serial_req, 0, sizeof(serial_req));
106 serial_req.mapbase = pdata->mapbase;
107 serial_req.membase = pdata->membase;
108 serial_req.irq = pdata->irq;
109 serial_req.uartclk = pdata->uartclk;
110 serial_req.regshift = pdata->regshift;
111 serial_req.iotype = pdata->iotype;
112 serial_req.flags = pdata->flags;
113 gen550_init(num, &serial_req);
118 ml300_early_serial_map(void)
120 #ifdef CONFIG_SERIAL_8250
121 struct plat_serial8250_port *pdata;
124 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(VIRTEX_UART);
125 while(pdata && pdata->flags)
127 pdata->membase = ioremap(pdata->mapbase, 0x100);
128 ml300_early_serial_init(i, pdata);
132 #endif /* CONFIG_SERIAL_8250 */
136 ml300_setup_arch(void)
138 ml300_early_serial_map();
139 ppc4xx_setup_arch(); /* calls ppc4xx_find_bridges() */
141 /* Identify the system */
142 printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
143 printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
146 /* Called after board_setup_irq from ppc4xx_init_IRQ(). */
154 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
155 unsigned long r6, unsigned long r7)
157 ppc4xx_init(r3, r4, r5, r6, r7);
159 identify_ppc_sys_by_id(mfspr(SPRN_PVR));
161 ppc_md.setup_arch = ml300_setup_arch;
162 ppc_md.setup_io_mappings = ml300_map_io;
163 ppc_md.init_IRQ = ml300_init_irq;
165 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
166 ppc_md.power_off = xilinx_power_off;
170 ppc_md.early_serial_map = ml300_early_serial_map;