1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
3 * Copyright (c) 2018 Microsemi Corporation
10 #include <asm/types.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 static inline int vcoreiii_train_bytelane(void)
21 ret = hal_vcoreiii_train_bytelane(0);
23 #if defined(CONFIG_SOC_OCELOT) || defined(CONFIG_SOC_JR2) || \
24 defined(CONFIG_SOC_SERVALT) || defined(CONFIG_SOC_SERVAL)
27 ret = hal_vcoreiii_train_bytelane(1);
33 int vcoreiii_ddr_init(void)
37 if (!(readl(BASE_CFG + ICPU_MEMCTRL_STAT)
38 & ICPU_MEMCTRL_STAT_INIT_DONE)) {
39 hal_vcoreiii_init_memctl();
40 hal_vcoreiii_wait_memctl();
41 if (hal_vcoreiii_init_dqs() || vcoreiii_train_bytelane())
42 hal_vcoreiii_ddr_failed();
47 hal_vcoreiii_ddr_verified();
49 hal_vcoreiii_ddr_failed();
51 /* Remap DDR to kuseg: Clear boot-mode */
52 clrbits_le32(BASE_CFG + ICPU_GENERAL_CTRL,
53 ICPU_GENERAL_CTRL_BOOT_MODE_ENA);
54 /* - and read-back to activate/verify */
55 readl(BASE_CFG + ICPU_GENERAL_CTRL);
60 int print_cpuinfo(void)
62 printf("MSCC VCore-III MIPS 24Kec\n");
69 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;