Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Grant C. Likely | e27db62 | 2006-01-19 01:13:03 -0700 | [diff] [blame] | 17 | #include <linux/serial_8250.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/serialP.h> |
| 19 | #include <asm/io.h> |
| 20 | #include <asm/machdep.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Grant C. Likely | e27db62 | 2006-01-19 01:13:03 -0700 | [diff] [blame] | 22 | #include <syslib/gen550.h> |
Grant Likely | 8c38fc2b | 2007-04-28 05:50:02 +1000 | [diff] [blame] | 23 | #include <syslib/virtex_devices.h> |
Grant C. Likely | e27db62 | 2006-01-19 01:13:03 -0700 | [diff] [blame] | 24 | #include <platforms/4xx/xparameters/xparameters.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 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 Likely | 5ff084f | 2007-04-28 05:50:00 +1000 | [diff] [blame] | 56 | const char* virtex_machine_name = "ML300 Reference Design"; |
Grant C. Likely | e27db62 | 2006-01-19 01:13:03 -0700 | [diff] [blame] | 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | static volatile unsigned *powerdown_base = |
| 60 | (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR; |
| 61 | |
| 62 | static void |
| 63 | xilinx_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 | |
| 71 | void __init |
| 72 | ml300_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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | void __init |
| 84 | ml300_setup_arch(void) |
| 85 | { |
Grant Likely | 8c38fc2b | 2007-04-28 05:50:02 +1000 | [diff] [blame] | 86 | virtex_early_serial_map(); |
Grant C. Likely | e27db62 | 2006-01-19 01:13:03 -0700 | [diff] [blame] | 87 | ppc4xx_setup_arch(); /* calls ppc4xx_find_bridges() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | |
| 89 | /* Identify the system */ |
Grant Likely | 8c38fc2b | 2007-04-28 05:50:02 +1000 | [diff] [blame] | 90 | printk(KERN_INFO "Xilinx ML300 Reference System (Virtex-II Pro)\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | /* Called after board_setup_irq from ppc4xx_init_IRQ(). */ |
| 94 | void __init |
| 95 | ml300_init_irq(void) |
| 96 | { |
| 97 | ppc4xx_init_IRQ(); |
| 98 | } |
| 99 | |
| 100 | void __init |
| 101 | platform_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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | 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 Likely | 8c38fc2b | 2007-04-28 05:50:02 +1000 | [diff] [blame] | 115 | ppc_md.early_serial_map = virtex_early_serial_map; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | #endif |
| 117 | } |
| 118 | |