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.
19 #include <asm/processor.h>
20 #include <linux/libfdt.h>
23 #include <fsl_esdhc.h>
24 #if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_ARCH_MPC831X)
25 #include <linux/immap_qe.h>
29 DECLARE_GLOBAL_DATA_PTR;
31 #ifndef CONFIG_CPU_MPC83XX
34 volatile immap_t *immr;
35 ulong clock = gd->cpu_clk;
42 const struct cpu_type {
45 } cpu_type_list [] = {
55 CPU_TYPE_ENTRY(8347_TBGA_),
56 CPU_TYPE_ENTRY(8347_PBGA_),
58 CPU_TYPE_ENTRY(8358_TBGA_),
59 CPU_TYPE_ENTRY(8358_PBGA_),
66 immr = (immap_t *)CONFIG_SYS_IMMR;
74 switch (pvr & 0xffff0000) {
92 printf("Unknown core, ");
95 spridr = immr->sysconf.spridr;
97 for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
98 if (cpu_type_list[i].partid == PARTID_NO_E(spridr)) {
100 puts(cpu_type_list[i].name);
101 if (IS_E_PROCESSOR(spridr))
103 if ((SPR_FAMILY(spridr) == SPR_834X_FAMILY ||
104 SPR_FAMILY(spridr) == SPR_836X_FAMILY) &&
105 REVID_MAJOR(spridr) >= 2)
107 printf(", Rev: %d.%d", REVID_MAJOR(spridr),
108 REVID_MINOR(spridr));
112 if (i == ARRAY_SIZE(cpu_type_list))
113 printf("(SPRIDR %08x unknown), ", spridr);
115 printf(" at %s MHz, ", strmhz(buf, clock));
117 printf("CSB: %s MHz\n", strmhz(buf, gd->arch.csb_clk));
123 #ifndef CONFIG_SYSRESET
125 do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
128 #ifndef MPC83xx_RESET
132 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
134 puts("Resetting the board.\n");
138 /* Interrupts and MMU off */
140 msr &= ~(MSR_EE | MSR_IR | MSR_DR);
143 /* enable Reset Control Reg */
144 immap->reset.rpr = 0x52535445;
148 /* confirm Reset Control Reg is enabled */
149 while(!((immap->reset.rcer) & RCER_CRE))
154 /* perform reset, only one bit */
155 immap->reset.rcr = RCR_SWHR;
157 #else /* ! MPC83xx_RESET */
159 immap->reset.rmr = RMR_CSRE; /* Checkstop Reset enable */
161 /* Interrupts and MMU off */
163 msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
167 * Trying to execute the next instruction at a non-existing address
168 * should cause a machine check, resulting in reset
170 addr = CONFIG_SYS_RESET_ADDRESS;
172 ((void (*)(void)) addr) ();
173 #endif /* MPC83xx_RESET */
180 * Get timebase clock frequency (like cpu_clk in Hz)
183 unsigned long get_tbclk(void)
185 return (gd->bus_clk + 3L) / 4L;
189 #if defined(CONFIG_WATCHDOG)
190 void watchdog_reset (void)
192 int re_enable = disable_interrupts();
194 /* Reset the 83xx watchdog */
195 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
196 immr->wdt.swsrr = 0x556c;
197 immr->wdt.swsrr = 0xaa39;
204 #ifndef CONFIG_DM_ETH
206 * Initializes on-chip ethernet controllers.
207 * to override, implement board_eth_init()
209 int cpu_eth_init(bd_t *bis)
211 #if defined(CONFIG_UEC_ETH)
212 uec_standard_init(bis);
215 #if defined(CONFIG_TSEC_ENET)
216 tsec_standard_init(bis);
220 #endif /* !CONFIG_DM_ETH */
223 * Initializes on-chip MMC controllers.
224 * to override, implement board_mmc_init()
226 int cpu_mmc_init(bd_t *bis)
228 #ifdef CONFIG_FSL_ESDHC
229 return fsl_esdhc_mmc_init(bis);
235 void ppcDWstore(unsigned int *addr, unsigned int *value)
237 asm("lfd 1, 0(%1)\n\t"
240 : "r" (addr), "r" (value)
244 void ppcDWload(unsigned int *addr, unsigned int *ret)
246 asm("lfd 1, 0(%0)\n\t"
249 : "r" (addr), "r" (ret)