85xx: Improve MPIC initialization
authorTimur Tabi <timur@freescale.com>
Thu, 20 Aug 2009 22:41:11 +0000 (17:41 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Fri, 28 Aug 2009 22:12:43 +0000 (17:12 -0500)
The MPIC initialization code for Freescale e500 CPUs was not using I/O
accessors, and it was not issuing a read-back to the MPIC after setting
mixed mode.  This may be the cause of a spurious interrupt on some systems.

Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
cpu/mpc85xx/interrupts.c

index 4ef83950d11a34fc196886e53acf9ff89919a3c7..409367d158c94a5cccc9635d09ea66154d74ab6a 100644 (file)
 #include <watchdog.h>
 #include <command.h>
 #include <asm/processor.h>
+#include <asm/io.h>
 
-int interrupt_init_cpu(unsigned long *decrementer_count)
+int interrupt_init_cpu(unsigned int *decrementer_count)
 {
-       volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
+       ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC85xx_PIC_ADDR;
 
-       pic->gcr = MPC85xx_PICGCR_RST;
-       while (pic->gcr & MPC85xx_PICGCR_RST)
+       out_be32(&pic->gcr, MPC85xx_PICGCR_RST);
+       while (in_be32(&pic->gcr) & MPC85xx_PICGCR_RST)
                ;
-       pic->gcr = MPC85xx_PICGCR_M;
+       out_be32(&pic->gcr, MPC85xx_PICGCR_M);
+       in_be32(&pic->gcr);
 
        *decrementer_count = get_tbclk() / CONFIG_SYS_HZ;