cpu.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /*
  2. * Copyright 2004,2007-2011 Freescale Semiconductor, Inc.
  3. * (C) Copyright 2002, 2003 Motorola Inc.
  4. * Xianghua Xiao (X.Xiao@motorola.com)
  5. *
  6. * (C) Copyright 2000
  7. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. #include <config.h>
  28. #include <common.h>
  29. #include <watchdog.h>
  30. #include <command.h>
  31. #include <fsl_esdhc.h>
  32. #include <asm/cache.h>
  33. #include <asm/io.h>
  34. #include <asm/mmu.h>
  35. #include <asm/fsl_ifc.h>
  36. #include <asm/fsl_law.h>
  37. #include <asm/fsl_lbc.h>
  38. #include <post.h>
  39. #include <asm/processor.h>
  40. #include <asm/fsl_ddr_sdram.h>
  41. DECLARE_GLOBAL_DATA_PTR;
  42. /*
  43. * Default board reset function
  44. */
  45. static void
  46. __board_reset(void)
  47. {
  48. /* Do nothing */
  49. }
  50. void board_reset(void) __attribute__((weak, alias("__board_reset")));
  51. int checkcpu (void)
  52. {
  53. sys_info_t sysinfo;
  54. uint pvr, svr;
  55. uint ver;
  56. uint major, minor;
  57. struct cpu_type *cpu;
  58. char buf1[32], buf2[32];
  59. #if defined(CONFIG_DDR_CLK_FREQ) || \
  60. (defined(CONFIG_FSL_CORENET) && !defined(CONFIG_SYS_FSL_QORIQ_CHASSIS2))
  61. volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  62. #endif /* CONFIG_FSL_CORENET */
  63. #ifdef CONFIG_DDR_CLK_FREQ
  64. u32 ddr_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO)
  65. >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
  66. #else
  67. #ifdef CONFIG_FSL_CORENET
  68. u32 ddr_sync ;
  69. #ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2
  70. ddr_sync = 0; /* only async mode is supported */
  71. #else
  72. ddr_sync = ((gur->rcwsr[5]) & FSL_CORENET_RCWSR5_DDR_SYNC)
  73. >> FSL_CORENET_RCWSR5_DDR_SYNC_SHIFT;
  74. #endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
  75. #else
  76. u32 ddr_ratio = 0;
  77. #endif /* CONFIG_FSL_CORENET */
  78. #endif /* CONFIG_DDR_CLK_FREQ */
  79. unsigned int i, core, nr_cores = cpu_numcores();
  80. u32 mask = cpu_mask();
  81. svr = get_svr();
  82. major = SVR_MAJ(svr);
  83. minor = SVR_MIN(svr);
  84. if (cpu_numcores() > 1) {
  85. #ifndef CONFIG_MP
  86. puts("Unicore software on multiprocessor system!!\n"
  87. "To enable mutlticore build define CONFIG_MP\n");
  88. #endif
  89. volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR);
  90. printf("CPU%d: ", pic->whoami);
  91. } else {
  92. puts("CPU: ");
  93. }
  94. cpu = gd->cpu;
  95. puts(cpu->name);
  96. if (IS_E_PROCESSOR(svr))
  97. puts("E");
  98. printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
  99. pvr = get_pvr();
  100. ver = PVR_VER(pvr);
  101. major = PVR_MAJ(pvr);
  102. minor = PVR_MIN(pvr);
  103. printf("Core: ");
  104. switch(ver) {
  105. case PVR_VER_E500_V1:
  106. case PVR_VER_E500_V2:
  107. puts("E500");
  108. break;
  109. case PVR_VER_E500MC:
  110. puts("E500MC");
  111. break;
  112. case PVR_VER_E5500:
  113. puts("E5500");
  114. break;
  115. case PVR_VER_E6500:
  116. puts("E6500");
  117. break;
  118. default:
  119. puts("Unknown");
  120. break;
  121. }
  122. printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
  123. if (nr_cores > CONFIG_MAX_CPUS) {
  124. panic("\nUnexpected number of cores: %d, max is %d\n",
  125. nr_cores, CONFIG_MAX_CPUS);
  126. }
  127. get_sys_info(&sysinfo);
  128. puts("Clock Configuration:");
  129. for_each_cpu(i, core, nr_cores, mask) {
  130. if (!(i & 3))
  131. printf ("\n ");
  132. printf("CPU%d:%-4s MHz, ", core,
  133. strmhz(buf1, sysinfo.freqProcessor[core]));
  134. }
  135. printf("\n CCB:%-4s MHz,\n", strmhz(buf1, sysinfo.freqSystemBus));
  136. #ifdef CONFIG_FSL_CORENET
  137. if (ddr_sync == 1) {
  138. printf(" DDR:%-4s MHz (%s MT/s data rate) "
  139. "(Synchronous), ",
  140. strmhz(buf1, sysinfo.freqDDRBus/2),
  141. strmhz(buf2, sysinfo.freqDDRBus));
  142. } else {
  143. printf(" DDR:%-4s MHz (%s MT/s data rate) "
  144. "(Asynchronous), ",
  145. strmhz(buf1, sysinfo.freqDDRBus/2),
  146. strmhz(buf2, sysinfo.freqDDRBus));
  147. }
  148. #else
  149. switch (ddr_ratio) {
  150. case 0x0:
  151. printf(" DDR:%-4s MHz (%s MT/s data rate), ",
  152. strmhz(buf1, sysinfo.freqDDRBus/2),
  153. strmhz(buf2, sysinfo.freqDDRBus));
  154. break;
  155. case 0x7:
  156. printf(" DDR:%-4s MHz (%s MT/s data rate) "
  157. "(Synchronous), ",
  158. strmhz(buf1, sysinfo.freqDDRBus/2),
  159. strmhz(buf2, sysinfo.freqDDRBus));
  160. break;
  161. default:
  162. printf(" DDR:%-4s MHz (%s MT/s data rate) "
  163. "(Asynchronous), ",
  164. strmhz(buf1, sysinfo.freqDDRBus/2),
  165. strmhz(buf2, sysinfo.freqDDRBus));
  166. break;
  167. }
  168. #endif
  169. #if defined(CONFIG_FSL_LBC)
  170. if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
  171. printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
  172. } else {
  173. printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
  174. sysinfo.freqLocalBus);
  175. }
  176. #endif
  177. #if defined(CONFIG_FSL_IFC)
  178. printf("IFC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
  179. #endif
  180. #ifdef CONFIG_CPM2
  181. printf("CPM: %s MHz\n", strmhz(buf1, sysinfo.freqSystemBus));
  182. #endif
  183. #ifdef CONFIG_QE
  184. printf(" QE:%-4s MHz\n", strmhz(buf1, sysinfo.freqQE));
  185. #endif
  186. #ifdef CONFIG_SYS_DPAA_FMAN
  187. for (i = 0; i < CONFIG_SYS_NUM_FMAN; i++) {
  188. printf(" FMAN%d: %s MHz\n", i + 1,
  189. strmhz(buf1, sysinfo.freqFMan[i]));
  190. }
  191. #endif
  192. #ifdef CONFIG_SYS_DPAA_PME
  193. printf(" PME: %s MHz\n", strmhz(buf1, sysinfo.freqPME));
  194. #endif
  195. puts("L1: D-cache 32 kB enabled\n I-cache 32 kB enabled\n");
  196. return 0;
  197. }
  198. /* ------------------------------------------------------------------------- */
  199. int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  200. {
  201. /* Everything after the first generation of PQ3 parts has RSTCR */
  202. #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
  203. defined(CONFIG_MPC8555) || defined(CONFIG_MPC8560)
  204. unsigned long val, msr;
  205. /*
  206. * Initiate hard reset in debug control register DBCR0
  207. * Make sure MSR[DE] = 1. This only resets the core.
  208. */
  209. msr = mfmsr ();
  210. msr |= MSR_DE;
  211. mtmsr (msr);
  212. val = mfspr(DBCR0);
  213. val |= 0x70000000;
  214. mtspr(DBCR0,val);
  215. #else
  216. volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  217. /* Attempt board-specific reset */
  218. board_reset();
  219. /* Next try asserting HRESET_REQ */
  220. out_be32(&gur->rstcr, 0x2);
  221. udelay(100);
  222. #endif
  223. return 1;
  224. }
  225. /*
  226. * Get timebase clock frequency
  227. */
  228. #ifndef CONFIG_SYS_FSL_TBCLK_DIV
  229. #define CONFIG_SYS_FSL_TBCLK_DIV 8
  230. #endif
  231. unsigned long get_tbclk (void)
  232. {
  233. unsigned long tbclk_div = CONFIG_SYS_FSL_TBCLK_DIV;
  234. return (gd->bus_clk + (tbclk_div >> 1)) / tbclk_div;
  235. }
  236. #if defined(CONFIG_WATCHDOG)
  237. void
  238. watchdog_reset(void)
  239. {
  240. int re_enable = disable_interrupts();
  241. reset_85xx_watchdog();
  242. if (re_enable) enable_interrupts();
  243. }
  244. void
  245. reset_85xx_watchdog(void)
  246. {
  247. /*
  248. * Clear TSR(WIS) bit by writing 1
  249. */
  250. mtspr(SPRN_TSR, TSR_WIS);
  251. }
  252. #endif /* CONFIG_WATCHDOG */
  253. /*
  254. * Initializes on-chip MMC controllers.
  255. * to override, implement board_mmc_init()
  256. */
  257. int cpu_mmc_init(bd_t *bis)
  258. {
  259. #ifdef CONFIG_FSL_ESDHC
  260. return fsl_esdhc_mmc_init(bis);
  261. #else
  262. return 0;
  263. #endif
  264. }
  265. /*
  266. * Print out the state of various machine registers.
  267. * Currently prints out LAWs, BR0/OR0 for LBC, CSPR/CSOR/Timing
  268. * parameters for IFC and TLBs
  269. */
  270. void mpc85xx_reginfo(void)
  271. {
  272. print_tlbcam();
  273. print_laws();
  274. #if defined(CONFIG_FSL_LBC)
  275. print_lbc_regs();
  276. #endif
  277. #ifdef CONFIG_FSL_IFC
  278. print_ifc_regs();
  279. #endif
  280. }
  281. /* Common ddr init for non-corenet fsl 85xx platforms */
  282. #ifndef CONFIG_FSL_CORENET
  283. #if defined(CONFIG_SYS_RAMBOOT) && !defined(CONFIG_SYS_INIT_L2_ADDR)
  284. phys_size_t initdram(int board_type)
  285. {
  286. #if defined(CONFIG_SPD_EEPROM) || defined(CONFIG_DDR_SPD)
  287. return fsl_ddr_sdram_size();
  288. #else
  289. return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
  290. #endif
  291. }
  292. #else /* CONFIG_SYS_RAMBOOT */
  293. phys_size_t initdram(int board_type)
  294. {
  295. phys_size_t dram_size = 0;
  296. #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_MSYNC_IN)
  297. {
  298. ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  299. unsigned int x = 10;
  300. unsigned int i;
  301. /*
  302. * Work around to stabilize DDR DLL
  303. */
  304. out_be32(&gur->ddrdllcr, 0x81000000);
  305. asm("sync;isync;msync");
  306. udelay(200);
  307. while (in_be32(&gur->ddrdllcr) != 0x81000100) {
  308. setbits_be32(&gur->devdisr, 0x00010000);
  309. for (i = 0; i < x; i++)
  310. ;
  311. clrbits_be32(&gur->devdisr, 0x00010000);
  312. x++;
  313. }
  314. }
  315. #endif
  316. #if defined(CONFIG_SPD_EEPROM) || \
  317. defined(CONFIG_DDR_SPD) || \
  318. defined(CONFIG_SYS_DDR_RAW_TIMING)
  319. dram_size = fsl_ddr_sdram();
  320. #else
  321. dram_size = fixed_sdram();
  322. #endif
  323. dram_size = setup_ddr_tlbs(dram_size / 0x100000);
  324. dram_size *= 0x100000;
  325. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  326. /*
  327. * Initialize and enable DDR ECC.
  328. */
  329. ddr_enable_ecc(dram_size);
  330. #endif
  331. #if defined(CONFIG_FSL_LBC)
  332. /* Some boards also have sdram on the lbc */
  333. lbc_sdram_init();
  334. #endif
  335. debug("DDR: ");
  336. return dram_size;
  337. }
  338. #endif /* CONFIG_SYS_RAMBOOT */
  339. #endif
  340. #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
  341. /* Board-specific functions defined in each board's ddr.c */
  342. void fsl_ddr_get_spd(generic_spd_eeprom_t *ctrl_dimms_spd,
  343. unsigned int ctrl_num);
  344. void read_tlbcam_entry(int idx, u32 *valid, u32 *tsize, unsigned long *epn,
  345. phys_addr_t *rpn);
  346. unsigned int
  347. setup_ddr_tlbs_phys(phys_addr_t p_addr, unsigned int memsize_in_meg);
  348. void clear_ddr_tlbs_phys(phys_addr_t p_addr, unsigned int memsize_in_meg);
  349. static void dump_spd_ddr_reg(void)
  350. {
  351. int i, j, k, m;
  352. u8 *p_8;
  353. u32 *p_32;
  354. ccsr_ddr_t *ddr[CONFIG_NUM_DDR_CONTROLLERS];
  355. generic_spd_eeprom_t
  356. spd[CONFIG_NUM_DDR_CONTROLLERS][CONFIG_DIMM_SLOTS_PER_CTLR];
  357. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++)
  358. fsl_ddr_get_spd(spd[i], i);
  359. puts("SPD data of all dimms (zero vaule is omitted)...\n");
  360. puts("Byte (hex) ");
  361. k = 1;
  362. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
  363. for (j = 0; j < CONFIG_DIMM_SLOTS_PER_CTLR; j++)
  364. printf("Dimm%d ", k++);
  365. }
  366. puts("\n");
  367. for (k = 0; k < sizeof(generic_spd_eeprom_t); k++) {
  368. m = 0;
  369. printf("%3d (0x%02x) ", k, k);
  370. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
  371. for (j = 0; j < CONFIG_DIMM_SLOTS_PER_CTLR; j++) {
  372. p_8 = (u8 *) &spd[i][j];
  373. if (p_8[k]) {
  374. printf("0x%02x ", p_8[k]);
  375. m++;
  376. } else
  377. puts(" ");
  378. }
  379. }
  380. if (m)
  381. puts("\n");
  382. else
  383. puts("\r");
  384. }
  385. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
  386. switch (i) {
  387. case 0:
  388. ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR_ADDR;
  389. break;
  390. #if defined(CONFIG_SYS_MPC85xx_DDR2_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 1)
  391. case 1:
  392. ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR2_ADDR;
  393. break;
  394. #endif
  395. #if defined(CONFIG_SYS_MPC85xx_DDR3_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 2)
  396. case 2:
  397. ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR3_ADDR;
  398. break;
  399. #endif
  400. #if defined(CONFIG_SYS_MPC85xx_DDR4_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 3)
  401. case 3:
  402. ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR4_ADDR;
  403. break;
  404. #endif
  405. default:
  406. printf("%s unexpected controller number = %u\n",
  407. __func__, i);
  408. return;
  409. }
  410. }
  411. printf("DDR registers dump for all controllers "
  412. "(zero vaule is omitted)...\n");
  413. puts("Offset (hex) ");
  414. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++)
  415. printf(" Base + 0x%04x", (u32)ddr[i] & 0xFFFF);
  416. puts("\n");
  417. for (k = 0; k < sizeof(ccsr_ddr_t)/4; k++) {
  418. m = 0;
  419. printf("%6d (0x%04x)", k * 4, k * 4);
  420. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
  421. p_32 = (u32 *) ddr[i];
  422. if (p_32[k]) {
  423. printf(" 0x%08x", p_32[k]);
  424. m++;
  425. } else
  426. puts(" ");
  427. }
  428. if (m)
  429. puts("\n");
  430. else
  431. puts("\r");
  432. }
  433. puts("\n");
  434. }
  435. /* invalid the TLBs for DDR and setup new ones to cover p_addr */
  436. static int reset_tlb(phys_addr_t p_addr, u32 size, phys_addr_t *phys_offset)
  437. {
  438. u32 vstart = CONFIG_SYS_DDR_SDRAM_BASE;
  439. unsigned long epn;
  440. u32 tsize, valid, ptr;
  441. int ddr_esel;
  442. clear_ddr_tlbs_phys(p_addr, size>>20);
  443. /* Setup new tlb to cover the physical address */
  444. setup_ddr_tlbs_phys(p_addr, size>>20);
  445. ptr = vstart;
  446. ddr_esel = find_tlb_idx((void *)ptr, 1);
  447. if (ddr_esel != -1) {
  448. read_tlbcam_entry(ddr_esel, &valid, &tsize, &epn, phys_offset);
  449. } else {
  450. printf("TLB error in function %s\n", __func__);
  451. return -1;
  452. }
  453. return 0;
  454. }
  455. /*
  456. * slide the testing window up to test another area
  457. * for 32_bit system, the maximum testable memory is limited to
  458. * CONFIG_MAX_MEM_MAPPED
  459. */
  460. int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
  461. {
  462. phys_addr_t test_cap, p_addr;
  463. phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED);
  464. #if !defined(CONFIG_PHYS_64BIT) || \
  465. !defined(CONFIG_SYS_INIT_RAM_ADDR_PHYS) || \
  466. (CONFIG_SYS_INIT_RAM_ADDR_PHYS < 0x100000000ull)
  467. test_cap = p_size;
  468. #else
  469. test_cap = gd->ram_size;
  470. #endif
  471. p_addr = (*vstart) + (*size) + (*phys_offset);
  472. if (p_addr < test_cap - 1) {
  473. p_size = min(test_cap - p_addr, CONFIG_MAX_MEM_MAPPED);
  474. if (reset_tlb(p_addr, p_size, phys_offset) == -1)
  475. return -1;
  476. *vstart = CONFIG_SYS_DDR_SDRAM_BASE;
  477. *size = (u32) p_size;
  478. printf("Testing 0x%08llx - 0x%08llx\n",
  479. (u64)(*vstart) + (*phys_offset),
  480. (u64)(*vstart) + (*phys_offset) + (*size) - 1);
  481. } else
  482. return 1;
  483. return 0;
  484. }
  485. /* initialization for testing area */
  486. int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
  487. {
  488. phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED);
  489. *vstart = CONFIG_SYS_DDR_SDRAM_BASE;
  490. *size = (u32) p_size; /* CONFIG_MAX_MEM_MAPPED < 4G */
  491. *phys_offset = 0;
  492. #if !defined(CONFIG_PHYS_64BIT) || \
  493. !defined(CONFIG_SYS_INIT_RAM_ADDR_PHYS) || \
  494. (CONFIG_SYS_INIT_RAM_ADDR_PHYS < 0x100000000ull)
  495. if (gd->ram_size > CONFIG_MAX_MEM_MAPPED) {
  496. puts("Cannot test more than ");
  497. print_size(CONFIG_MAX_MEM_MAPPED,
  498. " without proper 36BIT support.\n");
  499. }
  500. #endif
  501. printf("Testing 0x%08llx - 0x%08llx\n",
  502. (u64)(*vstart) + (*phys_offset),
  503. (u64)(*vstart) + (*phys_offset) + (*size) - 1);
  504. return 0;
  505. }
  506. /* invalid TLBs for DDR and remap as normal after testing */
  507. int arch_memory_test_cleanup(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
  508. {
  509. unsigned long epn;
  510. u32 tsize, valid, ptr;
  511. phys_addr_t rpn = 0;
  512. int ddr_esel;
  513. /* disable the TLBs for this testing */
  514. ptr = *vstart;
  515. while (ptr < (*vstart) + (*size)) {
  516. ddr_esel = find_tlb_idx((void *)ptr, 1);
  517. if (ddr_esel != -1) {
  518. read_tlbcam_entry(ddr_esel, &valid, &tsize, &epn, &rpn);
  519. disable_tlb(ddr_esel);
  520. }
  521. ptr += TSIZE_TO_BYTES(tsize);
  522. }
  523. puts("Remap DDR ");
  524. setup_ddr_tlbs(gd->ram_size>>20);
  525. puts("\n");
  526. return 0;
  527. }
  528. void arch_memory_failure_handle(void)
  529. {
  530. dump_spd_ddr_reg();
  531. }
  532. #endif