All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V5 5/6] imx: mx6sabresd/sabreauto runtime setting fdt_file
Date: Sun, 02 Aug 2015 10:47:23 +0200	[thread overview]
Message-ID: <55BDD91B.0@denx.de> (raw)
In-Reply-To: <1436585927-18677-5-git-send-email-Peng.Fan@freescale.com>

On 11/07/2015 05:38, Peng Fan wrote:
> Detect the SOC and board variant at runtime and change the dtb name,
> but not hardcoding the fdt_file env variable.
> 
> Take the following patch as a reference.
> ?d58699b157df75f1aa0b363ea9c21add21a0c
> "mx6cuboxi: Load the correct 'fdtfile' variable"
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
> Acked-by: Stefano Babic <sbabic@denx.de>
> ---
> 
> Changes v5:
>  Add Stefano's Acked-by
> Changes v4:
>  Add Fabio's Reviewed-by
> Changes v3:
>  New patch
> Changes v2:
>  none
> 
>  board/freescale/mx6qsabreauto/mx6qsabreauto.c |  9 +++++++++
>  board/freescale/mx6sabresd/mx6sabresd.c       | 10 ++++++++++
>  include/configs/mx6qsabreauto.h               |  5 -----
>  include/configs/mx6sabre_common.h             | 21 +++++++++++++++++++--
>  include/configs/mx6sabresd.h                  |  5 -----
>  5 files changed, 38 insertions(+), 12 deletions(-)
> 
> diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
> index b76e4eb..943a4bd 100644
> --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c
> +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
> @@ -522,6 +522,15 @@ int board_late_init(void)
>  	add_board_boot_modes(board_boot_modes);
>  #endif
>  
> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> +	setenv("board_name", "SABREAUTO");
> +
> +	if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
> +		setenv("board_rev", "MX6Q");
> +	else if (is_cpu_type(MXC_CPU_MX6DL) || is_cpu_type(MXC_CPU_MX6SOLO))
> +		setenv("board_rev", "MX6DL");
> +#endif
> +
>  	return 0;
>  }
>  
> diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
> index 23f8f6b..4f0694a 100644
> --- a/board/freescale/mx6sabresd/mx6sabresd.c
> +++ b/board/freescale/mx6sabresd/mx6sabresd.c
> @@ -679,6 +679,16 @@ int board_late_init(void)
>  #ifdef CONFIG_CMD_BMODE
>  	add_board_boot_modes(board_boot_modes);
>  #endif
> +
> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> +	setenv("board_name", "SABRESD");
> +
> +	if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
> +		setenv("board_rev", "MX6Q");
> +	else if (is_cpu_type(MXC_CPU_MX6DL) || is_cpu_type(MXC_CPU_MX6SOLO))
> +		setenv("board_rev", "MX6DL");
> +#endif
> +
>  	return 0;
>  }
>  
> diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h
> index 2260344..11cf538 100644
> --- a/include/configs/mx6qsabreauto.h
> +++ b/include/configs/mx6qsabreauto.h
> @@ -12,11 +12,6 @@
>  #define CONFIG_MACH_TYPE	3529
>  #define CONFIG_MXC_UART_BASE	UART4_BASE
>  #define CONFIG_CONSOLE_DEV		"ttymxc3"
> -#if defined CONFIG_MX6Q
> -#define CONFIG_DEFAULT_FDT_FILE	"imx6q-sabreauto.dtb"
> -#elif defined CONFIG_MX6DL
> -#define CONFIG_DEFAULT_FDT_FILE	"imx6dl-sabreauto.dtb"
> -#endif
>  #define CONFIG_MMCROOT			"/dev/mmcblk0p2"
>  #define PHYS_SDRAM_SIZE		(2u * 1024 * 1024 * 1024)
>  
> diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h
> index e42dfc9..903ab18 100644
> --- a/include/configs/mx6sabre_common.h
> +++ b/include/configs/mx6sabre_common.h
> @@ -70,10 +70,12 @@
>  #define EMMC_ENV ""
>  #endif
>  
> +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> +
>  #define CONFIG_EXTRA_ENV_SETTINGS \
>  	"script=boot.scr\0" \
>  	"image=zImage\0" \
> -	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
> +	"fdt_file=undefined\0" \
>  	"fdt_addr=0x18000000\0" \
>  	"boot_fdt=try\0" \
>  	"ip_dyn=yes\0" \
> @@ -143,9 +145,24 @@
>  			"fi; " \
>  		"else " \
>  			"bootz; " \
> -		"fi;\0"
> +		"fi;\0" \
> +		"findfdt="\
> +			"if test $fdt_file = undefined; then " \
> +				"if test $board_name = SABREAUTO && test $board_rev = MX6Q; then " \
> +					"setenv fdt_file imx6q-sabreauto.dtb; fi; " \
> +				"if test $board_name = SABREAUTO && test $board_rev = MX6DL; then " \
> +					"setenv fdt_file imx6dl-sabreauto.dtb; fi; " \
> +				"if test $board_name = SABRESD && test $board_rev = MX6Q; then " \
> +					"setenv fdt_file imx6q-sabresd.dtb; fi; " \
> +				"if test $board_name = SABRESD && test $board_rev = MX6DL; then " \
> +					"setenv fdt_file imx6dl-sabresd.dtb; fi; " \
> +				"if test $fdt_file = undefined; then " \
> +					"echo WARNING: Could not determine dtb to use; fi; " \
> +			"fi;\0" \
> +
>  
>  #define CONFIG_BOOTCOMMAND \
> +	"run findfdt;" \
>  	"mmc dev ${mmcdev};" \
>  	"if mmc rescan; then " \
>  		"if run loadbootscript; then " \
> diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h
> index 41162ca..5f635ca 100644
> --- a/include/configs/mx6sabresd.h
> +++ b/include/configs/mx6sabresd.h
> @@ -19,11 +19,6 @@
>  #define CONFIG_MXC_UART_BASE	UART1_BASE
>  #define CONFIG_CONSOLE_DEV		"ttymxc0"
>  #define CONFIG_MMCROOT			"/dev/mmcblk1p2"
> -#if defined(CONFIG_MX6Q)
> -#define CONFIG_DEFAULT_FDT_FILE	"imx6q-sabresd.dtb"
> -#elif defined(CONFIG_MX6DL)
> -#define CONFIG_DEFAULT_FDT_FILE	"imx6dl-sabresd.dtb"
> -#endif
>  #define PHYS_SDRAM_SIZE		(1u * 1024 * 1024 * 1024)
>  
>  #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
> 

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: sbabic at denx.de
=====================================================================

  reply	other threads:[~2015-08-02  8:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-11  3:38 [U-Boot] [PATCH V5 1/6] imx: add cpu type for i.MX6QP/DP Peng Fan
2015-07-11  3:38 ` [U-Boot] [PATCH V5 2/6] imx: mx6: ccm: Change the clock settings for i.MX6QP Peng Fan
2015-08-02  8:44   ` Stefano Babic
2015-07-11  3:38 ` [U-Boot] [PATCH V5 3/6] imx: mx6: hab : Remove the cache issue workaroud in hab " Peng Fan
2015-08-02  8:46   ` Stefano Babic
2015-07-11  3:38 ` [U-Boot] [PATCH V5 4/6] imx: mx6qp Enable PRG clock for IPU Peng Fan
2015-08-02  8:46   ` Stefano Babic
2015-07-11  3:38 ` [U-Boot] [PATCH V5 5/6] imx: mx6sabresd/sabreauto runtime setting fdt_file Peng Fan
2015-08-02  8:47   ` Stefano Babic [this message]
2015-07-11  3:38 ` [U-Boot] [PATCH V5 6/6] imx: mx6qpsabreauto: Add MX6QP SABREAUTO CPU3 board support Peng Fan
2015-08-02  8:47   ` Stefano Babic
2015-08-02  8:44 ` [U-Boot] [PATCH V5 1/6] imx: add cpu type for i.MX6QP/DP Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55BDD91B.0@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.