summaryrefslogtreecommitdiff
path: root/arch/powerpc/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/cpu')
-rw-r--r--arch/powerpc/cpu/mpc85xx/fdt.c1
-rw-r--r--arch/powerpc/cpu/mpc8xx/Kconfig6
-rw-r--r--arch/powerpc/cpu/mpc8xx/Makefile1
-rw-r--r--arch/powerpc/cpu/mpc8xx/cpu.c36
-rw-r--r--arch/powerpc/cpu/mpc8xx/cpu_init.c11
-rw-r--r--arch/powerpc/cpu/mpc8xx/immap.c24
-rw-r--r--arch/powerpc/cpu/mpc8xx/interrupts.c2
-rw-r--r--arch/powerpc/cpu/mpc8xx/reginfo.c71
-rw-r--r--arch/powerpc/cpu/mpc8xx/speed.c3
-rw-r--r--arch/powerpc/cpu/mpc8xx/start.S27
10 files changed, 61 insertions, 121 deletions
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index e1fee11540c..3bdaa5fe7bf 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <environment.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <asm/processor.h>
diff --git a/arch/powerpc/cpu/mpc8xx/Kconfig b/arch/powerpc/cpu/mpc8xx/Kconfig
index 5a7db335ed2..b0e90a0f203 100644
--- a/arch/powerpc/cpu/mpc8xx/Kconfig
+++ b/arch/powerpc/cpu/mpc8xx/Kconfig
@@ -1,5 +1,5 @@
menu "mpc8xx CPU"
- depends on 8xx
+ depends on MPC8xx
config SYS_CPU
default "mpc8xx"
@@ -25,6 +25,10 @@ config MPC885
endchoice
+config MPC8xx_WATCHDOG
+ bool "Watchdog"
+ select HW_WATCHDOG
+
config 8xx_GCLK_FREQ
int "CPU GCLK Frequency"
diff --git a/arch/powerpc/cpu/mpc8xx/Makefile b/arch/powerpc/cpu/mpc8xx/Makefile
index 40f38923ece..35ff18a7b3b 100644
--- a/arch/powerpc/cpu/mpc8xx/Makefile
+++ b/arch/powerpc/cpu/mpc8xx/Makefile
@@ -12,6 +12,5 @@ obj-y += cpu_init.o
obj-$(CONFIG_OF_LIBFDT) += fdt.o
obj-$(CONFIG_CMD_IMMAP) += immap.o
obj-y += interrupts.o
-obj-$(CONFIG_CMD_REGINFO) += reginfo.o
obj-y += speed.o
obj-y += cache.o
diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 1120fd7441c..d17ad846949 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -21,9 +21,9 @@
#include <watchdog.h>
#include <command.h>
#include <mpc8xx.h>
-#include <commproc.h>
#include <netdev.h>
#include <asm/cache.h>
+#include <asm/cpm_8xx.h>
#include <linux/compiler.h>
#include <asm/io.h>
@@ -36,13 +36,13 @@ DECLARE_GLOBAL_DATA_PTR;
static int check_CPU(long clock, uint pvr, uint immr)
{
- immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
uint k;
char buf[32];
/* the highest 16 bits should be 0x0050 for a 860 */
- if ((pvr >> 16) != 0x0050)
+ if (PVR_VER(pvr) != PVR_VER(PVR_8xx))
return -1;
k = (immr << 16) |
@@ -90,7 +90,7 @@ static int check_CPU(long clock, uint pvr, uint immr)
int checkcpu(void)
{
ulong clock = gd->cpu_clk;
- uint immr = get_immr(0); /* Return full IMMR contents */
+ uint immr = get_immr(); /* Return full IMMR contents */
uint pvr = get_pvr();
puts("CPU: ");
@@ -237,8 +237,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
unsigned long get_tbclk(void)
{
- uint immr = get_immr(0); /* Return full IMMR contents */
- immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
ulong oscclk, factor, pll;
if (in_be32(&immap->im_clkrst.car_sccr) & SCCR_TBS)
@@ -271,31 +270,6 @@ unsigned long get_tbclk(void)
return oscclk / 16;
}
-/* ------------------------------------------------------------------------- */
-
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset(void)
-{
- int re_enable = disable_interrupts();
-
- reset_8xx_watchdog((immap_t __iomem *)CONFIG_SYS_IMMR);
- if (re_enable)
- enable_interrupts();
-}
-#endif /* CONFIG_WATCHDOG */
-
-#if defined(CONFIG_WATCHDOG)
-
-void reset_8xx_watchdog(immap_t __iomem *immr)
-{
- /*
- * All other boards use the MPC8xx Internal Watchdog
- */
- out_be16(&immr->im_siu_conf.sc_swsr, 0x556c); /* write magic1 */
- out_be16(&immr->im_siu_conf.sc_swsr, 0xaa39); /* write magic2 */
-}
-#endif /* CONFIG_WATCHDOG */
-
/*
* Initializes on-chip ethernet controllers.
* to override, implement board_eth_init()
diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c
index dc601a12976..99e8c85e7a3 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
@@ -9,7 +9,7 @@
#include <watchdog.h>
#include <mpc8xx.h>
-#include <commproc.h>
+#include <asm/cpm_8xx.h>
#include <asm/io.h>
/*
@@ -26,11 +26,12 @@ void cpu_init_f(immap_t __iomem *immr)
/* SYPCR - contains watchdog control (11-9) */
- out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR);
+#ifndef CONFIG_HW_WATCHDOG
+ /* deactivate watchdog if not enabled in config */
+ out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR & ~SYPCR_SWE);
+#endif
-#if defined(CONFIG_WATCHDOG)
- reset_8xx_watchdog(immr);
-#endif /* CONFIG_WATCHDOG */
+ WATCHDOG_RESET();
/* SIUMCR - contains debug pin configuration (11-6) */
setbits_be32(&immr->im_siu_conf.sc_siumcr, CONFIG_SYS_SIUMCR);
diff --git a/arch/powerpc/cpu/mpc8xx/immap.c b/arch/powerpc/cpu/mpc8xx/immap.c
index 2284979dd65..8e732555baf 100644
--- a/arch/powerpc/cpu/mpc8xx/immap.c
+++ b/arch/powerpc/cpu/mpc8xx/immap.c
@@ -12,8 +12,8 @@
#include <common.h>
#include <command.h>
-#include <asm/8xx_immap.h>
-#include <commproc.h>
+#include <asm/immap_8xx.h>
+#include <asm/cpm_8xx.h>
#include <asm/iopin_8xx.h>
#include <asm/io.h>
@@ -342,6 +342,26 @@ static int do_brginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+#ifdef CONFIG_CMD_REGINFO
+void print_reginfo(void)
+{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+ sit8xx_t __iomem *timers = &immap->im_sit;
+
+ printf("\nSystem Configuration registers\n"
+ "\tIMMR\t0x%08X\n", get_immr());
+ do_siuinfo(NULL, 0, 0, NULL);
+
+ printf("Memory Controller Registers\n");
+ do_memcinfo(NULL, 0, 0, NULL);
+
+ printf("\nSystem Integration Timers\n");
+ printf("\tTBSCR\t0x%04X\tRTCSC\t0x%04X\n",
+ in_be16(&timers->sit_tbscr), in_be16(&timers->sit_rtcsc));
+ printf("\tPISCR\t0x%04X\n", in_be16(&timers->sit_piscr));
+}
+#endif
+
/***************************************************/
U_BOOT_CMD(
diff --git a/arch/powerpc/cpu/mpc8xx/interrupts.c b/arch/powerpc/cpu/mpc8xx/interrupts.c
index 846148ab986..20f9664f060 100644
--- a/arch/powerpc/cpu/mpc8xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc8xx/interrupts.c
@@ -8,9 +8,9 @@
#include <common.h>
#include <mpc8xx.h>
#include <mpc8xx_irq.h>
+#include <asm/cpm_8xx.h>
#include <asm/processor.h>
#include <asm/io.h>
-#include <commproc.h>
/************************************************************************/
diff --git a/arch/powerpc/cpu/mpc8xx/reginfo.c b/arch/powerpc/cpu/mpc8xx/reginfo.c
deleted file mode 100644
index 277d2753b25..00000000000
--- a/arch/powerpc/cpu/mpc8xx/reginfo.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * (C) Copyright 2000
- * Subodh Nijsure, SkyStream Networks, snijsure@skystream.com
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-#include <asm/io.h>
-#include <asm/ppc.h>
-
-void print_reginfo(void)
-{
- immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
- memctl8xx_t __iomem *memctl = &immap->im_memctl;
- sysconf8xx_t __iomem *sysconf = &immap->im_siu_conf;
- sit8xx_t __iomem *timers = &immap->im_sit;
-
- /* Hopefully more PowerPC knowledgable people will add code to display
- * other useful registers
- */
-
- printf("\nSystem Configuration registers\n"
- "\tIMMR\t0x%08X\n", get_immr(0));
-
- printf("\tSIUMCR\t0x%08X", in_be32(&sysconf->sc_siumcr));
- printf("\tSYPCR\t0x%08X\n", in_be32(&sysconf->sc_sypcr));
-
- printf("\tSWT\t0x%08X", in_be32(&sysconf->sc_swt));
- printf("\tSWSR\t0x%04X\n", in_be16(&sysconf->sc_swsr));
-
- printf("\tSIPEND\t0x%08X\tSIMASK\t0x%08X\n",
- in_be32(&sysconf->sc_sipend), in_be32(&sysconf->sc_simask));
- printf("\tSIEL\t0x%08X\tSIVEC\t0x%08X\n",
- in_be32(&sysconf->sc_siel), in_be32(&sysconf->sc_sivec));
- printf("\tTESR\t0x%08X\tSDCR\t0x%08X\n",
- in_be32(&sysconf->sc_tesr), in_be32(&sysconf->sc_sdcr));
-
- printf("Memory Controller Registers\n");
- printf("\tBR0\t0x%08X\tOR0\t0x%08X\n", in_be32(&memctl->memc_br0),
- in_be32(&memctl->memc_or0));
- printf("\tBR1\t0x%08X\tOR1\t0x%08X\n", in_be32(&memctl->memc_br1),
- in_be32(&memctl->memc_or1));
- printf("\tBR2\t0x%08X\tOR2\t0x%08X\n", in_be32(&memctl->memc_br2),
- in_be32(&memctl->memc_or2));
- printf("\tBR3\t0x%08X\tOR3\t0x%08X\n", in_be32(&memctl->memc_br3),
- in_be32(&memctl->memc_or3));
- printf("\tBR4\t0x%08X\tOR4\t0x%08X\n", in_be32(&memctl->memc_br4),
- in_be32(&memctl->memc_or4));
- printf("\tBR5\t0x%08X\tOR5\t0x%08X\n", in_be32(&memctl->memc_br5),
- in_be32(&memctl->memc_or5));
- printf("\tBR6\t0x%08X\tOR6\t0x%08X\n", in_be32(&memctl->memc_br6),
- in_be32(&memctl->memc_or6));
- printf("\tBR7\t0x%08X\tOR7\t0x%08X\n", in_be32(&memctl->memc_br7),
- in_be32(&memctl->memc_or7));
- printf("\n\tmamr\t0x%08X\tmbmr\t0x%08X\n", in_be32(&memctl->memc_mamr),
- in_be32(&memctl->memc_mbmr));
- printf("\tmstat\t0x%04X\tmptpr\t0x%04X\n", in_be16(&memctl->memc_mstat),
- in_be16(&memctl->memc_mptpr));
- printf("\tmdr\t0x%08X\n", in_be32(&memctl->memc_mdr));
-
- printf("\nSystem Integration Timers\n");
- printf("\tTBSCR\t0x%04X\tRTCSC\t0x%04X\n",
- in_be16(&timers->sit_tbscr), in_be16(&timers->sit_rtcsc));
- printf("\tPISCR\t0x%04X\n", in_be16(&timers->sit_piscr));
-
- /*
- * May be some CPM info here?
- */
-}
diff --git a/arch/powerpc/cpu/mpc8xx/speed.c b/arch/powerpc/cpu/mpc8xx/speed.c
index fa8f87cbc5e..f8eb4a13eaf 100644
--- a/arch/powerpc/cpu/mpc8xx/speed.c
+++ b/arch/powerpc/cpu/mpc8xx/speed.c
@@ -17,8 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
*/
int get_clocks(void)
{
- uint immr = get_immr(0); /* Return full IMMR contents */
- immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
uint sccr = in_be32(&immap->im_clkrst.car_sccr);
uint divider = 1 << (((sccr & SCCR_DFBRG11) >> 11) * 2);
diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index 202ea81ae49..62ac80b03b9 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -130,12 +130,6 @@ in_flash:
/* initialize some SPRs that are hard to access from C */
/*----------------------------------------------------------------------*/
- lis r3, CONFIG_SYS_IMMR@h /* pass IMMR as arg1 to C routine */
- ori r1, r3, CONFIG_SYS_INIT_SP_OFFSET /* set up the stack in internal DPRAM */
- /* Note: R0 is still 0 here */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
/*
* Disable serialized ifetch and show cycles
* (i.e. set processor to normal mode).
@@ -151,6 +145,25 @@ in_flash:
ori r2, r2, CONFIG_SYS_DER@l
mtspr DER, r2
+ /* set up the stack in internal DPRAM */
+ lis r3, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@h
+ ori r3, r3, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@l
+ addi r1, r3, -8
+
+ bl board_init_f_alloc_reserve
+ addi r1, r3, -8
+
+ /* Zeroise the CPM dpram */
+ lis r4, CONFIG_SYS_IMMR@h
+ ori r4, r4, (0x2000 - 4)
+ li r0, (0x2000 / 4)
+ mtctr r0
+ li r0, 0
+1: stwu r0, 4(r4)
+ bdnz 1b
+
+ bl board_init_f_init_reserve
+
/* let the C-code set up the rest */
/* */
/* Be careful to keep code relocatable ! */
@@ -158,7 +171,7 @@ in_flash:
GET_GOT /* initialize GOT access */
- /* r3: IMMR */
+ lis r3, CONFIG_SYS_IMMR@h
bl cpu_init_f /* run low-level CPU init code (from Flash) */
bl board_init_f /* run 1st part of board init code (from Flash) */