0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <linux/stddef.h>
0018 #include <linux/kernel.h>
0019 #include <linux/pci.h>
0020 #include <linux/kdev_t.h>
0021 #include <linux/console.h>
0022 #include <linux/extable.h>
0023 #include <linux/delay.h>
0024 #include <linux/irq.h>
0025 #include <linux/seq_file.h>
0026 #include <linux/root_dev.h>
0027 #include <linux/serial.h>
0028 #include <linux/tty.h>
0029 #include <linux/serial_core.h>
0030 #include <linux/of_irq.h>
0031
0032 #include <asm/time.h>
0033 #include <asm/machdep.h>
0034 #include <asm/udbg.h>
0035 #include <asm/tsi108.h>
0036 #include <asm/pci-bridge.h>
0037 #include <asm/reg.h>
0038 #include <mm/mmu_decl.h>
0039 #include <asm/tsi108_pci.h>
0040 #include <asm/tsi108_irq.h>
0041 #include <asm/mpic.h>
0042
0043 #undef DEBUG
0044 #ifdef DEBUG
0045 #define DBG(fmt...) do { printk(fmt); } while(0)
0046 #else
0047 #define DBG(fmt...) do { } while(0)
0048 #endif
0049
0050 #define MPC7448HPC2_PCI_CFG_PHYS 0xfb000000
0051
0052 int mpc7448_hpc2_exclude_device(struct pci_controller *hose,
0053 u_char bus, u_char devfn)
0054 {
0055 if (bus == 0 && PCI_SLOT(devfn) == 0)
0056 return PCIBIOS_DEVICE_NOT_FOUND;
0057 else
0058 return PCIBIOS_SUCCESSFUL;
0059 }
0060
0061 static void __init mpc7448_hpc2_setup_pci(void)
0062 {
0063 #ifdef CONFIG_PCI
0064 struct device_node *np;
0065 if (ppc_md.progress)
0066 ppc_md.progress("mpc7448_hpc2_setup_pci():set_bridge", 0);
0067
0068
0069 for_each_compatible_node(np, "pci", "tsi108-pci")
0070 tsi108_setup_pci(np, MPC7448HPC2_PCI_CFG_PHYS, 0);
0071
0072 ppc_md.pci_exclude_device = mpc7448_hpc2_exclude_device;
0073 if (ppc_md.progress)
0074 ppc_md.progress("tsi108: resources set", 0x100);
0075 #endif
0076 }
0077
0078 static void __init mpc7448_hpc2_setup_arch(void)
0079 {
0080 tsi108_csr_vir_base = get_vir_csrbase();
0081
0082 printk(KERN_INFO "MPC7448HPC2 (TAIGA) Platform\n");
0083 printk(KERN_INFO
0084 "Jointly ported by Freescale and Tundra Semiconductor\n");
0085 printk(KERN_INFO
0086 "Enabling L2 cache then enabling the HID0 prefetch engine.\n");
0087 }
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100 static void __init mpc7448_hpc2_init_IRQ(void)
0101 {
0102 struct mpic *mpic;
0103 #ifdef CONFIG_PCI
0104 unsigned int cascade_pci_irq;
0105 struct device_node *tsi_pci;
0106 struct device_node *cascade_node = NULL;
0107 #endif
0108
0109 mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
0110 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
0111 24, 0,
0112 "Tsi108_PIC");
0113
0114 BUG_ON(mpic == NULL);
0115
0116 mpic_assign_isu(mpic, 0, mpic->paddr + 0x100);
0117
0118 mpic_init(mpic);
0119
0120 #ifdef CONFIG_PCI
0121 tsi_pci = of_find_node_by_type(NULL, "pci");
0122 if (tsi_pci == NULL) {
0123 printk("%s: No tsi108 pci node found !\n", __func__);
0124 return;
0125 }
0126 cascade_node = of_find_node_by_type(NULL, "pic-router");
0127 if (cascade_node == NULL) {
0128 printk("%s: No tsi108 pci cascade node found !\n", __func__);
0129 return;
0130 }
0131
0132 cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0);
0133 DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __func__,
0134 (u32) cascade_pci_irq);
0135 tsi108_pci_int_init(cascade_node);
0136 irq_set_handler_data(cascade_pci_irq, mpic);
0137 irq_set_chained_handler(cascade_pci_irq, tsi108_irq_cascade);
0138 #endif
0139
0140 tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
0141 }
0142
0143 void mpc7448_hpc2_show_cpuinfo(struct seq_file *m)
0144 {
0145 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
0146 }
0147
0148 static void __noreturn mpc7448_hpc2_restart(char *cmd)
0149 {
0150 local_irq_disable();
0151
0152
0153 mtmsr(mfmsr() | MSR_IP);
0154 isync();
0155
0156 for (;;) ;
0157 }
0158
0159
0160
0161
0162 static int __init mpc7448_hpc2_probe(void)
0163 {
0164 if (!of_machine_is_compatible("mpc74xx"))
0165 return 0;
0166 return 1;
0167 }
0168
0169 static int mpc7448_machine_check_exception(struct pt_regs *regs)
0170 {
0171 const struct exception_table_entry *entry;
0172
0173
0174 if ((entry = search_exception_tables(regs->nip)) != NULL) {
0175 tsi108_clear_pci_cfg_error();
0176 regs_set_recoverable(regs);
0177 regs_set_return_ip(regs, extable_fixup(entry));
0178 return 1;
0179 }
0180 return 0;
0181 }
0182
0183 define_machine(mpc7448_hpc2){
0184 .name = "MPC7448 HPC2",
0185 .probe = mpc7448_hpc2_probe,
0186 .setup_arch = mpc7448_hpc2_setup_arch,
0187 .discover_phbs = mpc7448_hpc2_setup_pci,
0188 .init_IRQ = mpc7448_hpc2_init_IRQ,
0189 .show_cpuinfo = mpc7448_hpc2_show_cpuinfo,
0190 .get_irq = mpic_get_irq,
0191 .restart = mpc7448_hpc2_restart,
0192 .calibrate_decr = generic_calibrate_decr,
0193 .machine_check_exception= mpc7448_machine_check_exception,
0194 .progress = udbg_progress,
0195 };