aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorZang Roy-r61911 <tie-fei.zang@freescale.com>2006-11-14 01:31:50 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-04 04:39:27 -0500
commit5873c9bdb05e9cc68ff4c45a192032a61f705067 (patch)
tree204582b5774f3a2519768f0c88c54763087823fb /arch/powerpc/platforms
parent533462df56db99ceba4b4124b69469aa2a46a8de (diff)
[POWERPC] Make pci_read_irq_line the default on mpc7448hpc2 board
The following patch adds a tsi108/9 pci interrupt controller host. On mpc7448hpc2 board, pci_irq_fixup function is removed, which makes the pci_read_irq_line be the default pci irq fixup. Signed-off-by: Roy Zang <tie-fei.zang@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c88
1 files changed, 23 insertions, 65 deletions
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index c6113c39009e..3fcc85f60fbf 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -60,7 +60,7 @@ pci_dram_offset = MPC7448_HPC2_PCI_MEM_OFFSET;
60 60
61extern int tsi108_setup_pci(struct device_node *dev); 61extern int tsi108_setup_pci(struct device_node *dev);
62extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); 62extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
63extern void tsi108_pci_int_init(void); 63extern void tsi108_pci_int_init(struct device_node *node);
64extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc); 64extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc);
65 65
66int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) 66int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn)
@@ -71,59 +71,6 @@ int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn)
71 return PCIBIOS_SUCCESSFUL; 71 return PCIBIOS_SUCCESSFUL;
72} 72}
73 73
74/*
75 * find pci slot by devfn in interrupt map of OF tree
76 */
77u8 find_slot_by_devfn(unsigned int *interrupt_map, unsigned int devfn)
78{
79 int i;
80 unsigned int tmp;
81 for (i = 0; i < 4; i++){
82 tmp = interrupt_map[i*4*7];
83 if ((tmp >> 11) == (devfn >> 3))
84 return i;
85 }
86 return i;
87}
88
89/*
90 * Scans the interrupt map for pci device
91 */
92void __devinit mpc7448_hpc2_fixup_irq(struct pci_dev *dev)
93{
94 struct pci_controller *hose;
95 struct device_node *node;
96 const unsigned int *interrupt;
97 int busnr;
98 int len;
99 u8 slot;
100 u8 pin;
101
102 /* Lookup the hose */
103 busnr = dev->bus->number;
104 hose = pci_bus_to_hose(busnr);
105 if (!hose)
106 printk(KERN_ERR "No pci hose found\n");
107
108 /* Check it has an OF node associated */
109 node = (struct device_node *) hose->arch_data;
110 if (!node)
111 printk(KERN_ERR "No pci node found\n");
112
113 interrupt = get_property(node, "interrupt-map", &len);
114 slot = find_slot_by_devfn(interrupt, dev->devfn);
115 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
116 if (pin == 0 || pin > 4)
117 pin = 1;
118 pin--;
119 dev->irq = interrupt[slot*4*7 + pin*7 + 5];
120
121 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
122
123 DBG("TSI_PCI: dev->irq = 0x%x\n", dev->irq);
124}
125/* temporary pci irq map fixup*/
126
127static void __init mpc7448_hpc2_setup_arch(void) 74static void __init mpc7448_hpc2_setup_arch(void)
128{ 75{
129 struct device_node *cpu; 76 struct device_node *cpu;
@@ -186,9 +133,12 @@ static void __init mpc7448_hpc2_init_IRQ(void)
186{ 133{
187 struct mpic *mpic; 134 struct mpic *mpic;
188 phys_addr_t mpic_paddr = 0; 135 phys_addr_t mpic_paddr = 0;
136 struct device_node *tsi_pic;
137#ifdef CONFIG_PCI
189 unsigned int cascade_pci_irq; 138 unsigned int cascade_pci_irq;
190 struct device_node *tsi_pci; 139 struct device_node *tsi_pci;
191 struct device_node *tsi_pic; 140 struct device_node *cascade_node = NULL;
141#endif
192 142
193 tsi_pic = of_find_node_by_type(NULL, "open-pic"); 143 tsi_pic = of_find_node_by_type(NULL, "open-pic");
194 if (tsi_pic) { 144 if (tsi_pic) {
@@ -202,31 +152,41 @@ static void __init mpc7448_hpc2_init_IRQ(void)
202 return; 152 return;
203 } 153 }
204 154
205 DBG("%s: tsi108pic phys_addr = 0x%x\n", __FUNCTION__, 155 DBG("%s: tsi108 pic phys_addr = 0x%x\n", __FUNCTION__,
206 (u32) mpic_paddr); 156 (u32) mpic_paddr);
207 157
208 mpic = mpic_alloc(tsi_pic, mpic_paddr, 158 mpic = mpic_alloc(tsi_pic, mpic_paddr,
209 MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET | 159 MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
210 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, 160 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
211 0, /* num_sources used */ 161 24,
212 0, /* num_sources used */ 162 NR_IRQS-4, /* num_sources used */
213 "Tsi108_PIC"); 163 "Tsi108_PIC");
214 164
215 BUG_ON(mpic == NULL); /* XXXX */ 165 BUG_ON(mpic == NULL);
166
167 mpic_assign_isu(mpic, 0, mpic_paddr + 0x100);
168
216 mpic_init(mpic); 169 mpic_init(mpic);
217 170
171#ifdef CONFIG_PCI
218 tsi_pci = of_find_node_by_type(NULL, "pci"); 172 tsi_pci = of_find_node_by_type(NULL, "pci");
219 if (tsi_pci == 0) { 173 if (tsi_pci == NULL) {
220 printk("%s: No tsi108 pci node found !\n", __FUNCTION__); 174 printk("%s: No tsi108 pci node found !\n", __FUNCTION__);
221 return; 175 return;
222 } 176 }
177 cascade_node = of_find_node_by_type(NULL, "pic-router");
178 if (cascade_node == NULL) {
179 printk("%s: No tsi108 pci cascade node found !\n", __FUNCTION__);
180 return;
181 }
223 182
224 cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0); 183 cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0);
184 DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __FUNCTION__,
185 (u32) cascade_pci_irq);
186 tsi108_pci_int_init(cascade_node);
225 set_irq_data(cascade_pci_irq, mpic); 187 set_irq_data(cascade_pci_irq, mpic);
226 set_irq_chained_handler(cascade_pci_irq, tsi108_irq_cascade); 188 set_irq_chained_handler(cascade_pci_irq, tsi108_irq_cascade);
227 189#endif
228 tsi108_pci_int_init();
229
230 /* Configure MPIC outputs to CPU0 */ 190 /* Configure MPIC outputs to CPU0 */
231 tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0); 191 tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
232 of_node_put(tsi_pic); 192 of_node_put(tsi_pic);
@@ -284,7 +244,6 @@ static int mpc7448_machine_check_exception(struct pt_regs *regs)
284 return 1; 244 return 1;
285 } 245 }
286 return 0; 246 return 0;
287
288} 247}
289 248
290define_machine(mpc7448_hpc2){ 249define_machine(mpc7448_hpc2){
@@ -294,7 +253,6 @@ define_machine(mpc7448_hpc2){
294 .init_IRQ = mpc7448_hpc2_init_IRQ, 253 .init_IRQ = mpc7448_hpc2_init_IRQ,
295 .show_cpuinfo = mpc7448_hpc2_show_cpuinfo, 254 .show_cpuinfo = mpc7448_hpc2_show_cpuinfo,
296 .get_irq = mpic_get_irq, 255 .get_irq = mpic_get_irq,
297 .pci_irq_fixup = mpc7448_hpc2_fixup_irq,
298 .restart = mpc7448_hpc2_restart, 256 .restart = mpc7448_hpc2_restart,
299 .calibrate_decr = generic_calibrate_decr, 257 .calibrate_decr = generic_calibrate_decr,
300 .machine_check_exception= mpc7448_machine_check_exception, 258 .machine_check_exception= mpc7448_machine_check_exception,