Merge git://git.denx.de/u-boot-fsl-qoriq
[oweals/u-boot.git] / board / ti / ks2_evm / board_k2g.c
index b4765f7939f2c58078709caf72da2cba66942b1f..01328f1955c2be2fdee8728ebe9bb8f09a06bab7 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/arch/mmc_host_def.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <remoteproc.h>
 #include "mux-k2g.h"
 #include "../common/board_detect.h"
 
@@ -208,13 +209,15 @@ int board_mmc_init(bd_t *bis)
                return -1;
        }
 
-       omap_mmc_init(0, 0, 0, -1, -1);
+       if (board_is_k2g_gp())
+               omap_mmc_init(0, 0, 0, -1, -1);
+
        omap_mmc_init(1, 0, 0, -1, -1);
        return 0;
 }
 #endif
 
-#if defined(CONFIG_FIT_EMBED)
+#if defined(CONFIG_MULTI_DTB_FIT)
 int board_fit_config_name_match(const char *name)
 {
        bool eeprom_read = board_ti_was_eeprom_read();
@@ -223,6 +226,8 @@ int board_fit_config_name_match(const char *name)
                return 0;
        else if (!strcmp(name, "keystone-k2g-evm") && board_ti_is("66AK2GGP"))
                return 0;
+       else if (!strcmp(name, "keystone-k2g-ice") && board_ti_is("66AK2GIC"))
+               return 0;
        else
                return -1;
 }
@@ -274,13 +279,17 @@ int embedded_dtb_select(void)
 
        fdtdec_setup();
 
+       k2g_mux_config();
+
        k2g_reset_mux_config();
 
-       /* deassert FLASH_HOLD */
-       clrbits_le32(K2G_GPIO1_BANK2_BASE + K2G_GPIO_DIR_OFFSET,
-                    BIT(9));
-       setbits_le32(K2G_GPIO1_BANK2_BASE + K2G_GPIO_SETDATA_OFFSET,
-                    BIT(9));
+       if (board_is_k2g_gp()) {
+               /* deassert FLASH_HOLD */
+               clrbits_le32(K2G_GPIO1_BANK2_BASE + K2G_GPIO_DIR_OFFSET,
+                            BIT(9));
+               setbits_le32(K2G_GPIO1_BANK2_BASE + K2G_GPIO_SETDATA_OFFSET,
+                            BIT(9));
+       }
 
        return 0;
 }
@@ -300,6 +309,12 @@ int board_late_init(void)
        board_ti_set_ethaddr(1);
 #endif
 
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+       if (board_is_k2g_gp())
+               env_set("board_name", "66AK2GGP\0");
+       else if (board_is_k2g_ice())
+               env_set("board_name", "66AK2GIC\0");
+#endif
        return 0;
 }
 #endif
@@ -339,3 +354,23 @@ int get_num_eth_ports(void)
        return sizeof(eth_priv_cfg) / sizeof(struct eth_priv_t);
 }
 #endif
+
+#ifdef CONFIG_TI_SECURE_DEVICE
+void board_pmmc_image_process(ulong pmmc_image, size_t pmmc_size)
+{
+       int id = getenv_ulong("dev_pmmc", 10, 0);
+       int ret;
+
+       if (!rproc_is_initialized())
+               rproc_init();
+
+       ret = rproc_load(id, pmmc_image, pmmc_size);
+       printf("Load Remote Processor %d with data@addr=0x%08lx %u bytes:%s\n",
+              id, pmmc_image, pmmc_size, ret ? " Failed!" : " Success!");
+
+       if (!ret)
+               rproc_start(id);
+}
+
+U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_PMMC, board_pmmc_image_process);
+#endif