blob: dff8c6aa8820a000c6e8bcfe9307aa57494133b7 [file] [log] [blame]
wdenke65527f2004-02-12 00:47:09 +00001/*
wdenke65527f2004-02-12 00:47:09 +00002 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
TsiChungLiew34674692007-08-16 13:20:50 -05005 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
7 *
wdenke65527f2004-02-12 00:47:09 +00008 * 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>
TsiChungLiew8cd73be2007-08-15 19:21:21 -050030#include <asm/immap.h>
Zachary P. Landau0bba8622006-01-26 17:35:56 -050031
wdenke65527f2004-02-12 00:47:09 +000032#ifdef CONFIG_M5272
TsiChungLiew8cd73be2007-08-15 19:21:21 -050033int interrupt_init(void)
wdenke65527f2004-02-12 00:47:09 +000034{
TsiChungLiew8cd73be2007-08-15 19:21:21 -050035 volatile intctrl_t *intp = (intctrl_t *) (MMAP_INTC);
wdenke65527f2004-02-12 00:47:09 +000036
TsiChungLiew8cd73be2007-08-15 19:21:21 -050037 /* disable all external interrupts */
38 intp->int_icr1 = 0x88888888;
39 intp->int_icr2 = 0x88888888;
40 intp->int_icr3 = 0x88888888;
41 intp->int_icr4 = 0x88888888;
42 intp->int_pitr = 0x00000000;
43 /* initialize vector register */
44 intp->int_pivr = 0x40;
wdenke65527f2004-02-12 00:47:09 +000045
TsiChungLiew8cd73be2007-08-15 19:21:21 -050046 enable_interrupts();
wdenke65527f2004-02-12 00:47:09 +000047
TsiChungLiew8cd73be2007-08-15 19:21:21 -050048 return 0;
wdenke65527f2004-02-12 00:47:09 +000049}
50
TsiChungLiew8cd73be2007-08-15 19:21:21 -050051#if defined(CONFIG_MCFTMR)
52void dtimer_intr_setup(void)
wdenke65527f2004-02-12 00:47:09 +000053{
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020054 volatile intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE);
wdenke65527f2004-02-12 00:47:09 +000055
TsiChungLiew8cd73be2007-08-15 19:21:21 -050056 intp->int_icr1 &= ~INT_ICR1_TMR3MASK;
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020057 intp->int_icr1 |= CONFIG_SYS_TMRINTR_PRI;
wdenke65527f2004-02-12 00:47:09 +000058}
TsiChungLiew8cd73be2007-08-15 19:21:21 -050059#endif /* CONFIG_MCFTMR */
60#endif /* CONFIG_M5272 */
wdenke65527f2004-02-12 00:47:09 +000061
TsiChung Liewb354aef2009-06-12 11:29:00 +000062#if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \
63 defined(CONFIG_M5271) || defined(CONFIG_M5275)
TsiChungLiew8cd73be2007-08-15 19:21:21 -050064int interrupt_init(void)
wdenke65527f2004-02-12 00:47:09 +000065{
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020066 volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
wdenke65527f2004-02-12 00:47:09 +000067
TsiChungLiew8cd73be2007-08-15 19:21:21 -050068 /* Make sure all interrupts are disabled */
TsiChung Liewb354aef2009-06-12 11:29:00 +000069#if defined(CONFIG_M5208)
70 intp->imrl0 = 0xFFFFFFFF;
71 intp->imrh0 = 0xFFFFFFFF;
72#else
TsiChungLiew8cd73be2007-08-15 19:21:21 -050073 intp->imrl0 |= 0x1;
TsiChung Liewb354aef2009-06-12 11:29:00 +000074#endif
wdenke65527f2004-02-12 00:47:09 +000075
TsiChungLiew8cd73be2007-08-15 19:21:21 -050076 enable_interrupts();
77 return 0;
wdenke65527f2004-02-12 00:47:09 +000078}
79
TsiChungLiew8cd73be2007-08-15 19:21:21 -050080#if defined(CONFIG_MCFTMR)
81void dtimer_intr_setup(void)
wdenke65527f2004-02-12 00:47:09 +000082{
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020083 volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
wdenke65527f2004-02-12 00:47:09 +000084
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020085 intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI;
TsiChungLiew779329a2008-01-30 15:04:42 -060086 intp->imrl0 &= 0xFFFFFFFE;
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020087 intp->imrl0 &= ~CONFIG_SYS_TMRINTR_MASK;
wdenke65527f2004-02-12 00:47:09 +000088}
TsiChungLiew8cd73be2007-08-15 19:21:21 -050089#endif /* CONFIG_MCFTMR */
Matthew Fettke761e2e92008-02-04 15:38:20 -060090#endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */
wdenke65527f2004-02-12 00:47:09 +000091
TsiChungLiew34674692007-08-16 13:20:50 -050092#if defined(CONFIG_M5249) || defined(CONFIG_M5253)
TsiChungLiew8cd73be2007-08-15 19:21:21 -050093int interrupt_init(void)
wdenke65527f2004-02-12 00:47:09 +000094{
TsiChungLiew8cd73be2007-08-15 19:21:21 -050095 enable_interrupts();
wdenke65527f2004-02-12 00:47:09 +000096
97 return 0;
98}
wdenke65527f2004-02-12 00:47:09 +000099
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500100#if defined(CONFIG_MCFTMR)
101void dtimer_intr_setup(void)
wdenke65527f2004-02-12 00:47:09 +0000102{
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500103 mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200104 mbar_writeByte(MCFSIM_TIMER2ICR, CONFIG_SYS_TMRINTR_PRI);
stroese53395a22004-12-16 18:09:49 +0000105}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500106#endif /* CONFIG_MCFTMR */
TsiChungLiew34674692007-08-16 13:20:50 -0500107#endif /* CONFIG_M5249 || CONFIG_M5253 */