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/delay.h>
23 #include <linux/libfdt.h>
26 #include <fsl_esdhc.h>
27 #if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_ARCH_MPC831X)
28 #include <linux/immap_qe.h>
32 DECLARE_GLOBAL_DATA_PTR;
34 #ifndef CONFIG_CPU_MPC83XX
37 volatile immap_t *immr;
38 ulong clock = gd->cpu_clk;
45 const struct cpu_type {
48 } cpu_type_list [] = {
58 CPU_TYPE_ENTRY(8347_TBGA_),
59 CPU_TYPE_ENTRY(8347_PBGA_),
61 CPU_TYPE_ENTRY(8358_TBGA_),
62 CPU_TYPE_ENTRY(8358_PBGA_),
69 immr = (immap_t *)CONFIG_SYS_IMMR;
77 switch (pvr & 0xffff0000) {
95 printf("Unknown core, ");
98 spridr = immr->sysconf.spridr;
100 for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
101 if (cpu_type_list[i].partid == PARTID_NO_E(spridr)) {
103 puts(cpu_type_list[i].name);
104 if (IS_E_PROCESSOR(spridr))
106 if ((SPR_FAMILY(spridr) == SPR_834X_FAMILY ||
107 SPR_FAMILY(spridr) == SPR_836X_FAMILY) &&
108 REVID_MAJOR(spridr) >= 2)
110 printf(", Rev: %d.%d", REVID_MAJOR(spridr),
111 REVID_MINOR(spridr));
115 if (i == ARRAY_SIZE(cpu_type_list))
116 printf("(SPRIDR %08x unknown), ", spridr);
118 printf(" at %s MHz, ", strmhz(buf, clock));
120 printf("CSB: %s MHz\n", strmhz(buf, gd->arch.csb_clk));
126 #ifndef CONFIG_SYSRESET
127 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
130 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
132 puts("Resetting the board.\n");
134 /* Interrupts and MMU off */
136 msr &= ~(MSR_EE | MSR_IR | MSR_DR);
139 /* enable Reset Control Reg */
140 immap->reset.rpr = 0x52535445;
144 /* confirm Reset Control Reg is enabled */
145 while(!((immap->reset.rcer) & RCER_CRE))
150 /* perform reset, only one bit */
151 immap->reset.rcr = RCR_SWHR;
158 * Get timebase clock frequency (like cpu_clk in Hz)
161 unsigned long get_tbclk(void)
163 return (gd->bus_clk + 3L) / 4L;
167 #if defined(CONFIG_WATCHDOG)
168 void watchdog_reset (void)
170 int re_enable = disable_interrupts();
172 /* Reset the 83xx watchdog */
173 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
174 immr->wdt.swsrr = 0x556c;
175 immr->wdt.swsrr = 0xaa39;
182 #ifndef CONFIG_DM_ETH
184 * Initializes on-chip ethernet controllers.
185 * to override, implement board_eth_init()
187 int cpu_eth_init(bd_t *bis)
189 #if defined(CONFIG_UEC_ETH)
190 uec_standard_init(bis);
193 #if defined(CONFIG_TSEC_ENET)
194 tsec_standard_init(bis);
198 #endif /* !CONFIG_DM_ETH */
201 * Initializes on-chip MMC controllers.
202 * to override, implement board_mmc_init()
204 int cpu_mmc_init(bd_t *bis)
206 #ifdef CONFIG_FSL_ESDHC
207 return fsl_esdhc_mmc_init(bis);
213 void ppcDWstore(unsigned int *addr, unsigned int *value)
215 asm("lfd 1, 0(%1)\n\t"
218 : "r" (addr), "r" (value)
222 void ppcDWload(unsigned int *addr, unsigned int *ret)
224 asm("lfd 1, 0(%0)\n\t"
227 : "r" (addr), "r" (ret)