2007-07-10 04:06:53 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org>
|
2009-12-04 03:36:41 +07:00
|
|
|
* Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
|
2007-07-10 04:06:53 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
2008-12-18 17:51:57 +07:00
|
|
|
#include <mach/hardware.h>
|
|
|
|
|
2008-09-09 16:29:41 +07:00
|
|
|
#define AVIC_NIMASK 0x04
|
|
|
|
|
2007-07-10 04:06:53 +07:00
|
|
|
@ this macro disables fast irq (not implemented)
|
|
|
|
.macro disable_fiq
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro get_irqnr_preamble, base, tmp
|
2009-12-04 03:36:41 +07:00
|
|
|
#ifndef CONFIG_MXC_TZIC
|
2009-05-25 15:50:52 +07:00
|
|
|
ldr \base, =avic_base
|
|
|
|
ldr \base, [\base]
|
2008-09-09 16:29:41 +07:00
|
|
|
#ifdef CONFIG_MXC_IRQ_PRIOR
|
|
|
|
ldr r4, [\base, #AVIC_NIMASK]
|
|
|
|
#endif
|
2009-12-04 03:36:41 +07:00
|
|
|
#elif defined CONFIG_MXC_TZIC
|
|
|
|
ldr \base, =tzic_base
|
|
|
|
ldr \base, [\base]
|
|
|
|
#endif /* CONFIG_MXC_TZIC */
|
2007-07-10 04:06:53 +07:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro arch_ret_to_user, tmp1, tmp2
|
|
|
|
.endm
|
|
|
|
|
2011-03-31 08:57:33 +07:00
|
|
|
@ this macro checks which interrupt occurred
|
2007-07-10 04:06:53 +07:00
|
|
|
@ and returns its number in irqnr
|
2011-03-31 08:57:33 +07:00
|
|
|
@ and returns if an interrupt occurred in irqstat
|
2007-07-10 04:06:53 +07:00
|
|
|
.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
|
2009-12-04 03:36:41 +07:00
|
|
|
#ifndef CONFIG_MXC_TZIC
|
2007-07-10 04:06:53 +07:00
|
|
|
@ Load offset & priority of the highest priority
|
|
|
|
@ interrupt pending from AVIC_NIVECSR
|
|
|
|
ldr \irqstat, [\base, #0x40]
|
|
|
|
@ Shift to get the decoded IRQ number, using ASR so
|
|
|
|
@ 'no interrupt pending' becomes 0xffffffff
|
|
|
|
mov \irqnr, \irqstat, asr #16
|
|
|
|
@ set zero flag if IRQ + 1 == 0
|
|
|
|
adds \tmp, \irqnr, #1
|
2008-09-09 16:29:41 +07:00
|
|
|
#ifdef CONFIG_MXC_IRQ_PRIOR
|
|
|
|
bicne \tmp, \irqstat, #0xFFFFFFE0
|
|
|
|
strne \tmp, [\base, #AVIC_NIMASK]
|
|
|
|
streq r4, [\base, #AVIC_NIMASK]
|
2009-12-04 03:36:41 +07:00
|
|
|
#endif
|
|
|
|
#elif defined CONFIG_MXC_TZIC
|
|
|
|
@ Load offset & priority of the highest priority
|
|
|
|
@ interrupt pending.
|
2010-12-06 18:37:38 +07:00
|
|
|
@ 0x080 is INTSEC0 register
|
2009-12-04 03:36:41 +07:00
|
|
|
@ 0xD80 is HIPND0 register
|
|
|
|
mov \irqnr, #0
|
2010-12-06 18:37:38 +07:00
|
|
|
1000: add \irqstat, \base, \irqnr, lsr #3
|
|
|
|
ldr \tmp, [\irqstat, #0xd80]
|
|
|
|
ldr \irqstat, [\irqstat, #0x080]
|
|
|
|
ands \tmp, \tmp, \irqstat
|
|
|
|
bne 1001f
|
|
|
|
add \irqnr, \irqnr, #32
|
2009-12-04 03:36:41 +07:00
|
|
|
cmp \irqnr, #128
|
|
|
|
blo 1000b
|
|
|
|
b 2001f
|
|
|
|
1001: mov \irqstat, #1
|
|
|
|
1002: tst \tmp, \irqstat
|
|
|
|
bne 2002f
|
|
|
|
movs \tmp, \tmp, lsr #1
|
|
|
|
addne \irqnr, \irqnr, #1
|
|
|
|
bne 1002b
|
|
|
|
2001:
|
|
|
|
mov \irqnr, #0
|
|
|
|
2002:
|
|
|
|
movs \irqnr, \irqnr
|
2008-09-09 16:29:41 +07:00
|
|
|
#endif
|
2007-07-10 04:06:53 +07:00
|
|
|
.endm
|