diff options
author | Zang Roy-r61911 <tie-fei.zang@freescale.com> | 2006-11-14 01:31:50 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 04:39:27 -0500 |
commit | 5873c9bdb05e9cc68ff4c45a192032a61f705067 (patch) | |
tree | 204582b5774f3a2519768f0c88c54763087823fb | |
parent | 533462df56db99ceba4b4124b69469aa2a46a8de (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>
-rw-r--r-- | arch/powerpc/boot/dts/mpc7448hpc2.dts | 44 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | 88 | ||||
-rw-r--r-- | arch/powerpc/sysdev/tsi108_pci.c | 48 |
3 files changed, 93 insertions, 87 deletions
diff --git a/arch/powerpc/boot/dts/mpc7448hpc2.dts b/arch/powerpc/boot/dts/mpc7448hpc2.dts index d7b985e6bd2f..c4d9562cbaad 100644 --- a/arch/powerpc/boot/dts/mpc7448hpc2.dts +++ b/arch/powerpc/boot/dts/mpc7448hpc2.dts | |||
@@ -161,29 +161,41 @@ | |||
161 | interrupt-map = < | 161 | interrupt-map = < |
162 | 162 | ||
163 | /* IDSEL 0x11 */ | 163 | /* IDSEL 0x11 */ |
164 | 0800 0 0 1 7400 24 0 | 164 | 0800 0 0 1 1180 24 0 |
165 | 0800 0 0 2 7400 25 0 | 165 | 0800 0 0 2 1180 25 0 |
166 | 0800 0 0 3 7400 26 0 | 166 | 0800 0 0 3 1180 26 0 |
167 | 0800 0 0 4 7400 27 0 | 167 | 0800 0 0 4 1180 27 0 |
168 | 168 | ||
169 | /* IDSEL 0x12 */ | 169 | /* IDSEL 0x12 */ |
170 | 1000 0 0 1 7400 25 0 | 170 | 1000 0 0 1 1180 25 0 |
171 | 1000 0 0 2 7400 26 0 | 171 | 1000 0 0 2 1180 26 0 |
172 | 1000 0 0 3 7400 27 0 | 172 | 1000 0 0 3 1180 27 0 |
173 | 1000 0 0 4 7400 24 0 | 173 | 1000 0 0 4 1180 24 0 |
174 | 174 | ||
175 | /* IDSEL 0x13 */ | 175 | /* IDSEL 0x13 */ |
176 | 1800 0 0 1 7400 26 0 | 176 | 1800 0 0 1 1180 26 0 |
177 | 1800 0 0 2 7400 27 0 | 177 | 1800 0 0 2 1180 27 0 |
178 | 1800 0 0 3 7400 24 0 | 178 | 1800 0 0 3 1180 24 0 |
179 | 1800 0 0 4 7400 25 0 | 179 | 1800 0 0 4 1180 25 0 |
180 | 180 | ||
181 | /* IDSEL 0x14 */ | 181 | /* IDSEL 0x14 */ |
182 | 2000 0 0 1 7400 27 0 | 182 | 2000 0 0 1 1180 27 0 |
183 | 2000 0 0 2 7400 24 0 | 183 | 2000 0 0 2 1180 24 0 |
184 | 2000 0 0 3 7400 25 0 | 184 | 2000 0 0 3 1180 25 0 |
185 | 2000 0 0 4 7400 26 0 | 185 | 2000 0 0 4 1180 26 0 |
186 | >; | 186 | >; |
187 | router@1180 { | ||
188 | linux,phandle = <1180>; | ||
189 | clock-frequency = <0>; | ||
190 | interrupt-controller; | ||
191 | device_type = "pic-router"; | ||
192 | #address-cells = <0>; | ||
193 | #interrupt-cells = <2>; | ||
194 | built-in; | ||
195 | big-endian; | ||
196 | interrupts = <17 2>; | ||
197 | interrupt-parent = <7400>; | ||
198 | }; | ||
187 | }; | 199 | }; |
188 | }; | 200 | }; |
189 | 201 | ||
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 | ||
61 | extern int tsi108_setup_pci(struct device_node *dev); | 61 | extern int tsi108_setup_pci(struct device_node *dev); |
62 | extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); | 62 | extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); |
63 | extern void tsi108_pci_int_init(void); | 63 | extern void tsi108_pci_int_init(struct device_node *node); |
64 | extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc); | 64 | extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc); |
65 | 65 | ||
66 | int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) | 66 | int 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 | */ | ||
77 | u8 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 | */ | ||
92 | void __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 | |||
127 | static void __init mpc7448_hpc2_setup_arch(void) | 74 | static 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 | ||
290 | define_machine(mpc7448_hpc2){ | 249 | define_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, |
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c index 322f86e93de5..ae249c6bbbcf 100644 --- a/arch/powerpc/sysdev/tsi108_pci.c +++ b/arch/powerpc/sysdev/tsi108_pci.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * | 3 | * |
4 | * 2004-2005 (c) Tundra Semiconductor Corp. | 4 | * 2004-2005 (c) Tundra Semiconductor Corp. |
5 | * Author: Alex Bounine (alexandreb@tundra.com) | 5 | * Author: Alex Bounine (alexandreb@tundra.com) |
6 | * Author: Roy Zang (tie-fei.zang@freescale.com) | ||
7 | * Add pci interrupt router host | ||
6 | * | 8 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms of the GNU General Public License as published by the Free | 10 | * under the terms of the GNU General Public License as published by the Free |
@@ -48,6 +50,8 @@ | |||
48 | 50 | ||
49 | u32 tsi108_pci_cfg_base; | 51 | u32 tsi108_pci_cfg_base; |
50 | u32 tsi108_csr_vir_base; | 52 | u32 tsi108_csr_vir_base; |
53 | static struct device_node *pci_irq_node; | ||
54 | static struct irq_host *pci_irq_host; | ||
51 | 55 | ||
52 | extern u32 get_vir_csrbase(void); | 56 | extern u32 get_vir_csrbase(void); |
53 | extern u32 tsi108_read_reg(u32 reg_offset); | 57 | extern u32 tsi108_read_reg(u32 reg_offset); |
@@ -378,6 +382,38 @@ static struct irq_chip tsi108_pci_irq = { | |||
378 | .unmask = tsi108_pci_irq_enable, | 382 | .unmask = tsi108_pci_irq_enable, |
379 | }; | 383 | }; |
380 | 384 | ||
385 | static int pci_irq_host_xlate(struct irq_host *h, struct device_node *ct, | ||
386 | u32 *intspec, unsigned int intsize, | ||
387 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | ||
388 | { | ||
389 | *out_hwirq = intspec[0]; | ||
390 | *out_flags = IRQ_TYPE_LEVEL_HIGH; | ||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | static int pci_irq_host_map(struct irq_host *h, unsigned int virq, | ||
395 | irq_hw_number_t hw) | ||
396 | { unsigned int irq; | ||
397 | DBG("%s(%d, 0x%lx)\n", __FUNCTION__, virq, hw); | ||
398 | if ((virq >= 1) && (virq <= 4)){ | ||
399 | irq = virq + IRQ_PCI_INTAD_BASE - 1; | ||
400 | get_irq_desc(irq)->status |= IRQ_LEVEL; | ||
401 | set_irq_chip(irq, &tsi108_pci_irq); | ||
402 | } | ||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static int pci_irq_host_match(struct irq_host *h, struct device_node *node) | ||
407 | { | ||
408 | return pci_irq_node == node; | ||
409 | } | ||
410 | |||
411 | static struct irq_host_ops pci_irq_host_ops = { | ||
412 | .match = pci_irq_host_match, | ||
413 | .map = pci_irq_host_map, | ||
414 | .xlate = pci_irq_host_xlate, | ||
415 | }; | ||
416 | |||
381 | /* | 417 | /* |
382 | * Exported functions | 418 | * Exported functions |
383 | */ | 419 | */ |
@@ -391,15 +427,15 @@ static struct irq_chip tsi108_pci_irq = { | |||
391 | * to the MPIC. | 427 | * to the MPIC. |
392 | */ | 428 | */ |
393 | 429 | ||
394 | void __init tsi108_pci_int_init(void) | 430 | void __init tsi108_pci_int_init(struct device_node *node) |
395 | { | 431 | { |
396 | u_int i; | ||
397 | |||
398 | DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); | 432 | DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); |
399 | 433 | ||
400 | for (i = 0; i < NUM_PCI_IRQS; i++) { | 434 | pci_irq_node = of_node_get(node); |
401 | irq_desc[i + IRQ_PCI_INTAD_BASE].chip = &tsi108_pci_irq; | 435 | pci_irq_host = irq_alloc_host(IRQ_HOST_MAP_LEGACY, 0, &pci_irq_host_ops, 0); |
402 | irq_desc[i + IRQ_PCI_INTAD_BASE].status |= IRQ_LEVEL; | 436 | if (pci_irq_host == NULL) { |
437 | printk(KERN_ERR "pci_irq_host: failed to allocate irq host !\n"); | ||
438 | return; | ||
403 | } | 439 | } |
404 | 440 | ||
405 | init_pci_source(); | 441 | init_pci_source(); |