blob: 8cc07f2c67145f2bb611e7d34cdb57a6692e33ea [file] [log] [blame]
wdenkbf9e3b32004-02-12 00:47:09 +00001/*
wdenkbf9e3b32004-02-12 00:47:09 +00002 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Alison Wang32dbaaf2012-03-26 21:49:04 +00005 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
TsiChungLiewa1436a82007-08-16 13:20:50 -05006 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
7 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02008 * SPDX-License-Identifier: GPL-2.0+
wdenkbf9e3b32004-02-12 00:47:09 +00009 */
10
11#include <common.h>
12#include <watchdog.h>
13#include <asm/processor.h>
TsiChungLiew83ec20b2007-08-15 19:21:21 -050014#include <asm/immap.h>
Alison Wang32dbaaf2012-03-26 21:49:04 +000015#include <asm/io.h>
Zachary P. Landaueacbd312006-01-26 17:35:56 -050016
wdenkbf9e3b32004-02-12 00:47:09 +000017#ifdef CONFIG_M5272
TsiChungLiew83ec20b2007-08-15 19:21:21 -050018int interrupt_init(void)
wdenkbf9e3b32004-02-12 00:47:09 +000019{
Alison Wang32dbaaf2012-03-26 21:49:04 +000020 intctrl_t *intp = (intctrl_t *) (MMAP_INTC);
wdenkbf9e3b32004-02-12 00:47:09 +000021
22 /* disable all external interrupts */
Alison Wang32dbaaf2012-03-26 21:49:04 +000023 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
wdenkbf9e3b32004-02-12 00:47:09 +000029 /* initialize vector register */
Alison Wang32dbaaf2012-03-26 21:49:04 +000030 out_8(&intp->int_pivr, 0x40);
wdenkbf9e3b32004-02-12 00:47:09 +000031
TsiChungLiew83ec20b2007-08-15 19:21:21 -050032 enable_interrupts();
wdenkbf9e3b32004-02-12 00:47:09 +000033
34 return 0;
35}
TsiChungLiew83ec20b2007-08-15 19:21:21 -050036
37#if defined(CONFIG_MCFTMR)
38void dtimer_intr_setup(void)
39{
Alison Wang32dbaaf2012-03-26 21:49:04 +000040 intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE);
TsiChungLiew83ec20b2007-08-15 19:21:21 -050041
Alison Wang32dbaaf2012-03-26 21:49:04 +000042 clrbits_be32(&intp->int_icr1, INT_ICR1_TMR3MASK);
43 setbits_be32(&intp->int_icr1, CONFIG_SYS_TMRINTR_PRI);
TsiChungLiew83ec20b2007-08-15 19:21:21 -050044}
45#endif /* CONFIG_MCFTMR */
46#endif /* CONFIG_M5272 */
wdenkbf9e3b32004-02-12 00:47:09 +000047
TsiChung Liewbf9a5212009-06-12 11:29:00 +000048#if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \
49 defined(CONFIG_M5271) || defined(CONFIG_M5275)
TsiChungLiew83ec20b2007-08-15 19:21:21 -050050int interrupt_init(void)
wdenkbf9e3b32004-02-12 00:47:09 +000051{
Alison Wang32dbaaf2012-03-26 21:49:04 +000052 int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
TsiChungLiew83ec20b2007-08-15 19:21:21 -050053
54 /* Make sure all interrupts are disabled */
TsiChung Liewbf9a5212009-06-12 11:29:00 +000055#if defined(CONFIG_M5208)
Alison Wang32dbaaf2012-03-26 21:49:04 +000056 out_be32(&intp->imrl0, 0xffffffff);
57 out_be32(&intp->imrh0, 0xffffffff);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000058#else
Alison Wang32dbaaf2012-03-26 21:49:04 +000059 setbits_be32(&intp->imrl0, 0x1);
TsiChung Liewbf9a5212009-06-12 11:29:00 +000060#endif
TsiChungLiew83ec20b2007-08-15 19:21:21 -050061
62 enable_interrupts();
wdenkbf9e3b32004-02-12 00:47:09 +000063 return 0;
64}
TsiChungLiew83ec20b2007-08-15 19:21:21 -050065
66#if defined(CONFIG_MCFTMR)
67void dtimer_intr_setup(void)
68{
Alison Wang32dbaaf2012-03-26 21:49:04 +000069 int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
TsiChungLiew83ec20b2007-08-15 19:21:21 -050070
Alison Wang32dbaaf2012-03-26 21:49:04 +000071 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);
TsiChungLiew83ec20b2007-08-15 19:21:21 -050074}
75#endif /* CONFIG_MCFTMR */
Matthew Fettkef71d9d92008-02-04 15:38:20 -060076#endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */
stroese8c725b92004-12-16 18:09:49 +000077
TsiChungLiewa1436a82007-08-16 13:20:50 -050078#if defined(CONFIG_M5249) || defined(CONFIG_M5253)
TsiChungLiew83ec20b2007-08-15 19:21:21 -050079int interrupt_init(void)
stroese8c725b92004-12-16 18:09:49 +000080{
TsiChungLiew83ec20b2007-08-15 19:21:21 -050081 enable_interrupts();
stroese8c725b92004-12-16 18:09:49 +000082
83 return 0;
84}
TsiChungLiew83ec20b2007-08-15 19:21:21 -050085
86#if defined(CONFIG_MCFTMR)
87void dtimer_intr_setup(void)
88{
89 mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020090 mbar_writeByte(MCFSIM_TIMER2ICR, CONFIG_SYS_TMRINTR_PRI);
TsiChungLiew83ec20b2007-08-15 19:21:21 -050091}
92#endif /* CONFIG_MCFTMR */
TsiChungLiewa1436a82007-08-16 13:20:50 -050093#endif /* CONFIG_M5249 || CONFIG_M5253 */