Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] Update mpc7448hpc2 board irq support using device tree

The patch rewrites mpc7448hpc2 board irq support according to the new
mpic device tree interface.

Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Zang Roy-r61911 and committed by
Paul Mackerras
c4342ff9 6cdd2bdf

+174 -68
+24 -49
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
··· 1 1 /* 2 2 * mpc7448_hpc2.c 3 3 * 4 - * Board setup routines for the Freescale Taiga platform 4 + * Board setup routines for the Freescale mpc7448hpc2(taiga) platform 5 5 * 6 6 * Author: Jacob Pan 7 7 * jacob.pan@freescale.com ··· 12 12 * 13 13 * Copyright 2004-2006 Freescale Semiconductor, Inc. 14 14 * 15 - * This file is licensed under 16 - * the terms of the GNU General Public License version 2. This program 17 - * is licensed "as is" without any warranty of any kind, whether express 18 - * or implied. 15 + * This program is free software; you can redistribute it and/or 16 + * modify it under the terms of the GNU General Public License 17 + * as published by the Free Software Foundation; either version 18 + * 2 of the License, or (at your option) any later version. 19 19 */ 20 20 21 21 #include <linux/config.h> ··· 62 62 extern int tsi108_setup_pci(struct device_node *dev); 63 63 extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); 64 64 extern void tsi108_pci_int_init(void); 65 - extern int tsi108_irq_cascade(struct pt_regs *regs, void *unused); 66 - 67 - /* 68 - * Define all of the IRQ senses and polarities. Taken from the 69 - * mpc7448hpc manual. 70 - * Note: Likely, this table and the following function should be 71 - * obtained and derived from the OF Device Tree. 72 - */ 73 - 74 - static u_char mpc7448_hpc2_pic_initsenses[] __initdata = { 75 - /* External on-board sources */ 76 - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[0] XINT0 from FPGA */ 77 - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[1] XINT1 from FPGA */ 78 - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[2] PHY_INT from both GIGE */ 79 - (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[3] RESERVED */ 80 - /* Internal Tsi108/109 interrupt sources */ 81 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */ 82 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */ 83 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */ 84 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */ 85 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA0 */ 86 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA1 */ 87 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA2 */ 88 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA3 */ 89 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* UART0 */ 90 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* UART1 */ 91 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* I2C */ 92 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* GPIO */ 93 - (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* GIGE0 */ 94 - (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* GIGE1 */ 95 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */ 96 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* HLP */ 97 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* SDC */ 98 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Processor IF */ 99 - (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */ 100 - (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* PCI/X block */ 101 - }; 65 + extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc, 66 + struct pt_regs *regs); 102 67 103 68 int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) 104 69 { ··· 194 229 { 195 230 struct mpic *mpic; 196 231 phys_addr_t mpic_paddr = 0; 232 + unsigned int cascade_pci_irq; 233 + struct device_node *tsi_pci; 197 234 struct device_node *tsi_pic; 198 235 199 236 tsi_pic = of_find_node_by_type(NULL, "open-pic"); ··· 213 246 DBG("%s: tsi108pic phys_addr = 0x%x\n", __FUNCTION__, 214 247 (u32) mpic_paddr); 215 248 216 - mpic = mpic_alloc(mpic_paddr, 249 + mpic = mpic_alloc(tsi_pic, mpic_paddr, 217 250 MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET | 218 251 MPIC_SPV_EOI | MPIC_MOD_ID(MPIC_ID_TSI108), 219 252 0, /* num_sources used */ 220 - TSI108_IRQ_BASE, 221 253 0, /* num_sources used */ 222 - NR_IRQS - 4 /* XXXX */, 223 - mpc7448_hpc2_pic_initsenses, 224 - sizeof(mpc7448_hpc2_pic_initsenses), "Tsi108_PIC"); 254 + "Tsi108_PIC"); 225 255 226 256 BUG_ON(mpic == NULL); /* XXXX */ 227 - 228 257 mpic_init(mpic); 229 - mpic_setup_cascade(IRQ_TSI108_PCI, tsi108_irq_cascade, mpic); 258 + 259 + tsi_pci = of_find_node_by_type(NULL, "pci"); 260 + if (tsi_pci == 0) { 261 + printk("%s: No tsi108 pci node found !\n", __FUNCTION__); 262 + return; 263 + } 264 + 265 + cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0); 266 + set_irq_data(cascade_pci_irq, mpic); 267 + set_irq_chained_handler(cascade_pci_irq, tsi108_irq_cascade); 268 + 230 269 tsi108_pci_int_init(); 231 270 232 271 /* Configure MPIC outputs to CPU0 */ 233 272 tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0); 273 + of_node_put(tsi_pic); 234 274 } 235 275 236 276 void mpc7448_hpc2_show_cpuinfo(struct seq_file *m) ··· 294 320 return 0; 295 321 296 322 } 323 + 297 324 define_machine(mpc7448_hpc2){ 298 325 .name = "MPC7448 HPC2", 299 326 .probe = mpc7448_hpc2_probe,
+6 -4
arch/powerpc/sysdev/tsi108_dev.c
··· 93 93 goto err; 94 94 95 95 r[1].name = "tx"; 96 - r[1].start = np->intrs[0].line; 97 - r[1].end = np->intrs[0].line; 96 + r[1].start = irq_of_parse_and_map(np, 0); 97 + r[1].end = irq_of_parse_and_map(np, 0); 98 98 r[1].flags = IORESOURCE_IRQ; 99 + DBG("%s: name:start->end = %s:0x%lx-> 0x%lx\n", 100 + __FUNCTION__,r[1].name, r[1].start, r[1].end); 99 101 100 102 tsi_eth_dev = 101 103 platform_device_register_simple("tsi-ethernet", i, &r[0], 102 - np->n_intrs + 1); 104 + 1); 103 105 104 106 if (IS_ERR(tsi_eth_dev)) { 105 107 ret = PTR_ERR(tsi_eth_dev); ··· 129 127 tsi_eth_data.regs = r[0].start; 130 128 tsi_eth_data.phyregs = res.start; 131 129 tsi_eth_data.phy = *phy_id; 132 - tsi_eth_data.irq_num = np->intrs[0].line; 130 + tsi_eth_data.irq_num = irq_of_parse_and_map(np, 0); 133 131 of_node_put(phy); 134 132 ret = 135 133 platform_device_add_data(tsi_eth_dev, &tsi_eth_data,
+12 -9
arch/powerpc/sysdev/tsi108_pci.c
··· 26 26 #include <linux/irq.h> 27 27 #include <linux/interrupt.h> 28 28 29 - 30 29 #include <asm/byteorder.h> 31 30 #include <asm/io.h> 32 31 #include <asm/irq.h> ··· 227 228 228 229 (hose)->ops = &tsi108_direct_pci_ops; 229 230 230 - printk(KERN_INFO "Found tsi108 PCI host bridge at 0x%08lx. " 231 + printk(KERN_INFO "Found tsi108 PCI host bridge at 0x%08x. " 231 232 "Firmware bus number: %d->%d\n", 232 233 rsrc.start, hose->first_busno, hose->last_busno); 233 234 ··· 277 278 mb(); 278 279 } 279 280 280 - static inline int get_pci_source(void) 281 + static inline unsigned int get_pci_source(void) 281 282 { 282 283 u_int temp = 0; 283 284 int irq = -1; ··· 370 371 * Interrupt controller descriptor for cascaded PCI interrupt controller. 371 372 */ 372 373 373 - struct hw_interrupt_type tsi108_pci_irq = { 374 + static struct irq_chip tsi108_pci_irq = { 374 375 .typename = "tsi108_PCI_int", 375 - .enable = tsi108_pci_irq_enable, 376 - .disable = tsi108_pci_irq_disable, 376 + .mask = tsi108_pci_irq_disable, 377 377 .ack = tsi108_pci_irq_ack, 378 378 .end = tsi108_pci_irq_end, 379 + .unmask = tsi108_pci_irq_enable, 379 380 }; 380 381 381 382 /* ··· 398 399 DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); 399 400 400 401 for (i = 0; i < NUM_PCI_IRQS; i++) { 401 - irq_desc[i + IRQ_PCI_INTAD_BASE].handler = &tsi108_pci_irq; 402 + irq_desc[i + IRQ_PCI_INTAD_BASE].chip = &tsi108_pci_irq; 402 403 irq_desc[i + IRQ_PCI_INTAD_BASE].status |= IRQ_LEVEL; 403 404 } 404 405 405 406 init_pci_source(); 406 407 } 407 408 408 - int tsi108_irq_cascade(struct pt_regs *regs, void *unused) 409 + void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc, 410 + struct pt_regs *regs) 409 411 { 410 - return get_pci_source(); 412 + unsigned int cascade_irq = get_pci_source(); 413 + if (cascade_irq != NO_IRQ) 414 + generic_handle_irq(cascade_irq, regs); 415 + desc->chip->eoi(irq); 411 416 }
+8 -6
include/asm-powerpc/tsi108.h
··· 1 1 /* 2 - * include/asm-ppc/tsi108.h 3 - * 4 2 * common routine and memory layout for Tundra TSI108(Grendel) host bridge 5 3 * memory controller. 6 4 * 7 5 * Author: Jacob Pan (jacob.pan@freescale.com) 8 6 * Alex Bounine (alexandreb@tundra.com) 9 - * 2004 (c) Freescale Semiconductor Inc. This file is licensed under 10 - * the terms of the GNU General Public License version 2. This program 11 - * is licensed "as is" without any warranty of any kind, whether express 12 - * or implied. 7 + * 8 + * Copyright 2004-2006 Freescale Semiconductor, Inc. 9 + * 10 + * This program is free software; you can redistribute it and/or 11 + * modify it under the terms of the GNU General Public License 12 + * as published by the Free Software Foundation; either version 13 + * 2 of the License, or (at your option) any later version. 13 14 */ 15 + 14 16 #ifndef __PPC_KERNEL_TSI108_H 15 17 #define __PPC_KERNEL_TSI108_H 16 18
+124
include/asm-powerpc/tsi108_irq.h
··· 1 + /* 2 + * (C) Copyright 2005 Tundra Semiconductor Corp. 3 + * Alex Bounine, <alexandreb at tundra.com). 4 + * 5 + * See file CREDITS for list of people who contributed to this 6 + * project. 7 + * 8 + * This program is free software; you can redistribute it and/or 9 + * modify it under the terms of the GNU General Public License as 10 + * published by the Free Software Foundation; either version 2 of 11 + * the License, or (at your option) any later version. 12 + * 13 + * This program is distributed in the hope that it will be useful, 14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + * GNU General Public License for more details. 17 + * 18 + * You should have received a copy of the GNU General Public License 19 + * along with this program; if not, write to the Free Software 20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 + * MA 02111-1307 USA 22 + */ 23 + 24 + /* 25 + * definitions for interrupt controller initialization and external interrupt 26 + * demultiplexing on TSI108EMU/SVB boards. 27 + */ 28 + 29 + #ifndef _ASM_PPC_TSI108_IRQ_H 30 + #define _ASM_PPC_TSI108_IRQ_H 31 + 32 + /* 33 + * Tsi108 interrupts 34 + */ 35 + #ifndef TSI108_IRQ_REG_BASE 36 + #define TSI108_IRQ_REG_BASE 0 37 + #endif 38 + 39 + #define TSI108_IRQ(x) (TSI108_IRQ_REG_BASE + (x)) 40 + 41 + #define TSI108_MAX_VECTORS (36 + 4) /* 36 sources + PCI INT demux */ 42 + #define MAX_TASK_PRIO 0xF 43 + 44 + #define TSI108_IRQ_SPURIOUS (TSI108_MAX_VECTORS) 45 + 46 + #define DEFAULT_PRIO_LVL 10 /* initial priority level */ 47 + 48 + /* Interrupt vectors assignment to external and internal 49 + * sources of requests. */ 50 + 51 + /* EXTERNAL INTERRUPT SOURCES */ 52 + 53 + #define IRQ_TSI108_EXT_INT0 TSI108_IRQ(0) /* External Source at INT[0] */ 54 + #define IRQ_TSI108_EXT_INT1 TSI108_IRQ(1) /* External Source at INT[1] */ 55 + #define IRQ_TSI108_EXT_INT2 TSI108_IRQ(2) /* External Source at INT[2] */ 56 + #define IRQ_TSI108_EXT_INT3 TSI108_IRQ(3) /* External Source at INT[3] */ 57 + 58 + /* INTERNAL INTERRUPT SOURCES */ 59 + 60 + #define IRQ_TSI108_RESERVED0 TSI108_IRQ(4) /* Reserved IRQ */ 61 + #define IRQ_TSI108_RESERVED1 TSI108_IRQ(5) /* Reserved IRQ */ 62 + #define IRQ_TSI108_RESERVED2 TSI108_IRQ(6) /* Reserved IRQ */ 63 + #define IRQ_TSI108_RESERVED3 TSI108_IRQ(7) /* Reserved IRQ */ 64 + #define IRQ_TSI108_DMA0 TSI108_IRQ(8) /* DMA0 */ 65 + #define IRQ_TSI108_DMA1 TSI108_IRQ(9) /* DMA1 */ 66 + #define IRQ_TSI108_DMA2 TSI108_IRQ(10) /* DMA2 */ 67 + #define IRQ_TSI108_DMA3 TSI108_IRQ(11) /* DMA3 */ 68 + #define IRQ_TSI108_UART0 TSI108_IRQ(12) /* UART0 */ 69 + #define IRQ_TSI108_UART1 TSI108_IRQ(13) /* UART1 */ 70 + #define IRQ_TSI108_I2C TSI108_IRQ(14) /* I2C */ 71 + #define IRQ_TSI108_GPIO TSI108_IRQ(15) /* GPIO */ 72 + #define IRQ_TSI108_GIGE0 TSI108_IRQ(16) /* GIGE0 */ 73 + #define IRQ_TSI108_GIGE1 TSI108_IRQ(17) /* GIGE1 */ 74 + #define IRQ_TSI108_RESERVED4 TSI108_IRQ(18) /* Reserved IRQ */ 75 + #define IRQ_TSI108_HLP TSI108_IRQ(19) /* HLP */ 76 + #define IRQ_TSI108_SDRAM TSI108_IRQ(20) /* SDC */ 77 + #define IRQ_TSI108_PROC_IF TSI108_IRQ(21) /* Processor IF */ 78 + #define IRQ_TSI108_RESERVED5 TSI108_IRQ(22) /* Reserved IRQ */ 79 + #define IRQ_TSI108_PCI TSI108_IRQ(23) /* PCI/X block */ 80 + 81 + #define IRQ_TSI108_MBOX0 TSI108_IRQ(24) /* Mailbox 0 register */ 82 + #define IRQ_TSI108_MBOX1 TSI108_IRQ(25) /* Mailbox 1 register */ 83 + #define IRQ_TSI108_MBOX2 TSI108_IRQ(26) /* Mailbox 2 register */ 84 + #define IRQ_TSI108_MBOX3 TSI108_IRQ(27) /* Mailbox 3 register */ 85 + 86 + #define IRQ_TSI108_DBELL0 TSI108_IRQ(28) /* Doorbell 0 */ 87 + #define IRQ_TSI108_DBELL1 TSI108_IRQ(29) /* Doorbell 1 */ 88 + #define IRQ_TSI108_DBELL2 TSI108_IRQ(30) /* Doorbell 2 */ 89 + #define IRQ_TSI108_DBELL3 TSI108_IRQ(31) /* Doorbell 3 */ 90 + 91 + #define IRQ_TSI108_TIMER0 TSI108_IRQ(32) /* Global Timer 0 */ 92 + #define IRQ_TSI108_TIMER1 TSI108_IRQ(33) /* Global Timer 1 */ 93 + #define IRQ_TSI108_TIMER2 TSI108_IRQ(34) /* Global Timer 2 */ 94 + #define IRQ_TSI108_TIMER3 TSI108_IRQ(35) /* Global Timer 3 */ 95 + 96 + /* 97 + * PCI bus INTA# - INTD# lines demultiplexor 98 + */ 99 + #define IRQ_PCI_INTAD_BASE TSI108_IRQ(36) 100 + #define IRQ_PCI_INTA (IRQ_PCI_INTAD_BASE + 0) 101 + #define IRQ_PCI_INTB (IRQ_PCI_INTAD_BASE + 1) 102 + #define IRQ_PCI_INTC (IRQ_PCI_INTAD_BASE + 2) 103 + #define IRQ_PCI_INTD (IRQ_PCI_INTAD_BASE + 3) 104 + #define NUM_PCI_IRQS (4) 105 + 106 + /* number of entries in vector dispatch table */ 107 + #define IRQ_TSI108_TAB_SIZE (TSI108_MAX_VECTORS + 1) 108 + 109 + /* Mapping of MPIC outputs to processors' interrupt pins */ 110 + 111 + #define IDIR_INT_OUT0 0x1 112 + #define IDIR_INT_OUT1 0x2 113 + #define IDIR_INT_OUT2 0x4 114 + #define IDIR_INT_OUT3 0x8 115 + 116 + /*--------------------------------------------------------------- 117 + * IRQ line configuration parameters */ 118 + 119 + /* Interrupt delivery modes */ 120 + typedef enum { 121 + TSI108_IRQ_DIRECTED, 122 + TSI108_IRQ_DISTRIBUTED, 123 + } TSI108_IRQ_MODE; 124 + #endif /* _ASM_PPC_TSI108_IRQ_H */