Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org> |
| 3 | * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. |
| 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
Sascha Hauer | a244909 | 2008-12-18 11:51:57 +0100 | [diff] [blame] | 12 | #include <mach/hardware.h> |
| 13 | |
Darius Augulis | 479c901 | 2008-09-09 11:29:41 +0200 | [diff] [blame] | 14 | #define AVIC_NIMASK 0x04 |
| 15 | |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 16 | @ this macro disables fast irq (not implemented) |
| 17 | .macro disable_fiq |
| 18 | .endm |
| 19 | |
| 20 | .macro get_irqnr_preamble, base, tmp |
Sascha Hauer | 12b8eb8 | 2009-05-25 10:50:52 +0200 | [diff] [blame^] | 21 | ldr \base, =avic_base |
| 22 | ldr \base, [\base] |
Darius Augulis | 479c901 | 2008-09-09 11:29:41 +0200 | [diff] [blame] | 23 | #ifdef CONFIG_MXC_IRQ_PRIOR |
| 24 | ldr r4, [\base, #AVIC_NIMASK] |
| 25 | #endif |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 26 | .endm |
| 27 | |
| 28 | .macro arch_ret_to_user, tmp1, tmp2 |
| 29 | .endm |
| 30 | |
| 31 | @ this macro checks which interrupt occured |
| 32 | @ and returns its number in irqnr |
| 33 | @ and returns if an interrupt occured in irqstat |
| 34 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 35 | @ Load offset & priority of the highest priority |
| 36 | @ interrupt pending from AVIC_NIVECSR |
| 37 | ldr \irqstat, [\base, #0x40] |
| 38 | @ Shift to get the decoded IRQ number, using ASR so |
| 39 | @ 'no interrupt pending' becomes 0xffffffff |
| 40 | mov \irqnr, \irqstat, asr #16 |
| 41 | @ set zero flag if IRQ + 1 == 0 |
| 42 | adds \tmp, \irqnr, #1 |
Darius Augulis | 479c901 | 2008-09-09 11:29:41 +0200 | [diff] [blame] | 43 | #ifdef CONFIG_MXC_IRQ_PRIOR |
| 44 | bicne \tmp, \irqstat, #0xFFFFFFE0 |
| 45 | strne \tmp, [\base, #AVIC_NIMASK] |
| 46 | streq r4, [\base, #AVIC_NIMASK] |
| 47 | #endif |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 48 | .endm |
| 49 | |
| 50 | @ irq priority table (not used) |
| 51 | .macro irq_prio_table |
| 52 | .endm |