2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2003-10-15 23:53:47 +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)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2019-11-14 19:57:41 +00:00
|
|
|
#include <irq_func.h>
|
2020-05-10 17:40:05 +00:00
|
|
|
#include <log.h>
|
2019-12-28 17:44:59 +00:00
|
|
|
#include <time.h>
|
2003-10-15 23:53:47 +00:00
|
|
|
#include <watchdog.h>
|
|
|
|
#include <command.h>
|
|
|
|
#include <asm/processor.h>
|
2009-08-20 22:41:11 +00:00
|
|
|
#include <asm/io.h>
|
2011-03-10 22:09:26 +00:00
|
|
|
#ifdef CONFIG_POST
|
|
|
|
#include <post.h>
|
|
|
|
#endif
|
2020-05-10 17:40:06 +00:00
|
|
|
#include <asm/ptrace.h>
|
2003-10-15 23:53:47 +00:00
|
|
|
|
2017-08-14 02:44:37 +00:00
|
|
|
void interrupt_init_cpu(unsigned *decrementer_count)
|
2003-10-15 23:53:47 +00:00
|
|
|
{
|
2010-08-09 23:39:57 +00:00
|
|
|
ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR;
|
2005-05-13 22:49:36 +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
|
|
|
|
|
2009-08-20 22:41:11 +00:00
|
|
|
out_be32(&pic->gcr, MPC85xx_PICGCR_RST);
|
|
|
|
while (in_be32(&pic->gcr) & MPC85xx_PICGCR_RST)
|
2008-08-19 19:46:36 +00:00
|
|
|
;
|
2009-08-20 22:41:11 +00:00
|
|
|
out_be32(&pic->gcr, MPC85xx_PICGCR_M);
|
|
|
|
in_be32(&pic->gcr);
|
2008-08-19 19:46:36 +00:00
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
*decrementer_count = get_tbclk() / CONFIG_SYS_HZ;
|
2008-08-19 19:46:36 +00:00
|
|
|
|
|
|
|
/* PIE is same as DIE, dec interrupt enable */
|
2014-06-03 07:05:12 +00:00
|
|
|
mtspr(SPRN_TCR, mfspr(SPRN_TCR) | TCR_PIE);
|
2007-08-14 06:34:21 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_INTERRUPTS
|
2008-02-27 21:50:50 +00:00
|
|
|
pic->iivpr1 = 0x810001; /* 50220 enable ecm interrupts */
|
2008-08-21 14:12:26 +00:00
|
|
|
debug("iivpr1@%x = %x\n", (uint)&pic->iivpr1, pic->iivpr1);
|
2007-08-14 06:34:21 +00:00
|
|
|
|
|
|
|
pic->iivpr2 = 0x810002; /* 50240 enable ddr interrupts */
|
2008-08-21 14:12:26 +00:00
|
|
|
debug("iivpr2@%x = %x\n", (uint)&pic->iivpr2, pic->iivpr2);
|
2007-08-14 06:34:21 +00:00
|
|
|
|
|
|
|
pic->iivpr3 = 0x810003; /* 50260 enable lbc interrupts */
|
2008-08-21 14:12:26 +00:00
|
|
|
debug("iivpr3@%x = %x\n", (uint)&pic->iivpr3, pic->iivpr3);
|
2007-08-14 06:34:21 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_PCI1
|
|
|
|
pic->iivpr8 = 0x810008; /* enable pci1 interrupts */
|
2008-08-21 14:12:26 +00:00
|
|
|
debug("iivpr8@%x = %x\n", (uint)&pic->iivpr8, pic->iivpr8);
|
2007-08-14 06:34:21 +00:00
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_PCI2) || defined(CONFIG_PCIE2)
|
|
|
|
pic->iivpr9 = 0x810009; /* enable pci1 interrupts */
|
2008-08-21 14:12:26 +00:00
|
|
|
debug("iivpr9@%x = %x\n", (uint)&pic->iivpr9, pic->iivpr9);
|
2007-08-14 06:34:21 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PCIE1
|
|
|
|
pic->iivpr10 = 0x81000a; /* enable pcie1 interrupts */
|
2008-08-21 14:12:26 +00:00
|
|
|
debug("iivpr10@%x = %x\n", (uint)&pic->iivpr10, pic->iivpr10);
|
2007-08-14 06:34:21 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PCIE3
|
|
|
|
pic->iivpr11 = 0x81000b; /* enable pcie3 interrupts */
|
2008-08-21 14:12:26 +00:00
|
|
|
debug("iivpr11@%x = %x\n", (uint)&pic->iivpr11, pic->iivpr11);
|
2007-08-14 06:34:21 +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
|
2003-10-15 23:53:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-19 19:46:36 +00:00
|
|
|
/* Install and free a interrupt handler. Not implemented yet. */
|
2003-10-15 23:53:47 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
irq_free_handler(int vec)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-19 19:46:36 +00:00
|
|
|
void timer_interrupt_cpu(struct pt_regs *regs)
|
2003-10-15 23:53:47 +00:00
|
|
|
{
|
2008-08-19 19:46:36 +00:00
|
|
|
/* PIS is same as DIS, dec interrupt status */
|
2005-05-13 22:49:36 +00:00
|
|
|
mtspr(SPRN_TSR, TSR_PIS);
|
2003-10-15 23:53:47 +00:00
|
|
|
}
|
|
|
|
|
2007-07-10 00:06:00 +00:00
|
|
|
#if defined(CONFIG_CMD_IRQ)
|
2008-08-19 19:46:36 +00:00
|
|
|
/* irqinfo - print information about PCI devices,not implemented. */
|
2020-05-10 17:40:03 +00:00
|
|
|
int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
2003-10-15 23:53:47 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2007-07-10 00:06:00 +00:00
|
|
|
#endif
|