1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
7 * CPU specific code for the MPC83xx family.
9 * Derived from the MPC8260 and MPC85xx.
21 #include <asm/global_data.h>
22 #include <asm/processor.h>
23 #include <linux/delay.h>
24 #include <linux/libfdt.h>
27 #include <fsl_esdhc.h>
28 #if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_ARCH_MPC831X)
29 #include <linux/immap_qe.h>
33 DECLARE_GLOBAL_DATA_PTR;
35 #ifndef CONFIG_CPU_MPC83XX
38 volatile immap_t *immr;
39 ulong clock = gd->cpu_clk;
46 const struct cpu_type {
49 } cpu_type_list [] = {
59 CPU_TYPE_ENTRY(8347_TBGA_),
60 CPU_TYPE_ENTRY(8347_PBGA_),
62 CPU_TYPE_ENTRY(8358_TBGA_),
63 CPU_TYPE_ENTRY(8358_PBGA_),
70 immr = (immap_t *)CONFIG_SYS_IMMR;
78 switch (pvr & 0xffff0000) {
96 printf("Unknown core, ");
99 spridr = immr->sysconf.spridr;
101 for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
102 if (cpu_type_list[i].partid == PARTID_NO_E(spridr)) {
104 puts(cpu_type_list[i].name);
105 if (IS_E_PROCESSOR(spridr))
107 if ((SPR_FAMILY(spridr) == SPR_834X_FAMILY ||
108 SPR_FAMILY(spridr) == SPR_836X_FAMILY) &&
109 REVID_MAJOR(spridr) >= 2)
111 printf(", Rev: %d.%d", REVID_MAJOR(spridr),
112 REVID_MINOR(spridr));
116 if (i == ARRAY_SIZE(cpu_type_list))
117 printf("(SPRIDR %08x unknown), ", spridr);
119 printf(" at %s MHz, ", strmhz(buf, clock));
121 printf("CSB: %s MHz\n", strmhz(buf, gd->arch.csb_clk));
127 #ifndef CONFIG_SYSRESET
128 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
131 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
133 puts("Resetting the board.\n");
135 /* Interrupts and MMU off */
137 msr &= ~(MSR_EE | MSR_IR | MSR_DR);
140 /* enable Reset Control Reg */
141 immap->reset.rpr = 0x52535445;
145 /* confirm Reset Control Reg is enabled */
146 while(!((immap->reset.rcer) & RCER_CRE))
151 /* perform reset, only one bit */
152 immap->reset.rcr = RCR_SWHR;
159 * Get timebase clock frequency (like cpu_clk in Hz)
162 unsigned long get_tbclk(void)
164 return (gd->bus_clk + 3L) / 4L;
168 #if defined(CONFIG_WATCHDOG) && !defined(CONFIG_WDT)
169 void watchdog_reset (void)
171 int re_enable = disable_interrupts();
173 /* Reset the 83xx watchdog */
174 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
175 immr->wdt.swsrr = 0x556c;
176 immr->wdt.swsrr = 0xaa39;
184 * Initializes on-chip MMC controllers.
185 * to override, implement board_mmc_init()
187 int cpu_mmc_init(struct bd_info *bis)
189 #ifdef CONFIG_FSL_ESDHC
190 return fsl_esdhc_mmc_init(bis);
196 void ppcDWstore(unsigned int *addr, unsigned int *value)
198 asm("lfd 1, 0(%1)\n\t"
201 : "r" (addr), "r" (value)
205 void ppcDWload(unsigned int *addr, unsigned int *ret)
207 asm("lfd 1, 0(%0)\n\t"
210 : "r" (addr), "r" (ret)