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