2009-12-31 17:06:05 +03:00
/*
* linux / arch / arm / mach - nuc93x / irq . c
*
* Copyright ( c ) 2008 Nuvoton technology corporation .
*
* Wan ZongShun < mcuos . com @ gmail . com >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; version 2 of the License .
*
*/
# include <linux/init.h>
# include <linux/module.h>
# include <linux/interrupt.h>
# include <linux/ioport.h>
# include <linux/ptrace.h>
# include <linux/sysdev.h>
# include <linux/io.h>
# include <asm/irq.h>
# include <asm/mach/irq.h>
# include <mach/hardware.h>
# include <mach/regs-irq.h>
2010-11-29 12:38:52 +03:00
static void nuc93x_irq_mask ( struct irq_data * d )
2009-12-31 17:06:05 +03:00
{
2010-11-29 12:38:52 +03:00
__raw_writel ( 1 < < d - > irq , REG_AIC_MDCR ) ;
2009-12-31 17:06:05 +03:00
}
/*
* By the w90p910 spec , any irq , only write 1
* to REG_AIC_EOSCR for ACK
*/
2010-11-29 12:38:52 +03:00
static void nuc93x_irq_ack ( struct irq_data * d )
2009-12-31 17:06:05 +03:00
{
__raw_writel ( 0x01 , REG_AIC_EOSCR ) ;
}
2010-11-29 12:38:52 +03:00
static void nuc93x_irq_unmask ( struct irq_data * d )
2009-12-31 17:06:05 +03:00
{
2010-11-29 12:38:52 +03:00
__raw_writel ( 1 < < d - > irq , REG_AIC_MECR ) ;
2009-12-31 17:06:05 +03:00
}
static struct irq_chip nuc93x_irq_chip = {
2010-11-29 12:38:52 +03:00
. irq_ack = nuc93x_irq_ack ,
. irq_mask = nuc93x_irq_mask ,
. irq_unmask = nuc93x_irq_unmask ,
2009-12-31 17:06:05 +03:00
} ;
void __init nuc93x_init_irq ( void )
{
int irqno ;
__raw_writel ( 0xFFFFFFFE , REG_AIC_MDCR ) ;
for ( irqno = IRQ_WDT ; irqno < = NR_IRQS ; irqno + + ) {
2011-03-24 15:35:09 +03:00
irq_set_chip_and_handler ( irqno , & nuc93x_irq_chip ,
handle_level_irq ) ;
2009-12-31 17:06:05 +03:00
set_irq_flags ( irqno , IRQF_VALID ) ;
}
}