2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2006-04-26 22:58:56 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2000-2002
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
|
|
|
* (C) Copyright 2002 (440 port)
|
|
|
|
* Scott McNutt, Artesyn Communication Producs, smcnutt@artsyncp.com
|
|
|
|
*
|
|
|
|
* (C) Copyright 2003 Motorola Inc. (MPC85xx port)
|
|
|
|
* Xianghua Xiao (X.Xiao@motorola.com)
|
|
|
|
*
|
2007-08-02 19:42:20 +00:00
|
|
|
* (C) Copyright 2004, 2007 Freescale Semiconductor. (MPC86xx Port)
|
2006-05-31 18:55:35 +00:00
|
|
|
* Jeff Brown
|
2006-04-26 22:58:56 +00:00
|
|
|
* Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2019-11-14 19:57:41 +00:00
|
|
|
#include <irq_func.h>
|
2006-04-26 22:58:56 +00:00
|
|
|
#include <mpc86xx.h>
|
|
|
|
#include <command.h>
|
|
|
|
#include <asm/processor.h>
|
2011-03-10 22:09:26 +00:00
|
|
|
#ifdef CONFIG_POST
|
|
|
|
#include <post.h>
|
|
|
|
#endif
|
2006-04-26 22:58:56 +00:00
|
|
|
|
2017-08-14 02:44:37 +00:00
|
|
|
void interrupt_init_cpu(unsigned *decrementer_count)
|
2006-04-26 22:58:56 +00:00
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
|
2008-08-19 20:05:34 +00:00
|
|
|
volatile ccsr_pic_t *pic = &immr->im_pic;
|
2006-04-26 22:58:56 +00:00
|
|
|
|
2011-03-10 22:09:26 +00:00
|
|
|
#ifdef CONFIG_POST
|
|
|
|
/*
|
|
|
|
* The POST word is stored in the PIC's TFRR register which gets
|
|
|
|
* cleared when the PIC is reset. Save it off so we can restore it
|
|
|
|
* later.
|
|
|
|
*/
|
|
|
|
ulong post_word = post_word_load();
|
|
|
|
#endif
|
|
|
|
|
2008-08-19 20:05:34 +00:00
|
|
|
pic->gcr = MPC86xx_PICGCR_RST;
|
|
|
|
while (pic->gcr & MPC86xx_PICGCR_RST)
|
|
|
|
;
|
|
|
|
pic->gcr = MPC86xx_PICGCR_MODE;
|
2006-04-26 22:58:56 +00:00
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
*decrementer_count = get_tbclk() / CONFIG_SYS_HZ;
|
2017-07-13 13:10:08 +00:00
|
|
|
debug("interrupt init: tbclk() = %ld MHz, decrementer_count = %d\n",
|
2006-08-22 17:06:18 +00:00
|
|
|
(get_tbclk() / 1000000),
|
2008-08-19 20:05:34 +00:00
|
|
|
*decrementer_count);
|
2006-04-27 15:15:16 +00:00
|
|
|
|
2007-08-02 19:42:20 +00:00
|
|
|
#ifdef CONFIG_INTERRUPTS
|
|
|
|
|
|
|
|
pic->iivpr1 = 0x810001; /* 50220 enable mcm interrupts */
|
2011-10-21 14:17:27 +00:00
|
|
|
debug("iivpr1@%p = %x\n", &pic->iivpr1, pic->iivpr1);
|
2007-08-02 19:42:20 +00:00
|
|
|
|
|
|
|
pic->iivpr2 = 0x810002; /* 50240 enable ddr interrupts */
|
2011-10-21 14:17:27 +00:00
|
|
|
debug("iivpr2@%p = %x\n", &pic->iivpr2, pic->iivpr2);
|
2007-08-02 19:42:20 +00:00
|
|
|
|
|
|
|
pic->iivpr3 = 0x810003; /* 50260 enable lbc interrupts */
|
2011-10-21 14:17:27 +00:00
|
|
|
debug("iivpr3@%p = %x\n", &pic->iivpr3, pic->iivpr3);
|
2007-08-02 19:42:20 +00:00
|
|
|
|
|
|
|
#if defined(CONFIG_PCI1) || defined(CONFIG_PCIE1)
|
|
|
|
pic->iivpr8 = 0x810008; /* enable pcie1 interrupts */
|
2011-10-21 14:17:27 +00:00
|
|
|
debug("iivpr8@%p = %x\n", &pic->iivpr8, pic->iivpr8);
|
2007-08-02 19:42:20 +00:00
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_PCI2) || defined(CONFIG_PCIE2)
|
|
|
|
pic->iivpr9 = 0x810009; /* enable pcie2 interrupts */
|
2011-10-21 14:17:27 +00:00
|
|
|
debug("iivpr9@%p = %x\n", &pic->iivpr9, pic->iivpr9);
|
2007-08-02 19:42:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
pic->ctpr = 0; /* 40080 clear current task priority register */
|
|
|
|
#endif
|
|
|
|
|
2011-03-10 22:09:26 +00:00
|
|
|
#ifdef CONFIG_POST
|
|
|
|
post_word_store(post_word);
|
|
|
|
#endif
|
2006-04-26 22:58:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* timer_interrupt - gets called when the decrementer overflows,
|
|
|
|
* with interrupts disabled.
|
|
|
|
* Trivial implementation - no need to be really accurate.
|
|
|
|
*/
|
2006-08-22 17:06:18 +00:00
|
|
|
void timer_interrupt_cpu(struct pt_regs *regs)
|
2006-04-26 22:58:56 +00:00
|
|
|
{
|
|
|
|
/* nothing to do here */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Install and free a interrupt handler. Not implemented yet.
|
|
|
|
*/
|
2006-08-22 17:06:18 +00:00
|
|
|
void irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
|
2006-04-26 22:58:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-08-22 17:06:18 +00:00
|
|
|
void irq_free_handler(int vec)
|
2006-04-26 22:58:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-05-31 18:55:35 +00:00
|
|
|
/*
|
2006-04-26 22:58:56 +00:00
|
|
|
* irqinfo - print information about PCI devices,not implemented.
|
|
|
|
*/
|
2010-06-28 20:00:46 +00:00
|
|
|
int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
2006-04-26 22:58:56 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle external interrupts
|
|
|
|
*/
|
2006-08-22 17:06:18 +00:00
|
|
|
void external_interrupt(struct pt_regs *regs)
|
2006-04-26 22:58:56 +00:00
|
|
|
{
|
2019-11-14 19:57:40 +00:00
|
|
|
puts("external_interrupt(oops!)\n");
|
2006-04-26 22:58:56 +00:00
|
|
|
}
|