Commit dbeaa1d1317bf6494adb43417d2407672fc94ba6

Authored by Christopher Spinrath
Committed by Stefano Babic
1 parent f57263ee9b

ARM: imx: cm_fx6: export board and soc info to env

Like many other i.MX6 based boards, there are multiple variants of
the cm-fx6 module featuring different SoC variants. Furthermore, the
module can be paired with multiple baseboards.

At the same time modern distribution like Fedora require U-Boot to
select a proper devicetree which depends on the SoC variant and the
baseboard.

Thus, export the SoC variant and the actual board to the environment
following the conventions of other i.MX6 devices (e.g. the NXP boards)
such that the environment can select a devicetree file to load.

For now, we only know for sure that the cm-fx6 module and the SB-fx6m
baseboard amount to a Utilite Computer variant (depending on the SoC).
Further combinations may be added in the future; e.g. CompuLab's
evaluation board once someone can verify the identification string
stored in its eeprom.

Signed-off-by: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>

Showing 3 changed files with 23 additions and 0 deletions Side-by-side Diff

arch/arm/mach-imx/mx6/Kconfig
... ... @@ -130,6 +130,7 @@
130 130 bool "CM-FX6"
131 131 select SUPPORT_SPL
132 132 select MX6QDL
  133 + select BOARD_LATE_INIT
133 134 select DM
134 135 select DM_SERIAL
135 136 select DM_GPIO
board/compulab/cm_fx6/cm_fx6.c
... ... @@ -621,6 +621,27 @@
621 621 return 0;
622 622 }
623 623  
  624 +int board_late_init(void)
  625 +{
  626 +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
  627 + char baseboard_name[16];
  628 + int err;
  629 +
  630 + if (is_mx6dq())
  631 + env_set("board_rev", "MX6Q");
  632 + else if (is_mx6dl())
  633 + env_set("board_rev", "MX6DL");
  634 +
  635 + err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);
  636 + if (err)
  637 + return 0;
  638 +
  639 + if (!strncmp("SB-FX6m", baseboard_name, 7))
  640 + env_set("board_name", "Utilite");
  641 +#endif
  642 + return 0;
  643 +}
  644 +
624 645 int checkboard(void)
625 646 {
626 647 puts("Board: CM-FX6\n");
include/configs/cm_fx6.h
... ... @@ -67,6 +67,7 @@
67 67 #define CONFIG_ENV_OFFSET (768 * 1024)
68 68  
69 69 #ifndef CONFIG_SPL_BUILD
  70 +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
70 71 #define CONFIG_EXTRA_ENV_SETTINGS \
71 72 "fdt_high=0xffffffff\0" \
72 73 "initrd_high=0xffffffff\0" \