2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2004-02-12 00:47:09 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2000-2004
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
2012-03-26 21:49:04 +00:00
|
|
|
* Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
|
2007-08-16 18:20:50 +00:00
|
|
|
* TsiChung Liew (Tsi-Chung.Liew@freescale.com)
|
2004-02-12 00:47:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2019-11-14 19:57:41 +00:00
|
|
|
#include <irq_func.h>
|
2004-02-12 00:47:09 +00:00
|
|
|
#include <watchdog.h>
|
|
|
|
#include <asm/processor.h>
|
2007-08-16 00:21:21 +00:00
|
|
|
#include <asm/immap.h>
|
2012-03-26 21:49:04 +00:00
|
|
|
#include <asm/io.h>
|
2006-01-26 22:35:56 +00:00
|
|
|
|
2004-02-12 00:47:09 +00:00
|
|
|
#ifdef CONFIG_M5272
|
2007-08-16 00:21:21 +00:00
|
|
|
int interrupt_init(void)
|
2004-02-12 00:47:09 +00:00
|
|
|
{
|
2012-03-26 21:49:04 +00:00
|
|
|
intctrl_t *intp = (intctrl_t *) (MMAP_INTC);
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2007-08-16 00:21:21 +00:00
|
|
|
/* disable all external interrupts */
|
2012-03-26 21:49:04 +00:00
|
|
|
out_be32(&intp->int_icr1, 0x88888888);
|
|
|
|
out_be32(&intp->int_icr2, 0x88888888);
|
|
|
|
out_be32(&intp->int_icr3, 0x88888888);
|
|
|
|
out_be32(&intp->int_icr4, 0x88888888);
|
|
|
|
out_be32(&intp->int_pitr, 0x00000000);
|
|
|
|
|
2007-08-16 00:21:21 +00:00
|
|
|
/* initialize vector register */
|
2012-03-26 21:49:04 +00:00
|
|
|
out_8(&intp->int_pivr, 0x40);
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2007-08-16 00:21:21 +00:00
|
|
|
enable_interrupts();
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2007-08-16 00:21:21 +00:00
|
|
|
return 0;
|
2004-02-12 00:47:09 +00:00
|
|
|
}
|
|
|
|
|
2023-02-25 22:25:26 +00:00
|
|
|
#if defined(CFG_MCFTMR)
|
2007-08-16 00:21:21 +00:00
|
|
|
void dtimer_intr_setup(void)
|
2004-02-12 00:47:09 +00:00
|
|
|
{
|
2023-01-10 16:19:45 +00:00
|
|
|
intctrl_t *intp = (intctrl_t *) (CFG_SYS_INTR_BASE);
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2012-03-26 21:49:04 +00:00
|
|
|
clrbits_be32(&intp->int_icr1, INT_ICR1_TMR3MASK);
|
2023-01-10 16:19:45 +00:00
|
|
|
setbits_be32(&intp->int_icr1, CFG_SYS_TMRINTR_PRI);
|
2004-02-12 00:47:09 +00:00
|
|
|
}
|
2023-02-25 22:25:26 +00:00
|
|
|
#endif /* CFG_MCFTMR */
|
2007-08-16 00:21:21 +00:00
|
|
|
#endif /* CONFIG_M5272 */
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2009-06-12 11:29:00 +00:00
|
|
|
#if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \
|
|
|
|
defined(CONFIG_M5271) || defined(CONFIG_M5275)
|
2007-08-16 00:21:21 +00:00
|
|
|
int interrupt_init(void)
|
2004-02-12 00:47:09 +00:00
|
|
|
{
|
2023-01-10 16:19:45 +00:00
|
|
|
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2007-08-16 00:21:21 +00:00
|
|
|
/* Make sure all interrupts are disabled */
|
2009-06-12 11:29:00 +00:00
|
|
|
#if defined(CONFIG_M5208)
|
2012-03-26 21:49:04 +00:00
|
|
|
out_be32(&intp->imrl0, 0xffffffff);
|
|
|
|
out_be32(&intp->imrh0, 0xffffffff);
|
2009-06-12 11:29:00 +00:00
|
|
|
#else
|
2012-03-26 21:49:04 +00:00
|
|
|
setbits_be32(&intp->imrl0, 0x1);
|
2009-06-12 11:29:00 +00:00
|
|
|
#endif
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2007-08-16 00:21:21 +00:00
|
|
|
enable_interrupts();
|
|
|
|
return 0;
|
2004-02-12 00:47:09 +00:00
|
|
|
}
|
|
|
|
|
2023-02-25 22:25:26 +00:00
|
|
|
#if defined(CFG_MCFTMR)
|
2007-08-16 00:21:21 +00:00
|
|
|
void dtimer_intr_setup(void)
|
2004-02-12 00:47:09 +00:00
|
|
|
{
|
2023-01-10 16:19:45 +00:00
|
|
|
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2023-01-10 16:19:45 +00:00
|
|
|
out_8(&intp->icr0[CFG_SYS_TMRINTR_NO], CFG_SYS_TMRINTR_PRI);
|
2012-03-26 21:49:04 +00:00
|
|
|
clrbits_be32(&intp->imrl0, 0x00000001);
|
2023-01-10 16:19:45 +00:00
|
|
|
clrbits_be32(&intp->imrl0, CFG_SYS_TMRINTR_MASK);
|
2004-02-12 00:47:09 +00:00
|
|
|
}
|
2023-02-25 22:25:26 +00:00
|
|
|
#endif /* CFG_MCFTMR */
|
2008-02-04 21:38:20 +00:00
|
|
|
#endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */
|
2004-02-12 00:47:09 +00:00
|
|
|
|
2007-08-16 18:20:50 +00:00
|
|
|
#if defined(CONFIG_M5249) || defined(CONFIG_M5253)
|
2007-08-16 00:21:21 +00:00
|
|
|
int interrupt_init(void)
|
2004-02-12 00:47:09 +00:00
|
|
|
{
|
2007-08-16 00:21:21 +00:00
|
|
|
enable_interrupts();
|
2004-02-12 00:47:09 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-02-25 22:25:26 +00:00
|
|
|
#if defined(CFG_MCFTMR)
|
2007-08-16 00:21:21 +00:00
|
|
|
void dtimer_intr_setup(void)
|
2004-12-16 18:09:49 +00:00
|
|
|
{
|
2007-08-16 00:21:21 +00:00
|
|
|
mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x00000400);
|
2023-01-10 16:19:45 +00:00
|
|
|
mbar_writeByte(MCFSIM_TIMER2ICR, CFG_SYS_TMRINTR_PRI);
|
2004-12-16 18:09:49 +00:00
|
|
|
}
|
2023-02-25 22:25:26 +00:00
|
|
|
#endif /* CFG_MCFTMR */
|
2007-08-16 18:20:50 +00:00
|
|
|
#endif /* CONFIG_M5249 || CONFIG_M5253 */
|