blob: 6e522fefc26f779c17b62bbbd96ae5c7eba0169b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Xilinx ML300 evaluation board initialization
3 *
4 * Author: MontaVista Software, Inc.
5 * source@mvista.com
6 *
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.
10 */
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#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>
Grant C. Likelye27db622006-01-19 01:13:03 -070017#include <linux/serial_8250.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/serialP.h>
19#include <asm/io.h>
20#include <asm/machdep.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Grant C. Likelye27db622006-01-19 01:13:03 -070022#include <syslib/gen550.h>
Grant Likely8c38fc2b2007-04-28 05:50:02 +100023#include <syslib/virtex_devices.h>
Grant C. Likelye27db622006-01-19 01:13:03 -070024#include <platforms/4xx/xparameters/xparameters.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26/*
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:
30 *
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
36 * parse_bootinfo
37 * find_bootinfo
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
46 * #endif
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
54 */
55
Grant Likely5ff084f2007-04-28 05:50:00 +100056const char* virtex_machine_name = "ML300 Reference Design";
Grant C. Likelye27db622006-01-19 01:13:03 -070057
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059static volatile unsigned *powerdown_base =
60 (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
61
62static void
63xilinx_power_off(void)
64{
65 local_irq_disable();
66 out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
67 while (1) ;
68}
69#endif
70
71void __init
72ml300_map_io(void)
73{
74 ppc4xx_map_io();
75
76#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
77 powerdown_base = ioremap((unsigned long) powerdown_base,
78 XPAR_POWER_0_POWERDOWN_HIGHADDR -
79 XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
80#endif
81}
82
Linus Torvalds1da177e2005-04-16 15:20:36 -070083void __init
84ml300_setup_arch(void)
85{
Grant Likely8c38fc2b2007-04-28 05:50:02 +100086 virtex_early_serial_map();
Grant C. Likelye27db622006-01-19 01:13:03 -070087 ppc4xx_setup_arch(); /* calls ppc4xx_find_bridges() */
Linus Torvalds1da177e2005-04-16 15:20:36 -070088
89 /* Identify the system */
Grant Likely8c38fc2b2007-04-28 05:50:02 +100090 printk(KERN_INFO "Xilinx ML300 Reference System (Virtex-II Pro)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070091}
92
93/* Called after board_setup_irq from ppc4xx_init_IRQ(). */
94void __init
95ml300_init_irq(void)
96{
97 ppc4xx_init_IRQ();
98}
99
100void __init
101platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
102 unsigned long r6, unsigned long r7)
103{
104 ppc4xx_init(r3, r4, r5, r6, r7);
105
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 ppc_md.setup_arch = ml300_setup_arch;
107 ppc_md.setup_io_mappings = ml300_map_io;
108 ppc_md.init_IRQ = ml300_init_irq;
109
110#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
111 ppc_md.power_off = xilinx_power_off;
112#endif
113
114#ifdef CONFIG_KGDB
Grant Likely8c38fc2b2007-04-28 05:50:02 +1000115 ppc_md.early_serial_map = virtex_early_serial_map;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116#endif
117}
118