[PATCH 1/2] ARM: imx: cm_fx6: export board and soc info to env

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] ARM: imx: cm_fx6: export board and soc info to env

christopher.spinrath
From: Christopher Spinrath <[hidden email]>

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 <[hidden email]>
---
 arch/arm/mach-imx/mx6/Kconfig  |  1 +
 board/compulab/cm_fx6/cm_fx6.c | 21 +++++++++++++++++++++
 include/configs/cm_fx6.h       |  1 +
 3 files changed, 23 insertions(+)

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 567a6a6bf5..057fca31ea 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -130,6 +130,7 @@ config TARGET_CM_FX6
  bool "CM-FX6"
  select SUPPORT_SPL
  select MX6QDL
+ select BOARD_LATE_INIT
  select DM
  select DM_SERIAL
  select DM_GPIO
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 620c3f2d0d..673de03071 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -621,6 +621,27 @@ int board_init(void)
  return 0;
 }
 
+int board_late_init(void)
+{
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+ char baseboard_name[16];
+ int err;
+
+ if (is_mx6dq())
+ env_set("board_rev", "MX6Q");
+ else if (is_mx6dl())
+ env_set("board_rev", "MX6DL");
+
+ err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);
+ if (err)
+ return 0;
+
+ if (!strncmp("SB-FX6m", baseboard_name, 7))
+ env_set("board_name", "Utilite");
+#endif
+ return 0;
+}
+
 int checkboard(void)
 {
  puts("Board: CM-FX6\n");
diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
index ec3e6e6ca5..cb71ea8811 100644
--- a/include/configs/cm_fx6.h
+++ b/include/configs/cm_fx6.h
@@ -67,6 +67,7 @@
 #define CONFIG_ENV_OFFSET (768 * 1024)
 
 #ifndef CONFIG_SPL_BUILD
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define CONFIG_EXTRA_ENV_SETTINGS \
  "fdt_high=0xffffffff\0" \
  "initrd_high=0xffffffff\0" \
--
2.15.1

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] ARM: imx: cm_fx6: export board and soc info to env

Fabio Estevam-2
Hi Christopher,

On Tue, Jan 9, 2018 at 7:01 PM,  <[hidden email]> wrote:

> From: Christopher Spinrath <[hidden email]>
>
> 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 <[hidden email]>

Patches look good.

Maybe you could combine both into a single one?
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] ARM: imx: cm_fx6: export board and soc info to env

Stefano Babic
On 09/01/2018 22:51, Fabio Estevam wrote:

> Hi Christopher,
>
> On Tue, Jan 9, 2018 at 7:01 PM,  <[hidden email]> wrote:
>> From: Christopher Spinrath <[hidden email]>
>>
>> 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 <[hidden email]>
>
> Patches look good.

Agree.

Reviewed-by: Stefano Babic <[hidden email]>

>
> Maybe you could combine both into a single one?
>

Both have a good explanation uin the commit message. I will merge them
as they are.

Best regards,
Stefano


--
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [hidden email]
=====================================================================
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] ARM: imx: cm_fx6: export board and soc info to env

Stefano Babic
In reply to this post by christopher.spinrath
On 09/01/2018 22:01, [hidden email] wrote:

> From: Christopher Spinrath <[hidden email]>
>
> 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 <[hidden email]>
> ---
>  arch/arm/mach-imx/mx6/Kconfig  |  1 +
>  board/compulab/cm_fx6/cm_fx6.c | 21 +++++++++++++++++++++
>  include/configs/cm_fx6.h       |  1 +
>  3 files changed, 23 insertions(+)
>
> diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
> index 567a6a6bf5..057fca31ea 100644
> --- a/arch/arm/mach-imx/mx6/Kconfig
> +++ b/arch/arm/mach-imx/mx6/Kconfig
> @@ -130,6 +130,7 @@ config TARGET_CM_FX6
>   bool "CM-FX6"
>   select SUPPORT_SPL
>   select MX6QDL
> + select BOARD_LATE_INIT
>   select DM
>   select DM_SERIAL
>   select DM_GPIO
> diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
> index 620c3f2d0d..673de03071 100644
> --- a/board/compulab/cm_fx6/cm_fx6.c
> +++ b/board/compulab/cm_fx6/cm_fx6.c
> @@ -621,6 +621,27 @@ int board_init(void)
>   return 0;
>  }
>  
> +int board_late_init(void)
> +{
> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> + char baseboard_name[16];
> + int err;
> +
> + if (is_mx6dq())
> + env_set("board_rev", "MX6Q");
> + else if (is_mx6dl())
> + env_set("board_rev", "MX6DL");
> +
> + err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);
> + if (err)
> + return 0;
> +
> + if (!strncmp("SB-FX6m", baseboard_name, 7))
> + env_set("board_name", "Utilite");
> +#endif
> + return 0;
> +}
> +
>  int checkboard(void)
>  {
>   puts("Board: CM-FX6\n");
> diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
> index ec3e6e6ca5..cb71ea8811 100644
> --- a/include/configs/cm_fx6.h
> +++ b/include/configs/cm_fx6.h
> @@ -67,6 +67,7 @@
>  #define CONFIG_ENV_OFFSET (768 * 1024)
>  
>  #ifndef CONFIG_SPL_BUILD
> +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
>  #define CONFIG_EXTRA_ENV_SETTINGS \
>   "fdt_high=0xffffffff\0" \
>   "initrd_high=0xffffffff\0" \
>

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [hidden email]
=====================================================================
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot