2 * arch/ppc/platforms/mvme5100_setup.c
4 * Board setup routines for the Motorola MVME5100.
6 * Author: Matt Porter <mporter@mvista.com>
8 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
14 #include <linux/config.h>
15 #include <linux/stddef.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/errno.h>
19 #include <linux/reboot.h>
20 #include <linux/pci.h>
21 #include <linux/kdev_t.h>
22 #include <linux/major.h>
23 #include <linux/initrd.h>
24 #include <linux/console.h>
25 #include <linux/delay.h>
26 #include <linux/irq.h>
27 #include <linux/ide.h>
28 #include <linux/seq_file.h>
29 #include <linux/root_dev.h>
31 #include <asm/system.h>
32 #include <asm/pgtable.h>
37 #include <asm/machdep.h>
40 #include <asm/open_pic.h>
41 #include <asm/i8259.h>
42 #include <platforms/mvme5100.h>
44 #include <asm/pci-bridge.h>
45 #include <asm/bootinfo.h>
46 #include <asm/pplus.h>
48 extern char cmd_line[];
50 static u_char mvme5100_openpic_initsenses[] __initdata = {
51 0, /* 16: i8259 cascade (active high) */
52 1, /* 17: TL16C550 UART 1,2 */
53 1, /* 18: Enet 1 (front panel or P2) */
54 1, /* 19: Hawk Watchdog 1,2 */
55 1, /* 20: DS1621 thermal alarm */
56 1, /* 21: Universe II LINT0# */
57 1, /* 22: Universe II LINT1# */
58 1, /* 23: Universe II LINT2# */
59 1, /* 24: Universe II LINT3# */
60 1, /* 25: PMC1 INTA#, PMC2 INTB# */
61 1, /* 26: PMC1 INTB#, PMC2 INTC# */
62 1, /* 27: PMC1 INTC#, PMC2 INTD# */
63 1, /* 28: PMC1 INTD#, PMC2 INTA# */
64 1, /* 29: Enet 2 (front panel) */
65 1, /* 30: Abort Switch */
66 1, /* 31: RTC Alarm */
70 mvme5100_setup_arch(void)
72 if ( ppc_md.progress )
73 ppc_md.progress("mvme5100_setup_arch: enter", 0);
75 loops_per_jiffy = 50000000 / HZ;
77 #ifdef CONFIG_BLK_DEV_INITRD
82 #ifdef CONFIG_ROOT_NFS
88 #ifdef CONFIG_DUMMY_CONSOLE
89 conswitchp = &dummy_con;
92 if ( ppc_md.progress )
93 ppc_md.progress("mvme5100_setup_arch: find_bridges", 0);
95 /* Setup PCI host bridge */
96 mvme5100_setup_bridge();
98 /* Find and map our OpenPIC */
99 pplus_mpic_init(MVME5100_PCI_MEM_OFFSET);
100 OpenPIC_InitSenses = mvme5100_openpic_initsenses;
101 OpenPIC_NumInitSenses = sizeof(mvme5100_openpic_initsenses);
103 printk("MVME5100 port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n");
105 if ( ppc_md.progress )
106 ppc_md.progress("mvme5100_setup_arch: exit", 0);
114 #ifdef CONFIG_MVME5100_IPMC761_PRESENT
115 request_region(0x00,0x20,"dma1");
116 request_region(0x20,0x20,"pic1");
117 request_region(0x40,0x20,"timer");
118 request_region(0x80,0x10,"dma page reg");
119 request_region(0xa0,0x20,"pic2");
120 request_region(0xc0,0x20,"dma2");
126 * Interrupt setup and service.
127 * Have MPIC on HAWK and cascaded 8259s on Winbond cascaded to MPIC.
130 mvme5100_init_IRQ(void)
132 #ifdef CONFIG_MVME5100_IPMC761_PRESENT
136 if ( ppc_md.progress )
137 ppc_md.progress("init_irq: enter", 0);
139 #ifdef CONFIG_MVME5100_IPMC761_PRESENT
140 openpic_init(1, NUM_8259_INTERRUPTS, NULL, -1);
141 openpic_hookup_cascade(NUM_8259_INTERRUPTS,"82c59 cascade",&i8259_irq);
143 for(i=0; i < NUM_8259_INTERRUPTS; i++)
144 irq_desc[i].handler = &i8259_pic;
148 openpic_init(1, 0, NULL, -1);
151 if ( ppc_md.progress )
152 ppc_md.progress("init_irq: exit", 0);
158 * Set BAT 3 to map 0xf0000000 to end of physical memory space.
160 static __inline__ void
161 mvme5100_set_bat(void)
163 unsigned long bat3u, bat3l;
164 static int mapping_set = 0;
168 __asm__ __volatile__(
176 : "=r" (bat3u), "=r" (bat3l));
184 static unsigned long __init
185 mvme5100_find_end_of_memory(void)
188 return pplus_get_mem_size(MVME5100_HAWK_SMC_BASE);
192 mvme5100_map_io(void)
194 io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
195 ioremap_base = 0xfe000000;
199 mvme5100_reset_board(void)
203 /* Set exception prefix high - to the firmware */
204 _nmask_and_or_msr(0, MSR_IP);
206 out_8((u_char *)MVME5100_BOARD_MODRST_REG, 0x01);
212 mvme5100_restart(char *cmd)
214 volatile ulong i = 10000000;
216 mvme5100_reset_board();
219 panic("restart failed\n");
230 mvme5100_power_off(void)
236 mvme5100_show_cpuinfo(struct seq_file *m)
238 seq_printf(m, "vendor\t\t: Motorola\n");
239 seq_printf(m, "machine\t\t: MVME5100\n");
247 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
248 unsigned long r6, unsigned long r7)
250 parse_bootinfo(find_bootinfo());
252 isa_io_base = MVME5100_ISA_IO_BASE;
253 isa_mem_base = MVME5100_ISA_MEM_BASE;
254 pci_dram_offset = MVME5100_PCI_DRAM_OFFSET;
256 ppc_md.setup_arch = mvme5100_setup_arch;
257 ppc_md.show_cpuinfo = mvme5100_show_cpuinfo;
258 ppc_md.init_IRQ = mvme5100_init_IRQ;
259 ppc_md.get_irq = openpic_get_irq;
260 ppc_md.init = mvme5100_init2;
262 ppc_md.restart = mvme5100_restart;
263 ppc_md.power_off = mvme5100_power_off;
264 ppc_md.halt = mvme5100_halt;
266 ppc_md.find_end_of_memory = mvme5100_find_end_of_memory;
267 ppc_md.setup_io_mappings = mvme5100_map_io;
269 TODC_INIT(TODC_TYPE_MK48T37,
275 ppc_md.time_init = todc_time_init;
276 ppc_md.set_rtc_time = todc_set_rtc_time;
277 ppc_md.get_rtc_time = todc_get_rtc_time;
278 ppc_md.calibrate_decr = todc_calibrate_decr;
280 ppc_md.nvram_read_val = todc_m48txx_read_val;
281 ppc_md.nvram_write_val = todc_m48txx_write_val;
283 ppc_md.progress = NULL;