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