]> git.sur5r.net Git - u-boot/blobdiff - board/ti/ks2_evm/board.c
configs: x86: allow to override CONFIG_BOOTCOMMAND
[u-boot] / board / ti / ks2_evm / board.c
index ca668a7c690230ac00f877938ba12e1437b9eb86..ae86dfbe0aabeeed1ed4a66d2125e8427b028259 100644 (file)
@@ -7,8 +7,8 @@
  * SPDX-License-Identifier:     GPL-2.0+
  */
 
-#include "board.h"
 #include <common.h>
+#include "board.h"
 #include <spl.h>
 #include <exports.h>
 #include <fdt_support.h>
@@ -20,6 +20,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TI_AEMIF)
 static struct aemif_config aemif_configs[] = {
        {                       /* CS0 */
                .mode           = AEMIF_MODE_NAND,
@@ -33,6 +34,7 @@ static struct aemif_config aemif_configs[] = {
                .width          = AEMIF_WIDTH_8,
        },
 };
+#endif
 
 int dram_init(void)
 {
@@ -42,9 +44,19 @@ int dram_init(void)
 
        gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
                                    CONFIG_MAX_RAM_BANK_SIZE);
-       aemif_init(ARRAY_SIZE(aemif_configs), aemif_configs);
-       if (ddr3_size)
-               ddr3_init_ecc(KS2_DDR3A_EMIF_CTRL_BASE, ddr3_size);
+#if defined(CONFIG_TI_AEMIF)
+       if (!board_is_k2g_ice())
+               aemif_init(ARRAY_SIZE(aemif_configs), aemif_configs);
+#endif
+
+       if (!board_is_k2g_ice()) {
+               if (ddr3_size)
+                       ddr3_init_ecc(KS2_DDR3A_EMIF_CTRL_BASE, ddr3_size);
+               else
+                       ddr3_init_ecc(KS2_DDR3A_EMIF_CTRL_BASE,
+                                     gd->ram_size >> 30);
+       }
+
        return 0;
 }
 
@@ -62,7 +74,7 @@ int get_eth_env_param(char *env_name)
        char *env;
        int res = -1;
 
-       env = getenv(env_name);
+       env = env_get(env_name);
        if (env)
                res = simple_strtol(env, NULL, 0);
 
@@ -126,7 +138,7 @@ u32 spl_boot_device(void)
 }
 #endif
 
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+#ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
        int lpae;
@@ -139,9 +151,9 @@ int ft_board_setup(void *blob, bd_t *bd)
        u32 ddr3a_size;
        int unitrd_fixup = 0;
 
-       env = getenv("mem_lpae");
+       env = env_get("mem_lpae");
        lpae = env && simple_strtol(env, NULL, 0);
-       env = getenv("uinitrd_fixup");
+       env = env_get("uinitrd_fixup");
        unitrd_fixup = env && simple_strtol(env, NULL, 0);
 
        ddr3a_size = 0;
@@ -168,13 +180,13 @@ int ft_board_setup(void *blob, bd_t *bd)
        }
 
        /* reserve memory at start of bank */
-       env = getenv("mem_reserve_head");
+       env = env_get("mem_reserve_head");
        if (env) {
                start[0] += ustrtoul(env, &endp, 0);
                size[0] -= ustrtoul(env, &endp, 0);
        }
 
-       env = getenv("mem_reserve");
+       env = env_get("mem_reserve");
        if (env)
                size[0] -= ustrtoul(env, &endp, 0);
 
@@ -239,7 +251,7 @@ void ft_board_setup_ex(void *blob, bd_t *bd)
        char *env;
        u64 *reserve_start;
 
-       env = getenv("mem_lpae");
+       env = env_get("mem_lpae");
        lpae = env && simple_strtol(env, NULL, 0);
 
        if (lpae) {
@@ -268,4 +280,11 @@ void ft_board_setup_ex(void *blob, bd_t *bd)
 
        ddr3_check_ecc_int(KS2_DDR3A_EMIF_CTRL_BASE);
 }
+#endif /* CONFIG_OF_BOARD_SETUP */
+
+#if defined(CONFIG_DTB_RESELECT)
+int __weak embedded_dtb_select(void)
+{
+       return 0;
+}
 #endif