Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 2 | /* |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 3 | * (C) Copyright 2000-2004 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 5 | * |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 6 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | a1436a8 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 7 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <watchdog.h> |
| 12 | #include <asm/processor.h> |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 13 | #include <asm/immap.h> |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 14 | #include <asm/io.h> |
Zachary P. Landau | eacbd31 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 15 | |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 16 | #ifdef CONFIG_M5272 |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 17 | int interrupt_init(void) |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 18 | { |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 19 | intctrl_t *intp = (intctrl_t *) (MMAP_INTC); |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 20 | |
| 21 | /* disable all external interrupts */ |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 22 | out_be32(&intp->int_icr1, 0x88888888); |
| 23 | out_be32(&intp->int_icr2, 0x88888888); |
| 24 | out_be32(&intp->int_icr3, 0x88888888); |
| 25 | out_be32(&intp->int_icr4, 0x88888888); |
| 26 | out_be32(&intp->int_pitr, 0x00000000); |
| 27 | |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 28 | /* initialize vector register */ |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 29 | out_8(&intp->int_pivr, 0x40); |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 30 | |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 31 | enable_interrupts(); |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 32 | |
| 33 | return 0; |
| 34 | } |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 35 | |
| 36 | #if defined(CONFIG_MCFTMR) |
| 37 | void dtimer_intr_setup(void) |
| 38 | { |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 39 | intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE); |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 40 | |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 41 | clrbits_be32(&intp->int_icr1, INT_ICR1_TMR3MASK); |
| 42 | setbits_be32(&intp->int_icr1, CONFIG_SYS_TMRINTR_PRI); |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 43 | } |
| 44 | #endif /* CONFIG_MCFTMR */ |
| 45 | #endif /* CONFIG_M5272 */ |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 46 | |
TsiChung Liew | bf9a521 | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 47 | #if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \ |
| 48 | defined(CONFIG_M5271) || defined(CONFIG_M5275) |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 49 | int interrupt_init(void) |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 50 | { |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 51 | int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 52 | |
| 53 | /* Make sure all interrupts are disabled */ |
TsiChung Liew | bf9a521 | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 54 | #if defined(CONFIG_M5208) |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 55 | out_be32(&intp->imrl0, 0xffffffff); |
| 56 | out_be32(&intp->imrh0, 0xffffffff); |
TsiChung Liew | bf9a521 | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 57 | #else |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 58 | setbits_be32(&intp->imrl0, 0x1); |
TsiChung Liew | bf9a521 | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 59 | #endif |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 60 | |
| 61 | enable_interrupts(); |
wdenk | bf9e3b3 | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 62 | return 0; |
| 63 | } |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 64 | |
| 65 | #if defined(CONFIG_MCFTMR) |
| 66 | void dtimer_intr_setup(void) |
| 67 | { |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 68 | int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 69 | |
Alison Wang | 32dbaaf | 2012-03-26 21:49:04 +0000 | [diff] [blame] | 70 | out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); |
| 71 | clrbits_be32(&intp->imrl0, 0x00000001); |
| 72 | clrbits_be32(&intp->imrl0, CONFIG_SYS_TMRINTR_MASK); |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 73 | } |
| 74 | #endif /* CONFIG_MCFTMR */ |
Matthew Fettke | f71d9d9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 75 | #endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */ |
stroese | 8c725b9 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 76 | |
TsiChungLiew | a1436a8 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 77 | #if defined(CONFIG_M5249) || defined(CONFIG_M5253) |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 78 | int interrupt_init(void) |
stroese | 8c725b9 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 79 | { |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 80 | enable_interrupts(); |
stroese | 8c725b9 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 81 | |
| 82 | return 0; |
| 83 | } |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 84 | |
| 85 | #if defined(CONFIG_MCFTMR) |
| 86 | void dtimer_intr_setup(void) |
| 87 | { |
| 88 | mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 89 | mbar_writeByte(MCFSIM_TIMER2ICR, CONFIG_SYS_TMRINTR_PRI); |
TsiChungLiew | 83ec20b | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 90 | } |
| 91 | #endif /* CONFIG_MCFTMR */ |
TsiChungLiew | a1436a8 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 92 | #endif /* CONFIG_M5249 || CONFIG_M5253 */ |