board: ge: bx50v3: remove confidx magic numbers
authorSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 14 Dec 2020 23:41:56 +0000 (00:41 +0100)
committerStefano Babic <sbabic@denx.de>
Sat, 26 Dec 2020 13:56:09 +0000 (14:56 +0100)
Instead of hardcoding index magic numbers in the board code,
also rely on board_fit_config_name_match choosing the right
config for the fitImage containing the kernel.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
board/ge/bx50v3/bx50v3.c
include/configs/ge_bx50v3.h

index 4754647..a3ae037 100644 (file)
@@ -356,15 +356,12 @@ static void process_vpd(struct vpd_cache *vpd)
 
        switch (vpd->product_id) {
        case VPD_PRODUCT_B450:
-               env_set("confidx", "1");
                i210_index = 1;
                break;
        case VPD_PRODUCT_B650:
-               env_set("confidx", "2");
                i210_index = 1;
                break;
        case VPD_PRODUCT_B850:
-               env_set("confidx", "3");
                i210_index = 2;
                break;
        }
@@ -554,16 +551,23 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 
 int board_fit_config_name_match(const char *name)
 {
+       const char *machine = name;
+
        if (!vpd.is_read)
                return strcmp(name, "imx6q-bx50v3");
 
+       if (!strncmp(machine, "Boot ", 5))
+               machine += 5;
+       if (!strncmp(machine, "imx6q-", 6))
+               machine += 6;
+
        switch (vpd.product_id) {
        case VPD_PRODUCT_B450:
-               return strcmp(name, "imx6q-b450v3");
+               return strcasecmp(machine, "b450v3");
        case VPD_PRODUCT_B650:
-               return strcmp(name, "imx6q-b650v3");
+               return strcasecmp(machine, "b650v3");
        case VPD_PRODUCT_B850:
-               return strcmp(name, "imx6q-b850v3");
+               return strcasecmp(machine, "b850v3");
        default:
                return -1;
        }
index e5c580b..2d854af 100644 (file)
@@ -62,7 +62,7 @@
         "networkboot=" \
                 "run setnetworkboot; " \
                 "nfs ${loadaddr} /srv/nfs/fitImage; " \
-                "bootm ${loadaddr}#conf@${confidx}\0" \
+                "bootm ${loadaddr}\0" \
 
 #define CONFIG_NETWORKBOOTCOMMAND \
        "run networkboot; " \
        "doboot=" \
                "echo Booting from ${dev}:${devnum}:${partnum} ...; " \
                "run setargs; " \
-               "bootm ${loadaddr}#conf@${confidx}\0" \
+               "bootm ${loadaddr}\0" \
        "tryboot=" \
                "setenv partnum 1; run hasfirstboot || setenv partnum 2; " \
                "run loadimage || run swappartitions && run loadimage || " \