Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / arch / ppc / platforms / 4xx / xilinx_ml403.c
1 /*
2  * Xilinx ML403 evaluation board initialization
3  *
4  * Author: Grant Likely <grant.likely@secretlab.ca>
5  *
6  * 2005-2007 (c) Secret Lab Technologies Ltd.
7  * 2002-2004 (c) MontaVista Software, Inc.
8  *
9  * This file is licensed under the terms of the GNU General Public License
10  * version 2.  This program is licensed "as is" without any warranty of any
11  * kind, whether express or implied.
12  */
13
14 #include <linux/init.h>
15 #include <linux/irq.h>
16 #include <linux/tty.h>
17 #include <linux/serial.h>
18 #include <linux/serial_core.h>
19 #include <linux/serial_8250.h>
20 #include <linux/serialP.h>
21 #include <asm/io.h>
22 #include <asm/machdep.h>
23
24 #include <syslib/gen550.h>
25 #include <syslib/virtex_devices.h>
26 #include <platforms/4xx/xparameters/xparameters.h>
27
28 /*
29  * As an overview of how the following functions (platform_init,
30  * ml403_map_io, ml403_setup_arch and ml403_init_IRQ) fit into the
31  * kernel startup procedure, here's a call tree:
32  *
33  * start_here                                   arch/ppc/kernel/head_4xx.S
34  *  early_init                                  arch/ppc/kernel/setup.c
35  *  machine_init                                arch/ppc/kernel/setup.c
36  *    platform_init                             this file
37  *      ppc4xx_init                             arch/ppc/syslib/ppc4xx_setup.c
38  *        parse_bootinfo
39  *          find_bootinfo
40  *        "setup some default ppc_md pointers"
41  *  MMU_init                                    arch/ppc/mm/init.c
42  *    *ppc_md.setup_io_mappings == ml403_map_io this file
43  *      ppc4xx_map_io                           arch/ppc/syslib/ppc4xx_setup.c
44  *  start_kernel                                init/main.c
45  *    setup_arch                                arch/ppc/kernel/setup.c
46  * #if defined(CONFIG_KGDB)
47  *      *ppc_md.kgdb_map_scc() == gen550_kgdb_map_scc
48  * #endif
49  *      *ppc_md.setup_arch == ml403_setup_arch  this file
50  *        ppc4xx_setup_arch                     arch/ppc/syslib/ppc4xx_setup.c
51  *          ppc4xx_find_bridges                 arch/ppc/syslib/ppc405_pci.c
52  *    init_IRQ                                  arch/ppc/kernel/irq.c
53  *      *ppc_md.init_IRQ == ml403_init_IRQ      this file
54  *        ppc4xx_init_IRQ                       arch/ppc/syslib/ppc4xx_setup.c
55  *          ppc4xx_pic_init                     arch/ppc/syslib/xilinx_pic.c
56  */
57
58 const char* virtex_machine_name = "ML403 Reference Design";
59
60 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
61 static volatile unsigned *powerdown_base =
62     (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
63
64 static void
65 xilinx_power_off(void)
66 {
67         local_irq_disable();
68         out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
69         while (1) ;
70 }
71 #endif
72
73 void __init
74 ml403_map_io(void)
75 {
76         ppc4xx_map_io();
77
78 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
79         powerdown_base = ioremap((unsigned long) powerdown_base,
80                                  XPAR_POWER_0_POWERDOWN_HIGHADDR -
81                                  XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
82 #endif
83 }
84
85 void __init
86 ml403_setup_arch(void)
87 {
88         virtex_early_serial_map();
89         ppc4xx_setup_arch();    /* calls ppc4xx_find_bridges() */
90
91         /* Identify the system */
92         printk(KERN_INFO "Xilinx ML403 Reference System (Virtex-4 FX)\n");
93 }
94
95 /* Called after board_setup_irq from ppc4xx_init_IRQ(). */
96 void __init
97 ml403_init_irq(void)
98 {
99         ppc4xx_init_IRQ();
100 }
101
102 void __init
103 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
104               unsigned long r6, unsigned long r7)
105 {
106         ppc4xx_init(r3, r4, r5, r6, r7);
107
108         ppc_md.setup_arch = ml403_setup_arch;
109         ppc_md.setup_io_mappings = ml403_map_io;
110         ppc_md.init_IRQ = ml403_init_irq;
111
112 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
113         ppc_md.power_off = xilinx_power_off;
114 #endif
115
116 #ifdef CONFIG_KGDB
117         ppc_md.early_serial_map = virtex_early_serial_map;
118 #endif
119 }
120