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/kernel.h>
17 #include <linux/interrupt.h>
18 #include <linux/init.h>
19 #include <linux/ioport.h>
20 #include <linux/console.h>
21 #include <linux/pci.h>
22 #include <linux/seq_file.h>
23 #include <linux/root_dev.h>
25 #include <asm/system.h>
27 #include <asm/pgtable.h>
29 #include <asm/machdep.h>
30 #include <asm/prep_nvram.h>
32 #include <asm/i8259.h>
33 #include <asm/open_pic.h>
36 #include <asm/bootinfo.h>
46 extern void pplus_setup_hose(void);
47 extern void pplus_set_VIA_IDE_native(void);
49 extern unsigned long loops_per_jiffy
;
50 unsigned char *Motherboard_map_name
;
52 /* Tables for known hardware */
54 /* Motorola Mesquite */
56 mesquite_map_irq(struct pci_dev
*dev
, unsigned char idsel
, unsigned char pin
)
58 static char pci_irq_table
[][4] =
60 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
61 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
62 * PCI IDSEL/INTPIN->INTLINE
66 {18, 0, 0, 0}, /* IDSEL 14 - Enet 0 */
67 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
68 {19, 19, 19, 19}, /* IDSEL 16 - PMC Slot 1 */
69 { 0, 0, 0, 0}, /* IDSEL 17 - unused */
70 { 0, 0, 0, 0}, /* IDSEL 18 - unused */
71 { 0, 0, 0, 0}, /* IDSEL 19 - unused */
72 {24, 25, 26, 27}, /* IDSEL 20 - P2P bridge (to cPCI 1) */
73 { 0, 0, 0, 0}, /* IDSEL 21 - unused */
74 {28, 29, 30, 31} /* IDSEL 22 - P2P bridge (to cPCI 2) */
77 const long min_idsel
= 14, max_idsel
= 22, irqs_per_slot
= 4;
78 return PCI_IRQ_TABLE_LOOKUP
;
83 sitka_map_irq(struct pci_dev
*dev
, unsigned char idsel
, unsigned char pin
)
85 static char pci_irq_table
[][4] =
87 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
88 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
89 * PCI IDSEL/INTPIN->INTLINE
93 {18, 0, 0, 0}, /* IDSEL 14 - Enet 0 */
94 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
95 {25, 26, 27, 28}, /* IDSEL 16 - PMC Slot 1 */
96 {28, 25, 26, 27}, /* IDSEL 17 - PMC Slot 2 */
97 { 0, 0, 0, 0}, /* IDSEL 18 - unused */
98 { 0, 0, 0, 0}, /* IDSEL 19 - unused */
99 {20, 0, 0, 0} /* IDSEL 20 - P2P bridge (to cPCI) */
102 const long min_idsel
= 14, max_idsel
= 20, irqs_per_slot
= 4;
103 return PCI_IRQ_TABLE_LOOKUP
;
108 MTX_map_irq(struct pci_dev
*dev
, unsigned char idsel
, unsigned char pin
)
110 static char pci_irq_table
[][4] =
112 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
113 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
114 * PCI IDSEL/INTPIN->INTLINE
118 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
119 { 0, 0, 0, 0}, /* IDSEL 13 - unused */
120 {18, 0, 0, 0}, /* IDSEL 14 - Enet */
121 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
122 {25, 26, 27, 28}, /* IDSEL 16 - PMC Slot 1 */
123 {26, 27, 28, 25}, /* IDSEL 17 - PMC Slot 2 */
124 {27, 28, 25, 26} /* IDSEL 18 - PCI Slot 3 */
127 const long min_idsel
= 12, max_idsel
= 18, irqs_per_slot
= 4;
128 return PCI_IRQ_TABLE_LOOKUP
;
131 /* Motorola MTX Plus */
132 /* Secondary bus interrupt routing is not supported yet */
134 MTXplus_map_irq(struct pci_dev
*dev
, unsigned char idsel
, unsigned char pin
)
136 static char pci_irq_table
[][4] =
138 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
139 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
140 * PCI IDSEL/INTPIN->INTLINE
144 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
145 { 0, 0, 0, 0}, /* IDSEL 13 - unused */
146 {18, 0, 0, 0}, /* IDSEL 14 - Enet 1 */
147 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
148 {25, 26, 27, 28}, /* IDSEL 16 - PCI Slot 1P */
149 {26, 27, 28, 25}, /* IDSEL 17 - PCI Slot 2P */
150 {27, 28, 25, 26}, /* IDSEL 18 - PCI Slot 3P */
151 {26, 0, 0, 0}, /* IDSEL 19 - Enet 2 */
152 { 0, 0, 0, 0} /* IDSEL 20 - P2P Bridge */
155 const long min_idsel
= 12, max_idsel
= 20, irqs_per_slot
= 4;
156 return PCI_IRQ_TABLE_LOOKUP
;
160 Genesis2_map_irq(struct pci_dev
*dev
, unsigned char idsel
, unsigned char pin
)
169 * PMC1 16 - IRQ9,10,11,12 = PMC1 A-D
170 * PMC2 17 - IRQ12,9,10,11 = A-D
173 * PCIX 20 - IRQ9,10,11,12 = PCI A-D
181 * PMC1 16 - IRQ9,10,11,12 = PMC A-D
182 * PMC2 17 - IRQ12,9,10,11 = PMC A-D
183 * PCIX 20 - IRQ9,10,11,12 = PMC A-D
191 * PMC1 16 - 9,10,11,12 = A-D
192 * PMC2 17 - 9,10,11,12 = B,C,D,A
195 static char pci_irq_table
[][4] =
197 * MPIC interrupts for various IDSEL values (MPIC IRQ0 =
198 * Linux IRQ16 (to leave room for ISA IRQs at 0-15).
199 * PCI IDSEL/INTPIN->INTLINE
203 {19, 0, 0, 0}, /* IDSEL 12 - SCSI */
204 { 0, 0, 0, 0}, /* IDSEL 13 - Universe PCI - VME */
205 {18, 0, 0, 0}, /* IDSEL 14 - Enet 1 */
206 { 0, 0, 0, 0}, /* IDSEL 15 - unused */
207 {25, 26, 27, 28}, /* IDSEL 16 - PCI/PMC Slot 1P */
208 {28, 25, 26, 27}, /* IDSEL 17 - PCI/PMC Slot 2P */
209 {27, 28, 25, 26}, /* IDSEL 18 - PCI Slot 3P */
210 {26, 0, 0, 0}, /* IDSEL 19 - Enet 2 */
211 {25, 26, 27, 28} /* IDSEL 20 - P2P Bridge */
214 const long min_idsel
= 12, max_idsel
= 20, irqs_per_slot
= 4;
215 return PCI_IRQ_TABLE_LOOKUP
;
218 #define MOTOROLA_CPUTYPE_REG 0x800
219 #define MOTOROLA_BASETYPE_REG 0x803
220 #define MPIC_RAVEN_ID 0x48010000
221 #define MPIC_HAWK_ID 0x48030000
222 #define MOT_PROC2_BIT 0x800
224 static u_char pplus_openpic_initsenses
[] __initdata
= {
225 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_POSITIVE
), /* MVME2600_INT_SIO */
226 (IRQ_SENSE_EDGE
| IRQ_POLARITY_NEGATIVE
),/*MVME2600_INT_FALCN_ECC_ERR */
227 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
),/*MVME2600_INT_PCI_ETHERNET */
228 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_SCSI */
229 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
),/*MVME2600_INT_PCI_GRAPHICS */
230 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_VME0 */
231 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_VME1 */
232 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_VME2 */
233 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_VME3 */
234 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_INTA */
235 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_INTB */
236 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_INTC */
237 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_PCI_INTD */
238 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_LM_SIG0 */
239 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* MVME2600_INT_LM_SIG1 */
240 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
),
244 int prep_keybd_present
= 1;
248 /* 0x100 mask assumes for Raven and Hawk boards that the level/edge
251 /* 0x200 if this board has a Hawk chip. */
253 /* or'ed with 0x80 if this board should be checked for multi CPU */
256 int (*map_irq
) (struct pci_dev
*, unsigned char, unsigned char);
258 struct brd_info mot_info
[] = {
259 {0x300, 0x00, 0x00, "MVME 2400", Genesis2_map_irq
},
260 {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", mesquite_map_irq
},
261 {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", sitka_map_irq
},
262 {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", mesquite_map_irq
},
263 {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_map_irq
},
264 {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_map_irq
},
265 {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_map_irq
},
266 {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_map_irq
},
267 {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_map_irq
},
268 {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_map_irq
},
269 {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_map_irq
},
270 {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_map_irq
},
271 {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_map_irq
},
272 {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_map_irq
},
273 {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_map_irq
},
274 {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_map_irq
},
275 {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_map_irq
},
276 {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_map_irq
},
277 {0x000, 0x00, 0x00, "", NULL
}
280 void __init
pplus_set_board_type(void)
282 unsigned char cpu_type
;
283 unsigned char base_mod
;
285 unsigned short devid
;
286 unsigned long *ProcInfo
= NULL
;
288 cpu_type
= inb(MOTOROLA_CPUTYPE_REG
) & 0xF0;
289 base_mod
= inb(MOTOROLA_BASETYPE_REG
);
290 early_read_config_word(0, 0, 0, PCI_VENDOR_ID
, &devid
);
292 for (entry
= 0; mot_info
[entry
].cpu_type
!= 0; entry
++) {
293 /* Check for Hawk chip */
294 if (mot_info
[entry
].cpu_type
& 0x200) {
295 if (devid
!= PCI_DEVICE_ID_MOTOROLA_HAWK
)
298 /* store the system config register for later use. */
300 (unsigned long *)ioremap(PPLUS_SYS_CONFIG_REG
, 4);
302 /* Check non hawk boards */
303 if ((mot_info
[entry
].cpu_type
& 0xff) != cpu_type
)
306 if (mot_info
[entry
].base_type
== 0) {
311 if (mot_info
[entry
].base_type
!= base_mod
)
315 if (!(mot_info
[entry
].max_cpu
& 0x80)) {
320 /* processor 1 not present and max processor zero indicated */
321 if ((*ProcInfo
& MOT_PROC2_BIT
)
322 && !(mot_info
[entry
].max_cpu
& 0x7f)) {
327 /* processor 1 present and max processor zero indicated */
328 if (!(*ProcInfo
& MOT_PROC2_BIT
)
329 && (mot_info
[entry
].max_cpu
& 0x7f)) {
334 /* Indicate to system if this is a multiprocessor board */
335 if (!(*ProcInfo
& MOT_PROC2_BIT
))
340 /* No particular cpu type found - assume Mesquite (MCP750) */
343 Motherboard_map_name
= (unsigned char *)mot_info
[mot_entry
].name
;
344 ppc_md
.pci_map_irq
= mot_info
[mot_entry
].map_irq
;
346 void __init
pplus_pib_init(void)
349 unsigned short short_reg
;
351 struct pci_dev
*dev
= NULL
;
354 * Perform specific configuration for the Via Tech or
355 * or Winbond PCI-ISA-Bridge part.
357 if ((dev
= pci_get_device(PCI_VENDOR_ID_VIA
,
358 PCI_DEVICE_ID_VIA_82C586_1
, dev
))) {
360 * PPCBUG does not set the enable bits
361 * for the IDE device. Force them on here.
363 pci_read_config_byte(dev
, 0x40, ®
);
365 reg
|= 0x03; /* IDE: Chip Enable Bits */
366 pci_write_config_byte(dev
, 0x40, reg
);
369 if ((dev
= pci_get_device(PCI_VENDOR_ID_VIA
,
370 PCI_DEVICE_ID_VIA_82C586_2
,
371 dev
)) && (dev
->devfn
= 0x5a)) {
372 /* Force correct USB interrupt */
374 pci_write_config_byte(dev
, PCI_INTERRUPT_LINE
, dev
->irq
);
377 if ((dev
= pci_get_device(PCI_VENDOR_ID_WINBOND
,
378 PCI_DEVICE_ID_WINBOND_83C553
, dev
))) {
379 /* Clear PCI Interrupt Routing Control Register. */
381 pci_write_config_word(dev
, 0x44, short_reg
);
382 /* Route IDE interrupts to IRQ 14 */
384 pci_write_config_byte(dev
, 0x43, reg
);
387 if ((dev
= pci_get_device(PCI_VENDOR_ID_WINBOND
,
388 PCI_DEVICE_ID_WINBOND_82C105
, dev
))) {
390 * Disable LEGIRQ mode so PCI INTS are routed
391 * directly to the 8259 and enable both channels
393 pci_write_config_dword(dev
, 0x40, 0x10ff0033);
395 /* Force correct IDE interrupt */
397 pci_write_config_byte(dev
, PCI_INTERRUPT_LINE
, dev
->irq
);
402 void __init
pplus_set_VIA_IDE_legacy(void)
404 unsigned short vend
, dev
;
406 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID
, &vend
);
407 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID
, &dev
);
409 if ((vend
== PCI_VENDOR_ID_VIA
) &&
410 (dev
== PCI_DEVICE_ID_VIA_82C586_1
)) {
413 /* put back original "standard" port base addresses */
414 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
415 PCI_BASE_ADDRESS_0
, 0x1f1);
416 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
417 PCI_BASE_ADDRESS_1
, 0x3f5);
418 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
419 PCI_BASE_ADDRESS_2
, 0x171);
420 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
421 PCI_BASE_ADDRESS_3
, 0x375);
422 early_write_config_dword(0, 0, PCI_DEVFN(0xb, 1),
423 PCI_BASE_ADDRESS_4
, 0xcc01);
425 /* put into legacy mode */
426 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG
,
429 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG
,
434 void pplus_set_VIA_IDE_native(void)
436 unsigned short vend
, dev
;
438 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_VENDOR_ID
, &vend
);
439 early_read_config_word(0, 0, PCI_DEVFN(0xb, 1), PCI_DEVICE_ID
, &dev
);
441 if ((vend
== PCI_VENDOR_ID_VIA
) &&
442 (dev
== PCI_DEVICE_ID_VIA_82C586_1
)) {
445 /* put into native mode */
446 early_read_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG
,
449 early_write_config_byte(0, 0, PCI_DEVFN(0xb, 1), PCI_CLASS_PROG
,
454 void __init
pplus_pcibios_fixup(void)
458 unsigned short devid
;
459 unsigned char base_mod
;
461 printk(KERN_INFO
"Setting PCI interrupts for a \"%s\"\n",
462 Motherboard_map_name
);
464 /* Setup the Winbond or Via PIB */
467 /* Set up floppy in PS/2 mode */
468 outb(0x09, SIO_CONFIG_RA
);
469 reg
= inb(SIO_CONFIG_RD
);
470 reg
= (reg
& 0x3F) | 0x40;
471 outb(reg
, SIO_CONFIG_RD
);
472 outb(reg
, SIO_CONFIG_RD
); /* Have to write twice to change! */
474 /* This is a hack. If this is a 2300 or 2400 mot board then there is
475 * no keyboard controller and we have to indicate that.
478 early_read_config_word(0, 0, 0, PCI_VENDOR_ID
, &devid
);
479 base_mod
= inb(MOTOROLA_BASETYPE_REG
);
480 if ((devid
== PCI_DEVICE_ID_MOTOROLA_HAWK
) ||
481 (base_mod
== 0xF9) || (base_mod
== 0xFA) || (base_mod
== 0xE1))
482 prep_keybd_present
= 0;
485 void __init
pplus_find_bridges(void)
487 struct pci_controller
*hose
;
489 hose
= pcibios_alloc_controller();
493 hose
->first_busno
= 0;
494 hose
->last_busno
= 0xff;
496 hose
->pci_mem_offset
= PREP_ISA_MEM_BASE
;
497 hose
->io_base_virt
= (void *)PREP_ISA_IO_BASE
;
499 pci_init_resource(&hose
->io_resource
, PPLUS_PCI_IO_START
,
500 PPLUS_PCI_IO_END
, IORESOURCE_IO
, "PCI host bridge");
501 pci_init_resource(&hose
->mem_resources
[0], PPLUS_PROC_PCI_MEM_START
,
502 PPLUS_PROC_PCI_MEM_END
, IORESOURCE_MEM
,
505 hose
->io_space
.start
= PPLUS_PCI_IO_START
;
506 hose
->io_space
.end
= PPLUS_PCI_IO_END
;
507 hose
->mem_space
.start
= PPLUS_PCI_MEM_START
;
508 hose
->mem_space
.end
= PPLUS_PCI_MEM_END
- HAWK_MPIC_SIZE
;
510 if (hawk_init(hose
, PPLUS_HAWK_PPC_REG_BASE
, PPLUS_PROC_PCI_MEM_START
,
511 PPLUS_PROC_PCI_MEM_END
- HAWK_MPIC_SIZE
,
512 PPLUS_PROC_PCI_IO_START
, PPLUS_PROC_PCI_IO_END
,
513 PPLUS_PROC_PCI_MEM_END
- HAWK_MPIC_SIZE
+ 1)
515 printk(KERN_CRIT
"Could not initialize host bridge\n");
519 pplus_set_VIA_IDE_legacy();
521 hose
->last_busno
= pciauto_bus_scan(hose
, hose
->first_busno
);
523 ppc_md
.pcibios_fixup
= pplus_pcibios_fixup
;
524 ppc_md
.pci_swizzle
= common_swizzle
;
527 static int pplus_show_cpuinfo(struct seq_file
*m
)
529 seq_printf(m
, "vendor\t\t: Motorola MCG\n");
530 seq_printf(m
, "machine\t\t: %s\n", Motherboard_map_name
);
535 static void __init
pplus_setup_arch(void)
537 struct pci_controller
*hose
;
540 ppc_md
.progress("pplus_setup_arch: enter", 0);
542 /* init to some ~sane value until calibrate_delay() runs */
543 loops_per_jiffy
= 50000000;
546 ppc_md
.progress("pplus_setup_arch: find_bridges", 0);
548 /* Setup PCI host bridge */
549 pplus_find_bridges();
551 hose
= pci_bus_to_hose(0);
552 isa_io_base
= (ulong
) hose
->io_base_virt
;
555 ppc_md
.progress("pplus_setup_arch: set_board_type", 0);
557 pplus_set_board_type();
559 /* Enable L2. Assume we don't need to flush -- Cort */
560 *(unsigned char *)(PPLUS_L2_CONTROL_REG
) |= 3;
562 #ifdef CONFIG_BLK_DEV_INITRD
564 ROOT_DEV
= Root_RAM0
;
567 #ifdef CONFIG_ROOT_NFS
570 ROOT_DEV
= Root_SDA2
;
573 printk(KERN_INFO
"Motorola PowerPlus Platform\n");
575 "Port by MontaVista Software, Inc. (source@mvista.com)\n");
577 #ifdef CONFIG_VGA_CONSOLE
578 /* remap the VGA memory */
579 vgacon_remap_base
= (unsigned long)ioremap(PPLUS_ISA_MEM_BASE
,
581 conswitchp
= &vga_con
;
583 #ifdef CONFIG_PPCBUG_NVRAM
584 /* Read in NVRAM data */
587 /* if no bootargs, look in NVRAM */
588 if (cmd_line
[0] == '\0') {
590 bootargs
= prep_nvram_get_var("bootargs");
591 if (bootargs
!= NULL
) {
592 strcpy(cmd_line
, bootargs
);
594 strcpy(boot_command_line
, cmd_line
);
599 ppc_md
.progress("pplus_setup_arch: exit", 0);
602 static void pplus_restart(char *cmd
)
604 unsigned long i
= 10000;
608 /* set VIA IDE controller into native mode */
609 pplus_set_VIA_IDE_native();
611 /* set exception prefix high - to the prom */
612 _nmask_and_or_msr(0, MSR_IP
);
614 /* make sure bit 0 (reset) is a 0 */
615 outb(inb(0x92) & ~1L, 0x92);
616 /* signal a reset to system control port A - soft reset */
617 outb(inb(0x92) | 1, 0x92);
621 panic("restart failed\n");
624 static void pplus_halt(void)
626 /* set exception prefix high - to the prom */
627 _nmask_and_or_msr(MSR_EE
, MSR_IP
);
629 /* make sure bit 0 (reset) is a 0 */
630 outb(inb(0x92) & ~1L, 0x92);
631 /* signal a reset to system control port A - soft reset */
632 outb(inb(0x92) | 1, 0x92);
640 static void pplus_power_off(void)
645 static void __init
pplus_init_IRQ(void)
650 ppc_md
.progress("init_irq: enter", 0);
652 OpenPIC_InitSenses
= pplus_openpic_initsenses
;
653 OpenPIC_NumInitSenses
= sizeof(pplus_openpic_initsenses
);
655 if (OpenPIC_Addr
!= NULL
) {
657 openpic_set_sources(0, 16, OpenPIC_Addr
+ 0x10000);
658 openpic_init(NUM_8259_INTERRUPTS
);
659 openpic_hookup_cascade(NUM_8259_INTERRUPTS
, "82c59 cascade",
661 ppc_md
.get_irq
= openpic_get_irq
;
667 ppc_md
.progress("init_irq: exit", 0);
671 /* PowerPlus (MTX) support */
672 static int __init
smp_pplus_probe(void)
674 extern int mot_multi
;
677 openpic_request_IPIs();
685 static void __init
smp_pplus_kick_cpu(int nr
)
687 *(unsigned long *)KERNELBASE
= nr
;
688 asm volatile ("dcbf 0,%0"::"r" (KERNELBASE
):"memory");
689 printk(KERN_INFO
"CPU1 reset, waiting\n");
692 static void __init
smp_pplus_setup_cpu(int cpu_nr
)
695 do_openpic_setup_cpu();
698 static struct smp_ops_t pplus_smp_ops
= {
699 smp_openpic_message_pass
,
703 .give_timebase
= smp_generic_give_timebase
,
704 .take_timebase
= smp_generic_take_timebase
,
706 #endif /* CONFIG_SMP */
709 static void print_dbat(int idx
, u32 bat
)
714 sprintf(str
, "DBAT%c%c = 0x%08x\n",
715 (char)((idx
- DBAT0U
) / 2) + '0', (idx
& 1) ? 'L' : 'U', bat
);
716 ppc_md
.progress(str
, 0);
719 #define DUMP_DBAT(x) \
721 u32 __temp = mfspr(x);\
722 print_dbat(x, __temp); \
725 static void dump_dbats(void)
727 if (ppc_md
.progress
) {
740 static unsigned long __init
pplus_find_end_of_memory(void)
745 ppc_md
.progress("pplus_find_end_of_memory", 0);
751 total
= hawk_get_mem_size(PPLUS_HAWK_SMC_BASE
);
755 static void __init
pplus_map_io(void)
757 io_block_mapping(PPLUS_ISA_IO_BASE
, PPLUS_ISA_IO_BASE
, 0x10000000,
759 io_block_mapping(0xfef80000, 0xfef80000, 0x00080000, _PAGE_IO
);
762 static void __init
pplus_init2(void)
765 request_region(PREP_NVRAM_AS0
, 0x8, "nvram");
767 request_region(0x20, 0x20, "pic1");
768 request_region(0xa0, 0x20, "pic2");
769 request_region(0x00, 0x20, "dma1");
770 request_region(0x40, 0x20, "timer");
771 request_region(0x80, 0x10, "dma page reg");
772 request_region(0xc0, 0x20, "dma2");
776 * Set BAT 2 to access 0x8000000 so progress messages will work and set BAT 3
777 * to 0xf0000000 to access Falcon/Raven or Hawk registers
779 static __inline__
void pplus_set_bat(void)
781 /* wait for all outstanding memory accesses to complete */
785 mtspr(SPRN_DBAT2U
, 0x80001ffe);
786 mtspr(SPRN_DBAT2L
, 0x8000002a);
787 mtspr(SPRN_DBAT3U
, 0xf0001ffe);
788 mtspr(SPRN_DBAT3L
, 0xf000002a);
790 /* wait for updates */
795 platform_init(unsigned long r3
, unsigned long r4
, unsigned long r5
,
796 unsigned long r6
, unsigned long r7
)
798 parse_bootinfo(find_bootinfo());
800 /* Map in board regs, etc. */
803 isa_io_base
= PREP_ISA_IO_BASE
;
804 isa_mem_base
= PREP_ISA_MEM_BASE
;
805 pci_dram_offset
= PREP_PCI_DRAM_OFFSET
;
806 ISA_DMA_THRESHOLD
= 0x00ffffff;
807 DMA_MODE_READ
= 0x44;
808 DMA_MODE_WRITE
= 0x48;
809 ppc_do_canonicalize_irqs
= 1;
811 ppc_md
.setup_arch
= pplus_setup_arch
;
812 ppc_md
.show_cpuinfo
= pplus_show_cpuinfo
;
813 ppc_md
.init_IRQ
= pplus_init_IRQ
;
814 /* this gets changed later on if we have an OpenPIC -- Cort */
815 ppc_md
.get_irq
= i8259_irq
;
816 ppc_md
.init
= pplus_init2
;
818 ppc_md
.restart
= pplus_restart
;
819 ppc_md
.power_off
= pplus_power_off
;
820 ppc_md
.halt
= pplus_halt
;
822 TODC_INIT(TODC_TYPE_MK48T59
, PREP_NVRAM_AS0
, PREP_NVRAM_AS1
,
825 ppc_md
.time_init
= todc_time_init
;
826 ppc_md
.set_rtc_time
= todc_set_rtc_time
;
827 ppc_md
.get_rtc_time
= todc_get_rtc_time
;
828 ppc_md
.calibrate_decr
= todc_calibrate_decr
;
829 ppc_md
.nvram_read_val
= todc_m48txx_read_val
;
830 ppc_md
.nvram_write_val
= todc_m48txx_write_val
;
832 ppc_md
.find_end_of_memory
= pplus_find_end_of_memory
;
833 ppc_md
.setup_io_mappings
= pplus_map_io
;
835 #ifdef CONFIG_SERIAL_TEXT_DEBUG
836 ppc_md
.progress
= gen550_progress
;
837 #endif /* CONFIG_SERIAL_TEXT_DEBUG */
839 ppc_md
.kgdb_map_scc
= gen550_kgdb_map_scc
;
842 smp_ops
= &pplus_smp_ops
;
843 #endif /* CONFIG_SMP */