Skip to content

Commit

Permalink
patch-mxc-fiq
Browse files Browse the repository at this point in the history
Drivers which are going to use it will have to select it and use
mxc_set_irq_fiq() to set FIQ mode for this interrupt.

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
  • Loading branch information
Paulius Zaleckas authored and Sascha Hauer committed Dec 16, 2008
1 parent bd006a9 commit d7927e1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/arm/plat-mxc/include/mach/irqs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@
#include <mach/hardware.h>
extern void imx_irq_set_priority(unsigned char irq, unsigned char prio);

/* all normal IRQs can be FIQs */
#define FIQ_START 0
/* switch betwean IRQ and FIQ */
extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);

#endif /* __ASM_ARCH_MXC_IRQS_H__ */
29 changes: 29 additions & 0 deletions arch/arm/plat-mxc/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
* MA 02110-1301, USA.
*/

#include <linux/module.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <mach/common.h>
#include <asm/mach/irq.h>

#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */
Expand Down Expand Up @@ -65,6 +67,28 @@ void imx_irq_set_priority(unsigned char irq, unsigned char prio)
EXPORT_SYMBOL(imx_irq_set_priority);
#endif

#ifdef CONFIG_FIQ
int mxc_set_irq_fiq(unsigned int irq, unsigned int type)
{
unsigned int irqt;

if (irq >= MXC_MAX_INT_LINES)
return -EINVAL;

if (irq < MXC_MAX_INT_LINES / 2) {
irqt = __raw_readl(AVIC_INTTYPEL) & ~(1 << irq);
__raw_writel(irqt | (!!type << irq), AVIC_INTTYPEL);
} else {
irq -= MXC_MAX_INT_LINES / 2;
irqt = __raw_readl(AVIC_INTTYPEH) & ~(1 << irq);
__raw_writel(irqt | (!!type << irq), AVIC_INTTYPEH);
}

return 0;
}
EXPORT_SYMBOL(mxc_set_irq_fiq);
#endif /* CONFIG_FIQ */

/* Disable interrupt number "irq" in the AVIC */
static void mxc_mask_irq(unsigned int irq)
{
Expand Down Expand Up @@ -119,5 +143,10 @@ void __init mxc_init_irq(void)
/* init architectures chained interrupt handler */
mxc_register_gpios();

#ifdef CONFIG_FIQ
/* Initialize FIQ */
init_FIQ();
#endif

printk(KERN_INFO "MXC IRQ initialized\n");
}

0 comments on commit d7927e1

Please sign in to comment.