2019-05-27 09:55:01 +03:00
// SPDX-License-Identifier: GPL-2.0-or-later
2008-07-02 20:46:20 +04:00
/*
* Copyright 2008 Freescale Semiconductor , Inc .
*/
# include <linux/stddef.h>
# include <linux/kernel.h>
# include <linux/interrupt.h>
2013-09-26 16:40:04 +04:00
# include <linux/of_irq.h>
2008-07-02 20:46:20 +04:00
# include <linux/of_platform.h>
# include <asm/mpic.h>
# include <asm/i8259.h>
# ifdef CONFIG_PPC_I8259
2015-09-14 11:42:37 +03:00
static void mpc86xx_8259_cascade ( struct irq_desc * desc )
2008-07-02 20:46:20 +04:00
{
2011-03-25 18:45:20 +03:00
struct irq_chip * chip = irq_desc_get_chip ( desc ) ;
2008-07-02 20:46:20 +04:00
unsigned int cascade_irq = i8259_irq ( ) ;
2011-03-07 16:59:23 +03:00
2016-09-06 14:53:24 +03:00
if ( cascade_irq )
2008-07-02 20:46:20 +04:00
generic_handle_irq ( cascade_irq ) ;
2011-03-07 16:59:23 +03:00
chip - > irq_eoi ( & desc - > irq_data ) ;
2008-07-02 20:46:20 +04:00
}
# endif /* CONFIG_PPC_I8259 */
void __init mpc86xx_init_irq ( void )
{
# ifdef CONFIG_PPC_I8259
2011-12-02 10:28:02 +04:00
struct device_node * np ;
2008-07-02 20:46:20 +04:00
struct device_node * cascade_node = NULL ;
int cascade_irq ;
# endif
2011-12-22 14:19:14 +04:00
struct mpic * mpic = mpic_alloc ( NULL , 0 , MPIC_BIG_ENDIAN |
2011-12-22 14:19:12 +04:00
MPIC_SINGLE_DEST_CPU ,
2008-07-02 20:46:20 +04:00
0 , 256 , " MPIC " ) ;
BUG_ON ( mpic = = NULL ) ;
mpic_init ( mpic ) ;
# ifdef CONFIG_PPC_I8259
/* Initialize i8259 controller */
for_each_node_by_type ( np , " interrupt-controller " )
if ( of_device_is_compatible ( np , " chrp,iic " ) ) {
cascade_node = np ;
break ;
}
if ( cascade_node = = NULL ) {
printk ( KERN_DEBUG " Could not find i8259 PIC \n " ) ;
return ;
}
cascade_irq = irq_of_parse_and_map ( cascade_node , 0 ) ;
2016-09-06 14:53:24 +03:00
if ( ! cascade_irq ) {
2008-07-02 20:46:20 +04:00
printk ( KERN_ERR " Failed to map cascade interrupt \n " ) ;
return ;
}
i8259_init ( cascade_node , 0 ) ;
of_node_put ( cascade_node ) ;
2011-03-25 18:45:20 +03:00
irq_set_chained_handler ( cascade_irq , mpc86xx_8259_cascade ) ;
2008-07-02 20:46:20 +04:00
# endif
}