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/processor.h>
22 #include <linux/libfdt.h>
25 #include <fsl_esdhc.h>
26 #if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_ARCH_MPC831X)
27 #include <linux/immap_qe.h>
31 DECLARE_GLOBAL_DATA_PTR;
33 #ifndef CONFIG_CPU_MPC83XX
36 volatile immap_t *immr;
37 ulong clock = gd->cpu_clk;
44 const struct cpu_type {
47 } cpu_type_list [] = {
57 CPU_TYPE_ENTRY(8347_TBGA_),
58 CPU_TYPE_ENTRY(8347_PBGA_),
60 CPU_TYPE_ENTRY(8358_TBGA_),
61 CPU_TYPE_ENTRY(8358_PBGA_),
68 immr = (immap_t *)CONFIG_SYS_IMMR;
76 switch (pvr & 0xffff0000) {
94 printf("Unknown core, ");
97 spridr = immr->sysconf.spridr;
99 for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
100 if (cpu_type_list[i].partid == PARTID_NO_E(spridr)) {
102 puts(cpu_type_list[i].name);
103 if (IS_E_PROCESSOR(spridr))
105 if ((SPR_FAMILY(spridr) == SPR_834X_FAMILY ||
106 SPR_FAMILY(spridr) == SPR_836X_FAMILY) &&
107 REVID_MAJOR(spridr) >= 2)
109 printf(", Rev: %d.%d", REVID_MAJOR(spridr),
110 REVID_MINOR(spridr));
114 if (i == ARRAY_SIZE(cpu_type_list))
115 printf("(SPRIDR %08x unknown), ", spridr);
117 printf(" at %s MHz, ", strmhz(buf, clock));
119 printf("CSB: %s MHz\n", strmhz(buf, gd->arch.csb_clk));
125 #ifndef CONFIG_SYSRESET
126 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
129 #ifndef MPC83xx_RESET
133 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
135 puts("Resetting the board.\n");
139 /* Interrupts and MMU off */
141 msr &= ~(MSR_EE | MSR_IR | MSR_DR);
144 /* enable Reset Control Reg */
145 immap->reset.rpr = 0x52535445;
149 /* confirm Reset Control Reg is enabled */
150 while(!((immap->reset.rcer) & RCER_CRE))
155 /* perform reset, only one bit */
156 immap->reset.rcr = RCR_SWHR;
158 #else /* ! MPC83xx_RESET */
160 immap->reset.rmr = RMR_CSRE; /* Checkstop Reset enable */
162 /* Interrupts and MMU off */
164 msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
168 * Trying to execute the next instruction at a non-existing address
169 * should cause a machine check, resulting in reset
171 addr = CONFIG_SYS_RESET_ADDRESS;
173 ((void (*)(void)) addr) ();
174 #endif /* MPC83xx_RESET */
181 * Get timebase clock frequency (like cpu_clk in Hz)
184 unsigned long get_tbclk(void)
186 return (gd->bus_clk + 3L) / 4L;
190 #if defined(CONFIG_WATCHDOG)
191 void watchdog_reset (void)
193 int re_enable = disable_interrupts();
195 /* Reset the 83xx watchdog */
196 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
197 immr->wdt.swsrr = 0x556c;
198 immr->wdt.swsrr = 0xaa39;
205 #ifndef CONFIG_DM_ETH
207 * Initializes on-chip ethernet controllers.
208 * to override, implement board_eth_init()
210 int cpu_eth_init(bd_t *bis)
212 #if defined(CONFIG_UEC_ETH)
213 uec_standard_init(bis);
216 #if defined(CONFIG_TSEC_ENET)
217 tsec_standard_init(bis);
221 #endif /* !CONFIG_DM_ETH */
224 * Initializes on-chip MMC controllers.
225 * to override, implement board_mmc_init()
227 int cpu_mmc_init(bd_t *bis)
229 #ifdef CONFIG_FSL_ESDHC
230 return fsl_esdhc_mmc_init(bis);
236 void ppcDWstore(unsigned int *addr, unsigned int *value)
238 asm("lfd 1, 0(%1)\n\t"
241 : "r" (addr), "r" (value)
245 void ppcDWload(unsigned int *addr, unsigned int *ret)
247 asm("lfd 1, 0(%0)\n\t"
250 : "r" (addr), "r" (ret)