Path: blob/master/arch/powerpc/platforms/86xx/pic.c
10818 views
/*1* Copyright 2008 Freescale Semiconductor, Inc.2*3* This program is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License as published by the5* Free Software Foundation; either version 2 of the License, or (at your6* option) any later version.7*/89#include <linux/stddef.h>10#include <linux/kernel.h>11#include <linux/interrupt.h>12#include <linux/of_platform.h>1314#include <asm/system.h>15#include <asm/mpic.h>16#include <asm/i8259.h>1718#ifdef CONFIG_PPC_I825919static void mpc86xx_8259_cascade(unsigned int irq, struct irq_desc *desc)20{21struct irq_chip *chip = irq_desc_get_chip(desc);22unsigned int cascade_irq = i8259_irq();2324if (cascade_irq != NO_IRQ)25generic_handle_irq(cascade_irq);2627chip->irq_eoi(&desc->irq_data);28}29#endif /* CONFIG_PPC_I8259 */3031void __init mpc86xx_init_irq(void)32{33struct mpic *mpic;34struct device_node *np;35struct resource res;36#ifdef CONFIG_PPC_I825937struct device_node *cascade_node = NULL;38int cascade_irq;39#endif4041/* Determine PIC address. */42np = of_find_node_by_type(NULL, "open-pic");43if (np == NULL)44return;45of_address_to_resource(np, 0, &res);4647mpic = mpic_alloc(np, res.start,48MPIC_PRIMARY | MPIC_WANTS_RESET |49MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |50MPIC_SINGLE_DEST_CPU,510, 256, " MPIC ");52of_node_put(np);53BUG_ON(mpic == NULL);5455mpic_init(mpic);5657#ifdef CONFIG_PPC_I825958/* Initialize i8259 controller */59for_each_node_by_type(np, "interrupt-controller")60if (of_device_is_compatible(np, "chrp,iic")) {61cascade_node = np;62break;63}6465if (cascade_node == NULL) {66printk(KERN_DEBUG "Could not find i8259 PIC\n");67return;68}6970cascade_irq = irq_of_parse_and_map(cascade_node, 0);71if (cascade_irq == NO_IRQ) {72printk(KERN_ERR "Failed to map cascade interrupt\n");73return;74}7576i8259_init(cascade_node, 0);77of_node_put(cascade_node);7879irq_set_chained_handler(cascade_irq, mpc86xx_8259_cascade);80#endif81}828384