14 #include <linux/stddef.h>
15 #include <linux/kernel.h>
17 #include <linux/errno.h>
18 #include <linux/reboot.h>
19 #include <linux/pci.h>
20 #include <linux/kdev_t.h>
30 #include <asm/pgtable.h>
35 #include <asm/machdep.h>
37 #include <asm/pci-bridge.h>
43 #include <asm/i8259.h>
71 #define ARCADIA_HOST_BRIDGE_IDSEL 17
72 #define ARCADIA_2ND_BRIDGE_IDSEL 3
78 if ((bus == 1) && (
PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
80 if ((bus == 0) && (
PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
86 static void mpc85xx_cds_restart(
char *
cmd)
95 pci_read_config_byte(dev, 0x47, &tmp);
96 pci_write_config_byte(dev, 0x47, tmp | 1);
99 pci_read_config_byte(dev, 0x47, &tmp);
114 fsl_rstcr_restart(
NULL);
117 static void __init mpc85xx_cds_pci_irq_fixup(
struct pci_dev *dev)
127 pci_read_config_byte(dev, 0x40, &c);
129 pci_write_config_byte(dev, 0x40, c);
167 #define PCI_DEVICE_ID_IDT_TSI310 0x01a7
174 void mpc85xx_cds_fixup_bus(
struct pci_bus *
bus)
181 dev->
device == PCI_DEVICE_ID_IDT_TSI310) {
186 pr_info(
"mpc85xx_cds: PCI bridge resource fixup applied\n");
187 pr_info(
"mpc85xx_cds: %pR\n", res);
191 fsl_pcibios_fixup_bus(bus);
194 #ifdef CONFIG_PPC_I8259
195 static void mpc85xx_8259_cascade_handler(
unsigned int irq,
200 if (cascade_irq !=
NO_IRQ)
213 static struct irqaction mpc85xxcds_8259_irqaction = {
214 .
handler = mpc85xx_8259_cascade_action,
216 .name =
"8259 cascade",
221 static void __init mpc85xx_cds_pic_init(
void)
225 0, 256,
" OpenPIC ");
230 #if defined(CONFIG_PPC_I8259) && defined(CONFIG_PCI)
231 static int mpc85xx_cds_8259_attach(
void)
239 for_each_node_by_type(np,
"interrupt-controller")
245 if (cascade_node ==
NULL) {
251 if (cascade_irq ==
NO_IRQ) {
257 of_node_put(cascade_node);
265 if ((ret =
setup_irq(cascade_irq, &mpc85xxcds_8259_irqaction))) {
271 irq_set_handler(cascade_irq, mpc85xx_8259_cascade_handler);
279 static void mpc85xx_cds_pci_assign_primary(
void)
296 np = fsl_pci_primary;
309 static void __init mpc85xx_cds_setup_arch(
void)
315 ppc_md.progress(
"mpc85xx_cds_setup_arch()", 0);
319 pr_err(
"Could not find FPGA node.\n");
326 pr_err(
"Fail to map FPGA area.\n");
332 cds_pci_slot = ((
in_8(&cadmus->
cm_csr) >> 6) & 0x3) + 1;
333 snprintf(buf, 40,
"CDS Version = 0x%x in slot %d\n",
339 ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
340 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
343 mpc85xx_cds_pci_assign_primary();
344 fsl_pci_assign_primary();
347 static void mpc85xx_cds_show_cpuinfo(
struct seq_file *
m)
349 uint pvid, svid, phid1;
352 svid =
mfspr(SPRN_SVR);
354 seq_printf(m,
"Vendor\t\t: Freescale Semiconductor\n");
355 seq_printf(m,
"Machine\t\t: MPC85xx CDS (0x%x)\n",
361 phid1 =
mfspr(SPRN_HID1);
362 seq_printf(m,
"PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
369 static int __init mpc85xx_cds_probe(
void)
371 unsigned long root = of_get_flat_dt_root();
373 return of_flat_dt_is_compatible(root,
"MPC85xxCDS");
379 .name =
"MPC85xx CDS",
380 .probe = mpc85xx_cds_probe,
381 .setup_arch = mpc85xx_cds_setup_arch,
382 .init_IRQ = mpc85xx_cds_pic_init,
383 .show_cpuinfo = mpc85xx_cds_show_cpuinfo,
386 .restart = mpc85xx_cds_restart,
387 .pcibios_fixup_bus = mpc85xx_cds_fixup_bus,
389 .restart = fsl_rstcr_restart,