]> git.sur5r.net Git - u-boot/commitdiff
ARM: k2g: Define embedded_dtb_select for runtime DTB selection in U-boot
authorCooper Jr., Franklin <fcooper@ti.com>
Fri, 16 Jun 2017 22:25:15 +0000 (17:25 -0500)
committerTom Rini <trini@konsulko.com>
Mon, 10 Jul 2017 18:25:55 +0000 (14:25 -0400)
For K2G, runtime DTB selection utilizes the embedded_dtb_select function.
Therefore, define the function which will perform a EEPROM read and then
retries selecting the correct dtb now that it can detect which board its
on. For other Keystone devices use an empty function since they will still
use the embedded FIT functionality but their FIT will only contain a single
dtb.

Most production K2G boards do not have their EEPROM programmed. Therefore,
perform a test to verify a K2G GP is currently being used and if it is then
set the values normally set by a EEPROM read.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
board/ti/ks2_evm/board.c
board/ti/ks2_evm/board_k2g.c

index 03254e1497684e263d175f7558c80de5b4389d5f..479231106af2ec5af6bd6f2d3c58c32da11c0408 100644 (file)
@@ -277,3 +277,10 @@ 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
index f0bd31d6f7521c399b9b9e46b0837e62f68b7783..3c75e221271ff0c62bb1e1eddcd9334764f1adcf 100644 (file)
 #include <asm/ti-common/keystone_net.h>
 #include <asm/arch/psc_defs.h>
 #include <asm/arch/mmc_host_def.h>
+#include <fdtdec.h>
+#include <i2c.h>
 #include "mux-k2g.h"
 #include "../common/board_detect.h"
 
+#define K2G_GP_AUDIO_CODEC_ADDRESS     0x1B
+
 const unsigned int sysclk_array[MAX_SYSCLK] = {
        19200000,
        24000000,
@@ -210,6 +214,40 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#if defined(CONFIG_DTB_RESELECT)
+static int k2g_alt_board_detect(void)
+{
+       int rc;
+
+       rc = i2c_set_bus_num(1);
+       if (rc)
+               return rc;
+
+       rc = i2c_probe(K2G_GP_AUDIO_CODEC_ADDRESS);
+       if (rc)
+               return rc;
+
+       ti_i2c_eeprom_am_set("66AK2GGP", "1.0X");
+
+       return 0;
+}
+
+int embedded_dtb_select(void)
+{
+       int rc;
+
+       rc = k2g_alt_board_detect();
+       if (rc) {
+               printf("Unable to do board detection\n");
+               return -1;
+       }
+
+       fdtdec_setup();
+
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 
 static void k2g_reset_mux_config(void)