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.
16 #include <asm/processor.h>
17 #include <linux/libfdt.h>
20 #include <fsl_esdhc.h>
21 #if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_ARCH_MPC831X)
22 #include <linux/immap_qe.h>
26 DECLARE_GLOBAL_DATA_PTR;
28 #ifndef CONFIG_CPU_MPC83XX
31 volatile immap_t *immr;
32 ulong clock = gd->cpu_clk;
39 const struct cpu_type {
42 } cpu_type_list [] = {
52 CPU_TYPE_ENTRY(8347_TBGA_),
53 CPU_TYPE_ENTRY(8347_PBGA_),
55 CPU_TYPE_ENTRY(8358_TBGA_),
56 CPU_TYPE_ENTRY(8358_PBGA_),
63 immr = (immap_t *)CONFIG_SYS_IMMR;
71 switch (pvr & 0xffff0000) {
89 printf("Unknown core, ");
92 spridr = immr->sysconf.spridr;
94 for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
95 if (cpu_type_list[i].partid == PARTID_NO_E(spridr)) {
97 puts(cpu_type_list[i].name);
98 if (IS_E_PROCESSOR(spridr))
100 if ((SPR_FAMILY(spridr) == SPR_834X_FAMILY ||
101 SPR_FAMILY(spridr) == SPR_836X_FAMILY) &&
102 REVID_MAJOR(spridr) >= 2)
104 printf(", Rev: %d.%d", REVID_MAJOR(spridr),
105 REVID_MINOR(spridr));
109 if (i == ARRAY_SIZE(cpu_type_list))
110 printf("(SPRIDR %08x unknown), ", spridr);
112 printf(" at %s MHz, ", strmhz(buf, clock));
114 printf("CSB: %s MHz\n", strmhz(buf, gd->arch.csb_clk));
120 #ifndef CONFIG_SYSRESET
122 do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
125 #ifndef MPC83xx_RESET
129 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
131 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;
154 #else /* ! MPC83xx_RESET */
156 immap->reset.rmr = RMR_CSRE; /* Checkstop Reset enable */
158 /* Interrupts and MMU off */
160 msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
164 * Trying to execute the next instruction at a non-existing address
165 * should cause a machine check, resulting in reset
167 addr = CONFIG_SYS_RESET_ADDRESS;
169 ((void (*)(void)) addr) ();
170 #endif /* MPC83xx_RESET */
177 * Get timebase clock frequency (like cpu_clk in Hz)
180 unsigned long get_tbclk(void)
182 return (gd->bus_clk + 3L) / 4L;
186 #if defined(CONFIG_WATCHDOG)
187 void watchdog_reset (void)
189 int re_enable = disable_interrupts();
191 /* Reset the 83xx watchdog */
192 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
193 immr->wdt.swsrr = 0x556c;
194 immr->wdt.swsrr = 0xaa39;
197 enable_interrupts ();
201 #ifndef CONFIG_DM_ETH
203 * Initializes on-chip ethernet controllers.
204 * to override, implement board_eth_init()
206 int cpu_eth_init(bd_t *bis)
208 #if defined(CONFIG_UEC_ETH)
209 uec_standard_init(bis);
212 #if defined(CONFIG_TSEC_ENET)
213 tsec_standard_init(bis);
217 #endif /* !CONFIG_DM_ETH */
220 * Initializes on-chip MMC controllers.
221 * to override, implement board_mmc_init()
223 int cpu_mmc_init(bd_t *bis)
225 #ifdef CONFIG_FSL_ESDHC
226 return fsl_esdhc_mmc_init(bis);
232 void ppcDWstore(unsigned int *addr, unsigned int *value)
234 asm("lfd 1, 0(%1)\n\t"
237 : "r" (addr), "r" (value)
241 void ppcDWload(unsigned int *addr, unsigned int *ret)
243 asm("lfd 1, 0(%0)\n\t"
246 : "r" (addr), "r" (ret)