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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <watchdog.h> |
| 13 | #include <asm/processor.h> |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 14 | #include <asm/immap.h> |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 15 | #include <asm/io.h> |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 16 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 17 | #ifdef CONFIG_M5272 |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 18 | int interrupt_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 19 | { |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 20 | intctrl_t *intp = (intctrl_t *) (MMAP_INTC); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 21 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 22 | /* disable all external interrupts */ |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 23 | out_be32(&intp->int_icr1, 0x88888888); |
| 24 | out_be32(&intp->int_icr2, 0x88888888); |
| 25 | out_be32(&intp->int_icr3, 0x88888888); |
| 26 | out_be32(&intp->int_icr4, 0x88888888); |
| 27 | out_be32(&intp->int_pitr, 0x00000000); |
| 28 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 29 | /* initialize vector register */ |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 30 | out_8(&intp->int_pivr, 0x40); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 31 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 32 | enable_interrupts(); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 33 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 34 | return 0; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 35 | } |
| 36 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 37 | #if defined(CONFIG_MCFTMR) |
| 38 | void dtimer_intr_setup(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 39 | { |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 40 | intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 41 | |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 42 | clrbits_be32(&intp->int_icr1, INT_ICR1_TMR3MASK); |
| 43 | setbits_be32(&intp->int_icr1, CONFIG_SYS_TMRINTR_PRI); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 44 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 45 | #endif /* CONFIG_MCFTMR */ |
| 46 | #endif /* CONFIG_M5272 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 47 | |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 48 | #if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \ |
| 49 | defined(CONFIG_M5271) || defined(CONFIG_M5275) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 50 | int interrupt_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 51 | { |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 52 | int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 53 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 54 | /* Make sure all interrupts are disabled */ |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 55 | #if defined(CONFIG_M5208) |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 56 | out_be32(&intp->imrl0, 0xffffffff); |
| 57 | out_be32(&intp->imrh0, 0xffffffff); |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 58 | #else |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 59 | setbits_be32(&intp->imrl0, 0x1); |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 60 | #endif |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 61 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 62 | enable_interrupts(); |
| 63 | return 0; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 64 | } |
| 65 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 66 | #if defined(CONFIG_MCFTMR) |
| 67 | void dtimer_intr_setup(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 68 | { |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 69 | int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 70 | |
Alison Wang | 95bed1f | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 71 | out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); |
| 72 | clrbits_be32(&intp->imrl0, 0x00000001); |
| 73 | clrbits_be32(&intp->imrl0, CONFIG_SYS_TMRINTR_MASK); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 74 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 75 | #endif /* CONFIG_MCFTMR */ |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 76 | #endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 77 | |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 78 | #if defined(CONFIG_M5249) || defined(CONFIG_M5253) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 79 | int interrupt_init(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 80 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 81 | enable_interrupts(); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 82 | |
| 83 | return 0; |
| 84 | } |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 85 | |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 86 | #if defined(CONFIG_MCFTMR) |
| 87 | void dtimer_intr_setup(void) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 88 | { |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 89 | mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 90 | mbar_writeByte(MCFSIM_TIMER2ICR, CONFIG_SYS_TMRINTR_PRI); |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 91 | } |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 92 | #endif /* CONFIG_MCFTMR */ |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 93 | #endif /* CONFIG_M5249 || CONFIG_M5253 */ |