2 * Board and PCI setup routines for MCG PowerPlus
4 * Author: Randy Vinson <rvinson@mvista.com>
6 * Derived from original PowerPlus PReP work by
7 * Cort Dougan, Johnnie Peters, Matt Porter, and
10 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
16 #include <linux/config.h>
17 #include <linux/kernel.h>
18 #include <linux/interrupt.h>
19 #include <linux/init.h>
20 #include <linux/ioport.h>
21 #include <linux/console.h>
22 #include <linux/pci.h>
23 #include <linux/ide.h>
24 #include <linux/seq_file.h>
25 #include <linux/root_dev.h>
27 #include <asm/system.h>
29 #include <asm/pgtable.h>
31 #include <asm/machdep.h>
32 #include <asm/prep_nvram.h>
34 #include <asm/i8259.h>
35 #include <asm/open_pic.h>
38 #include <asm/bootinfo.h>
48 extern void pplus_setup_hose(void);
49 extern void pplus_set_VIA_IDE_native(void);
51 extern unsigned long loops_per_jiffy;
52 unsigned char *Motherboard_map_name;
54 /* Tables for known hardware */
56 /* Motorola Mesquite */
58 mesquite_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
60 static char pci_irq_table[][4] =
62 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
63 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
64 * PCI IDSEL/INTPIN->INTLINE
68 {18, 0, 0, 0}, /* IDSEL 14 - Enet 0 */
69 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
70 {19, 19, 19, 19}, /* IDSEL 16 - PMC Slot 1 */
71 { 0, 0, 0, 0}, /* IDSEL 17 - unused */
72 { 0, 0, 0, 0}, /* IDSEL 18 - unused */
73 { 0, 0, 0, 0}, /* IDSEL 19 - unused */
74 {24, 25, 26, 27}, /* IDSEL 20 - P2P bridge (to cPCI 1) */
75 { 0, 0, 0, 0}, /* IDSEL 21 - unused */
76 {28, 29, 30, 31} /* IDSEL 22 - P2P bridge (to cPCI 2) */
79 const long min_idsel = 14, max_idsel = 22, irqs_per_slot = 4;
80 return PCI_IRQ_TABLE_LOOKUP;
85 sitka_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
87 static char pci_irq_table[][4] =
89 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
90 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
91 * PCI IDSEL/INTPIN->INTLINE
95 {18, 0, 0, 0}, /* IDSEL 14 - Enet 0 */
96 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
97 {25, 26, 27, 28}, /* IDSEL 16 - PMC Slot 1 */
98 {28, 25, 26, 27}, /* IDSEL 17 - PMC Slot 2 */
99 { 0, 0, 0, 0}, /* IDSEL 18 - unused */
100 { 0, 0, 0, 0}, /* IDSEL 19 - unused */
101 {20, 0, 0, 0} /* IDSEL 20 - P2P bridge (to cPCI) */
104 const long min_idsel = 14, max_idsel = 20, irqs_per_slot = 4;
105 return PCI_IRQ_TABLE_LOOKUP;
110 MTX_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
112 static char pci_irq_table[][4] =
114 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
115 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
116 * PCI IDSEL/INTPIN->INTLINE
120 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
121 { 0, 0, 0, 0}, /* IDSEL 13 - unused */
122 {18, 0, 0, 0}, /* IDSEL 14 - Enet */
123 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
124 {25, 26, 27, 28}, /* IDSEL 16 - PMC Slot 1 */
125 {26, 27, 28, 25}, /* IDSEL 17 - PMC Slot 2 */
126 {27, 28, 25, 26} /* IDSEL 18 - PCI Slot 3 */
129 const long min_idsel = 12, max_idsel = 18, irqs_per_slot = 4;
130 return PCI_IRQ_TABLE_LOOKUP;
133 /* Motorola MTX Plus */
134 /* Secondary bus interrupt routing is not supported yet */
136 MTXplus_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
138 static char pci_irq_table[][4] =
140 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
141 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
142 * PCI IDSEL/INTPIN->INTLINE
146 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
147 { 0, 0, 0, 0}, /* IDSEL 13 - unused */
148 {18, 0, 0, 0}, /* IDSEL 14 - Enet 1 */
149 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
150 {25, 26, 27, 28}, /* IDSEL 16 - PCI Slot 1P */
151 {26, 27, 28, 25}, /* IDSEL 17 - PCI Slot 2P */
152 {27, 28, 25, 26}, /* IDSEL 18 - PCI Slot 3P */
153 {26, 0, 0, 0}, /* IDSEL 19 - Enet 2 */
154 { 0, 0, 0, 0} /* IDSEL 20 - P2P Bridge */
157 const long min_idsel = 12, max_idsel = 20, irqs_per_slot = 4;
158 return PCI_IRQ_TABLE_LOOKUP;
162 Genesis2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
171 * PMC1 16 - IRQ9,10,11,12 = PMC1 A-D
172 * PMC2 17 - IRQ12,9,10,11 = A-D
175 * PCIX 20 - IRQ9,10,11,12 = PCI A-D
183 * PMC1 16 - IRQ9,10,11,12 = PMC A-D
184 * PMC2 17 - IRQ12,9,10,11 = PMC A-D
185 * PCIX 20 - IRQ9,10,11,12 = PMC A-D
193 * PMC1 16 - 9,10,11,12 = A-D
194 * PMC2 17 - 9,10,11,12 = B,C,D,A
197 static char pci_irq_table[][4] =
199 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
200 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
201 * PCI IDSEL/INTPIN->INTLINE
205 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
206 { 0, 0, 0, 0}, /* IDSEL 13 - Universe PCI - VME */
207 {18, 0, 0, 0}, /* IDSEL 14 - Enet 1 */
208 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
209 {25, 26, 27, 28}, /* IDSEL 16 - PCI/PMC Slot 1P */
210 {28, 25, 26, 27}, /* IDSEL 17 - PCI/PMC Slot 2P */
211 {27, 28, 25, 26}, /* IDSEL 18 - PCI Slot 3P */
212 {26, 0, 0, 0}, /* IDSEL 19 - Enet 2 */
213 {25, 26, 27, 28} /* IDSEL 20 - P2P Bridge */
216 const long min_idsel = 12, max_idsel = 20, irqs_per_slot = 4;
217 return PCI_IRQ_TABLE_LOOKUP;
220 #define MOTOROLA_CPUTYPE_REG 0x800
221 #define MOTOROLA_BASETYPE_REG 0x803
222 #define MPIC_RAVEN_ID 0x48010000
223 #define MPIC_HAWK_ID 0x48030000
224 #define MOT_PROC2_BIT 0x800
226 static u_char pplus_openpic_initsenses[] __initdata = {
227 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* MVME2600_INT_SIO */
228 (IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE),/*MVME2600_INT_FALCN_ECC_ERR */
229 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/*MVME2600_INT_PCI_ETHERNET */
230 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_SCSI */
231 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/*MVME2600_INT_PCI_GRAPHICS */
232 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME0 */
233 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME1 */
234 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME2 */
235 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_VME3 */
236 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTA */
237 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTB */
238 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTC */
239 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_PCI_INTD */
240 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_LM_SIG0 */
241 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* MVME2600_INT_LM_SIG1 */
242 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),
246 int prep_keybd_present = 1;
250 /* 0x100 mask assumes for Raven and Hawk boards that the level/edge
253 /* 0x200 if this board has a Hawk chip. */
255 /* or'ed with 0x80 if this board should be checked for multi CPU */
258 int (*map_irq) (struct pci_dev *, unsigned char, unsigned char);
260 struct brd_info mot_info[] = {
261 {0x300, 0x00, 0x00, "MVME 2400", Genesis2_map_irq},
262 {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", mesquite_map_irq},
263 {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", sitka_map_irq},
264 {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", mesquite_map_irq},
265 {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_map_irq},
266 {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_map_irq},
267 {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_map_irq},
268 {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_map_irq},
269 {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_map_irq},
270 {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_map_irq},
271 {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_map_irq},
272 {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_map_irq},
273 {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_map_irq},
274 {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_map_irq},
275 {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_map_irq},
276 {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_map_irq},
277 {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_map_irq},
278 {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_map_irq},
279 {0x000, 0x00, 0x00, "", NULL}
282 void __init pplus_set_board_type(void)
284 unsigned char cpu_type;
285 unsigned char base_mod;
287 unsigned short devid;
288 unsigned long *ProcInfo = NULL;
290 cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
291 base_mod = inb(MOTOROLA_BASETYPE_REG);
292 early_read_config_word(0, 0, 0, PCI_VENDOR_ID, &devid);
294 for (entry = 0; mot_info[entry].cpu_type != 0; entry++) {
295 /* Check for Hawk chip */
296 if (mot_info[entry].cpu_type & 0x200) {
297 if (devid != PCI_DEVICE_ID_MOTOROLA_HAWK)
300 /* store the system config register for later use. */
302 (unsigned long *)ioremap(PPLUS_SYS_CONFIG_REG, 4);
304 /* Check non hawk boards */
305 if ((mot_info[entry].cpu_type & 0xff) != cpu_type)
308 if (mot_info[entry].base_type == 0) {
313 if (mot_info[entry].base_type != base_mod)
317 if (!(mot_info[entry].max_cpu & 0x80)) {
322 /* processor 1 not present and max processor zero indicated */
323 if ((*ProcInfo & MOT_PROC2_BIT)
324 && !(mot_info[entry].max_cpu & 0x7f)) {
329 /* processor 1 present and max processor zero indicated */
330 if (!(*ProcInfo & MOT_PROC2_BIT)
331 && (mot_info[entry].max_cpu & 0x7f)) {
336 /* Indicate to system if this is a multiprocessor board */
337 if (!(*ProcInfo & MOT_PROC2_BIT))
342 /* No particular cpu type found - assume Mesquite (MCP750) */
345 Motherboard_map_name = (unsigned char *)mot_info[mot_entry].name;
346 ppc_md.pci_map_irq = mot_info[mot_entry].map_irq;
348 void __init pplus_pib_init(void)
351 unsigned short short_reg;
353 struct pci_dev *dev = NULL;
356 * Perform specific configuration for the Via Tech or
357 * or Winbond PCI-ISA-Bridge part.
359 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
360 PCI_DEVICE_ID_VIA_82C586_1, dev))) {
362 * PPCBUG does not set the enable bits
363 * for the IDE device. Force them on here.
365 pci_read_config_byte(dev, 0x40, ®);
367 reg |= 0x03; /* IDE: Chip Enable Bits */
368 pci_write_config_byte(dev, 0x40, reg);
371 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
372 PCI_DEVICE_ID_VIA_82C586_2,
373 dev)) && (dev->devfn = 0x5a)) {
374 /* Force correct USB interrupt */
376 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
379 if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
380 PCI_DEVICE_ID_WINBOND_83C553, dev))) {
381 /* Clear PCI Interrupt Routing Control Register. */
383 pci_write_config_word(dev, 0x44, short_reg);
384 /* Route IDE interrupts to IRQ 14 */
386 pci_write_config_byte(dev, 0x43, reg);
389 if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
390 PCI_DEVICE_ID_WINBOND_82C105, dev))) {
392 * Disable LEGIRQ mode so PCI INTS are routed
393 * directly to the 8259 and enable both channels
395 pci_write_config_dword(dev, 0x40, 0x10ff0033);
397 /* Force correct IDE interrupt */
399 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
404 void __init pplus_set_VIA_IDE_legacy(void)
406 unsigned short vend, dev;
408 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend);
409 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev);
411 if ((vend == PCI_VENDOR_ID_VIA) &&
412 (dev == PCI_DEVICE_ID_VIA_82C586_1)) {
415 /* put back original "standard" port base addresses */
416 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
417 PCI_BASE_ADDRESS_0, 0x1f1);
418 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
419 PCI_BASE_ADDRESS_1, 0x3f5);
420 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
421 PCI_BASE_ADDRESS_2, 0x171);
422 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
423 PCI_BASE_ADDRESS_3, 0x375);
424 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
425 PCI_BASE_ADDRESS_4, 0xcc01);
427 /* put into legacy mode */
428 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
431 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
436 void pplus_set_VIA_IDE_native(void)
438 unsigned short vend, dev;
440 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID, &vend);
441 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID, &dev);
443 if ((vend == PCI_VENDOR_ID_VIA) &&
444 (dev == PCI_DEVICE_ID_VIA_82C586_1)) {
447 /* put into native mode */
448 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
451 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG,
456 void __init pplus_pcibios_fixup(void)
460 unsigned short devid;
461 unsigned char base_mod;
463 printk(KERN_INFO "Setting PCI interrupts for a \"%s\"\n",
464 Motherboard_map_name);
466 /* Setup the Winbond or Via PIB */
469 /* Set up floppy in PS/2 mode */
470 outb(0x09, SIO_CONFIG_RA);
471 reg = inb(SIO_CONFIG_RD);
472 reg = (reg & 0x3F) | 0x40;
473 outb(reg, SIO_CONFIG_RD);
474 outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
476 /* This is a hack. If this is a 2300 or 2400 mot board then there is
477 * no keyboard controller and we have to indicate that.
480 early_read_config_word(0, 0, 0, PCI_VENDOR_ID, &devid);
481 base_mod = inb(MOTOROLA_BASETYPE_REG);
482 if ((devid == PCI_DEVICE_ID_MOTOROLA_HAWK) ||
483 (base_mod == 0xF9) || (base_mod == 0xFA) || (base_mod == 0xE1))
484 prep_keybd_present = 0;
487 void __init pplus_find_bridges(void)
489 struct pci_controller *hose;
491 hose = pcibios_alloc_controller();
495 hose->first_busno = 0;
496 hose->last_busno = 0xff;
498 hose->pci_mem_offset = PREP_ISA_MEM_BASE;
499 hose->io_base_virt = (void *)PREP_ISA_IO_BASE;
501 pci_init_resource(&hose->io_resource, PPLUS_PCI_IO_START,
502 PPLUS_PCI_IO_END, IORESOURCE_IO, "PCI host bridge");
503 pci_init_resource(&hose->mem_resources[0], PPLUS_PROC_PCI_MEM_START,
504 PPLUS_PROC_PCI_MEM_END, IORESOURCE_MEM,
507 hose->io_space.start = PPLUS_PCI_IO_START;
508 hose->io_space.end = PPLUS_PCI_IO_END;
509 hose->mem_space.start = PPLUS_PCI_MEM_START;
510 hose->mem_space.end = PPLUS_PCI_MEM_END - HAWK_MPIC_SIZE;
512 if (hawk_init(hose, PPLUS_HAWK_PPC_REG_BASE, PPLUS_PROC_PCI_MEM_START,
513 PPLUS_PROC_PCI_MEM_END - HAWK_MPIC_SIZE,
514 PPLUS_PROC_PCI_IO_START, PPLUS_PROC_PCI_IO_END,
515 PPLUS_PROC_PCI_MEM_END - HAWK_MPIC_SIZE + 1)
517 printk(KERN_CRIT "Could not initialize host bridge\n");
521 pplus_set_VIA_IDE_legacy();
523 hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
525 ppc_md.pcibios_fixup = pplus_pcibios_fixup;
526 ppc_md.pci_swizzle = common_swizzle;
529 static int pplus_show_cpuinfo(struct seq_file *m)
531 seq_printf(m, "vendor\t\t: Motorola MCG\n");
532 seq_printf(m, "machine\t\t: %s\n", Motherboard_map_name);
537 static void __init pplus_setup_arch(void)
539 struct pci_controller *hose;
542 ppc_md.progress("pplus_setup_arch: enter", 0);
544 /* init to some ~sane value until calibrate_delay() runs */
545 loops_per_jiffy = 50000000;
548 ppc_md.progress("pplus_setup_arch: find_bridges", 0);
550 /* Setup PCI host bridge */
551 pplus_find_bridges();
553 hose = pci_bus_to_hose(0);
554 isa_io_base = (ulong) hose->io_base_virt;
557 ppc_md.progress("pplus_setup_arch: set_board_type", 0);
559 pplus_set_board_type();
561 /* Enable L2. Assume we don't need to flush -- Cort */
562 *(unsigned char *)(PPLUS_L2_CONTROL_REG) |= 3;
564 #ifdef CONFIG_BLK_DEV_INITRD
566 ROOT_DEV = Root_RAM0;
569 #ifdef CONFIG_ROOT_NFS
572 ROOT_DEV = Root_SDA2;
575 printk(KERN_INFO "Motorola PowerPlus Platform\n");
577 "Port by MontaVista Software, Inc. (source@mvista.com)\n");
579 #ifdef CONFIG_VGA_CONSOLE
580 /* remap the VGA memory */
581 vgacon_remap_base = (unsigned long)ioremap(PPLUS_ISA_MEM_BASE,
583 conswitchp = &vga_con;
585 #ifdef CONFIG_PPCBUG_NVRAM
586 /* Read in NVRAM data */
589 /* if no bootargs, look in NVRAM */
590 if (cmd_line[0] == '\0') {
592 bootargs = prep_nvram_get_var("bootargs");
593 if (bootargs != NULL) {
594 strcpy(cmd_line, bootargs);
596 strcpy(saved_command_line, cmd_line);
601 ppc_md.progress("pplus_setup_arch: exit", 0);
604 static void pplus_restart(char *cmd)
606 unsigned long i = 10000;
610 /* set VIA IDE controller into native mode */
611 pplus_set_VIA_IDE_native();
613 /* set exception prefix high - to the prom */
614 _nmask_and_or_msr(0, MSR_IP);
616 /* make sure bit 0 (reset) is a 0 */
617 outb(inb(0x92) & ~1L, 0x92);
618 /* signal a reset to system control port A - soft reset */
619 outb(inb(0x92) | 1, 0x92);
623 panic("restart failed\n");
626 static void pplus_halt(void)
628 /* set exception prefix high - to the prom */
629 _nmask_and_or_msr(MSR_EE, MSR_IP);
631 /* make sure bit 0 (reset) is a 0 */
632 outb(inb(0x92) & ~1L, 0x92);
633 /* signal a reset to system control port A - soft reset */
634 outb(inb(0x92) | 1, 0x92);
642 static void pplus_power_off(void)
647 static void __init pplus_init_IRQ(void)
652 ppc_md.progress("init_irq: enter", 0);
654 OpenPIC_InitSenses = pplus_openpic_initsenses;
655 OpenPIC_NumInitSenses = sizeof(pplus_openpic_initsenses);
657 if (OpenPIC_Addr != NULL) {
659 openpic_set_sources(0, 16, OpenPIC_Addr + 0x10000);
660 openpic_init(NUM_8259_INTERRUPTS);
661 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
663 ppc_md.get_irq = openpic_get_irq;
669 ppc_md.progress("init_irq: exit", 0);
672 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
676 static int pplus_ide_default_irq(unsigned long base)
688 static unsigned long pplus_ide_default_io_base(int index)
701 pplus_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
702 unsigned long ctrl_port, int *irq)
704 unsigned long reg = data_port;
707 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
708 hw->io_ports[i] = reg;
713 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
715 hw->io_ports[IDE_CONTROL_OFFSET] =
716 hw->io_ports[IDE_DATA_OFFSET] + 0x206;
719 *irq = pplus_ide_default_irq(data_port);
724 /* PowerPlus (MTX) support */
725 static int __init smp_pplus_probe(void)
727 extern int mot_multi;
730 openpic_request_IPIs();
738 static void __init smp_pplus_kick_cpu(int nr)
740 *(unsigned long *)KERNELBASE = nr;
741 asm volatile ("dcbf 0,%0"::"r" (KERNELBASE):"memory");
742 printk(KERN_INFO "CPU1 reset, waiting\n");
745 static void __init smp_pplus_setup_cpu(int cpu_nr)
748 do_openpic_setup_cpu();
751 static struct smp_ops_t pplus_smp_ops = {
752 smp_openpic_message_pass,
756 .give_timebase = smp_generic_give_timebase,
757 .take_timebase = smp_generic_take_timebase,
759 #endif /* CONFIG_SMP */
762 static void print_dbat(int idx, u32 bat)
767 sprintf(str, "DBAT%c%c = 0x%08x\n",
768 (char)((idx - DBAT0U) / 2) + '0', (idx & 1) ? 'L' : 'U', bat);
769 ppc_md.progress(str, 0);
772 #define DUMP_DBAT(x) \
774 u32 __temp = mfspr(x);\
775 print_dbat(x, __temp); \
778 static void dump_dbats(void)
780 if (ppc_md.progress) {
793 static unsigned long __init pplus_find_end_of_memory(void)
798 ppc_md.progress("pplus_find_end_of_memory", 0);
804 total = hawk_get_mem_size(PPLUS_HAWK_SMC_BASE);
808 static void __init pplus_map_io(void)
810 io_block_mapping(PPLUS_ISA_IO_BASE, PPLUS_ISA_IO_BASE, 0x10000000,
812 io_block_mapping(0xfef80000, 0xfef80000, 0x00080000, _PAGE_IO);
815 static void __init pplus_init2(void)
818 request_region(PREP_NVRAM_AS0, 0x8, "nvram");
820 request_region(0x20, 0x20, "pic1");
821 request_region(0xa0, 0x20, "pic2");
822 request_region(0x00, 0x20, "dma1");
823 request_region(0x40, 0x20, "timer");
824 request_region(0x80, 0x10, "dma page reg");
825 request_region(0xc0, 0x20, "dma2");
829 * Set BAT 2 to access 0x8000000 so progress messages will work and set BAT 3
830 * to 0xf0000000 to access Falcon/Raven or Hawk registers
832 static __inline__ void pplus_set_bat(void)
834 /* wait for all outstanding memory accesses to complete */
838 mtspr(SPRN_DBAT2U, 0x80001ffe);
839 mtspr(SPRN_DBAT2L, 0x8000002a);
840 mtspr(SPRN_DBAT3U, 0xf0001ffe);
841 mtspr(SPRN_DBAT3L, 0xf000002a);
843 /* wait for updates */
848 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
849 unsigned long r6, unsigned long r7)
851 parse_bootinfo(find_bootinfo());
853 /* Map in board regs, etc. */
856 isa_io_base = PREP_ISA_IO_BASE;
857 isa_mem_base = PREP_ISA_MEM_BASE;
858 pci_dram_offset = PREP_PCI_DRAM_OFFSET;
859 ISA_DMA_THRESHOLD = 0x00ffffff;
860 DMA_MODE_READ = 0x44;
861 DMA_MODE_WRITE = 0x48;
862 ppc_do_canonicalize_irqs = 1;
864 ppc_md.setup_arch = pplus_setup_arch;
865 ppc_md.show_cpuinfo = pplus_show_cpuinfo;
866 ppc_md.init_IRQ = pplus_init_IRQ;
867 /* this gets changed later on if we have an OpenPIC -- Cort */
868 ppc_md.get_irq = i8259_irq;
869 ppc_md.init = pplus_init2;
871 ppc_md.restart = pplus_restart;
872 ppc_md.power_off = pplus_power_off;
873 ppc_md.halt = pplus_halt;
875 TODC_INIT(TODC_TYPE_MK48T59, PREP_NVRAM_AS0, PREP_NVRAM_AS1,
878 ppc_md.time_init = todc_time_init;
879 ppc_md.set_rtc_time = todc_set_rtc_time;
880 ppc_md.get_rtc_time = todc_get_rtc_time;
881 ppc_md.calibrate_decr = todc_calibrate_decr;
882 ppc_md.nvram_read_val = todc_m48txx_read_val;
883 ppc_md.nvram_write_val = todc_m48txx_write_val;
885 ppc_md.find_end_of_memory = pplus_find_end_of_memory;
886 ppc_md.setup_io_mappings = pplus_map_io;
888 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
889 ppc_ide_md.default_irq = pplus_ide_default_irq;
890 ppc_ide_md.default_io_base = pplus_ide_default_io_base;
891 ppc_ide_md.ide_init_hwif = pplus_ide_init_hwif_ports;
894 #ifdef CONFIG_SERIAL_TEXT_DEBUG
895 ppc_md.progress = gen550_progress;
896 #endif /* CONFIG_SERIAL_TEXT_DEBUG */
898 ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
901 smp_ops = &pplus_smp_ops;
902 #endif /* CONFIG_SMP */