wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 Josef Baumgartner <josef.baumgartner@telex.de> |
| 3 | * |
| 4 | * (C) Copyright 2000-2004 |
| 5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 6 | * |
| 7 | * See file CREDITS for list of people who contributed to this |
| 8 | * project. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License as |
| 12 | * published by the Free Software Foundation; either version 2 of |
| 13 | * the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 23 | * MA 02111-1307 USA |
| 24 | */ |
| 25 | |
| 26 | #include <common.h> |
| 27 | #include <watchdog.h> |
| 28 | #include <asm/processor.h> |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 29 | #include <asm/immap.h> |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 30 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 31 | #ifdef CONFIG_M5272 |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 32 | int interrupt_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 33 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 34 | volatile intctrl_t *intp = (intctrl_t *) (MMAP_INTC); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 35 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 36 | /* disable all external interrupts */ |
| 37 | intp->int_icr1 = 0x88888888; |
| 38 | intp->int_icr2 = 0x88888888; |
| 39 | intp->int_icr3 = 0x88888888; |
| 40 | intp->int_icr4 = 0x88888888; |
| 41 | intp->int_pitr = 0x00000000; |
| 42 | /* initialize vector register */ |
| 43 | intp->int_pivr = 0x40; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 44 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 45 | enable_interrupts(); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 46 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 47 | return 0; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 48 | } |
| 49 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 50 | #if defined(CONFIG_MCFTMR) |
| 51 | void dtimer_intr_setup(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 52 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 53 | volatile intctrl_t *intp = (intctrl_t *) (CFG_INTR_BASE); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 54 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 55 | intp->int_icr1 &= ~INT_ICR1_TMR3MASK; |
| 56 | intp->int_icr1 |= CFG_TMRINTR_PRI; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 57 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 58 | #endif /* CONFIG_MCFTMR */ |
| 59 | #endif /* CONFIG_M5272 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 60 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 61 | #if defined(CONFIG_M5282) || defined(CONFIG_M5271) |
| 62 | int interrupt_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 63 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 64 | volatile int0_t *intp = (int0_t *) (CFG_INTR_BASE); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 65 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 66 | /* Make sure all interrupts are disabled */ |
| 67 | intp->imrl0 |= 0x1; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 68 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 69 | enable_interrupts(); |
| 70 | return 0; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 71 | } |
| 72 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 73 | #if defined(CONFIG_MCFTMR) |
| 74 | void dtimer_intr_setup(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 75 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 76 | volatile int0_t *intp = (int0_t *) (CFG_INTR_BASE); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 77 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 78 | intp->icr0[CFG_TMRINTR_NO] = CFG_TMRINTR_PRI; |
| 79 | intp->imrl0 &= ~0xFFFFFFFE; |
| 80 | intp->imrl0 &= ~CFG_TMRINTR_MASK; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 81 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 82 | #endif /* CONFIG_MCFTMR */ |
| 83 | #endif /* CONFIG_M5282 | CONFIG_M5271 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 84 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 85 | #ifdef CONFIG_M5249 |
| 86 | int interrupt_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 87 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 88 | enable_interrupts(); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 89 | |
| 90 | return 0; |
| 91 | } |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 92 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 93 | #if defined(CONFIG_MCFTMR) |
| 94 | void dtimer_intr_setup(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 95 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 96 | mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400); |
| 97 | mbar_writeByte(MCFSIM_TIMER2ICR, |
| 98 | MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | |
| 99 | MCFSIM_ICR_PRI3); |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 100 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame^] | 101 | #endif /* CONFIG_MCFTMR */ |
| 102 | #endif /* CONFIG_M5249 */ |