From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 6/6] mx6cuboxi: Load the correct 'fdtfile' variable
Date: Mon, 27 Apr 2015 09:51:08 +0200 [thread overview]
Message-ID: <553DEA6C.1050506@denx.de> (raw)
In-Reply-To: <1429998441-12359-6-git-send-email-festevam@gmail.com>
Hi Fabio,
On 25/04/2015 23:47, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Instead of hardcoding the 'fdtfile' variable, let's detect the SoC and
> board variant on the fly and change the dtb name.
>
> Based on the scheme done on am335x board.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Changes since v4:
> - None
>
> board/solidrun/mx6cuboxi/mx6cuboxi.c | 25 +++++++++++++++++++++++++
> include/configs/mx6cuboxi.h | 19 ++++++++++++++++---
> 2 files changed, 41 insertions(+), 3 deletions(-)
>
> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> index 83410b2..e06186e 100644
> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> @@ -212,6 +212,31 @@ int checkboard(void)
> return 0;
> }
>
> +static bool is_mx6q(void)
> +{
> + if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
> + return true;
> + else
> + return false;
> +}
> +
> +int board_late_init(void)
> +{
> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> + if (is_hummingboard())
> + setenv("board_name", "HUMMINGBOARD");
> + else
> + setenv("board_name", "CUBOXI");
> +
> + if (is_mx6q)
This should be is_mx6q() and not is_mx6q
> + setenv("board_rev", "MX6Q");
> + else
> + setenv("board_rev", "MX6DL");
> +#endif
> +
> + return 0;
> +}
> +
> #ifdef CONFIG_SPL_BUILD
> #include <asm/arch/mx6-ddr.h>
> static const struct mx6dq_iomux_ddr_regs mx6q_ddr_ioregs = {
> diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
> index 98b48d5..b569f34 100644
> --- a/include/configs/mx6cuboxi.h
> +++ b/include/configs/mx6cuboxi.h
> @@ -29,6 +29,7 @@
>
> #define CONFIG_SYS_MALLOC_LEN (2 * SZ_1M)
> #define CONFIG_BOARD_EARLY_INIT_F
> +#define CONFIG_BOARD_LATE_INIT
> #define CONFIG_MXC_GPIO
> #define CONFIG_MXC_UART
> #define CONFIG_CMD_FUSE
> @@ -81,14 +82,14 @@
> #define CONFIG_MXC_UART_BASE UART1_BASE
> #define CONFIG_CONSOLE_DEV "ttymxc0"
> #define CONFIG_MMCROOT "/dev/mmcblk0p2"
> -#define CONFIG_DEFAULT_FDT_FILE "imx6q-hummingboard.dtb"
> #define CONFIG_SYS_FSL_USDHC_NUM 1
> #define CONFIG_SYS_MMC_ENV_DEV 0 /* SDHC2 */
>
> +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> #define CONFIG_EXTRA_ENV_SETTINGS \
> "script=boot.scr\0" \
> "image=zImage\0" \
> - "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
> + "fdtfile=undefined\0" \
> "fdt_addr_r=0x18000000\0" \
> "boot_fdt=try\0" \
> "ip_dyn=yes\0" \
> @@ -156,9 +157,21 @@
> "fi; " \
> "else " \
> "bootz; " \
> - "fi;\0"
> + "fi;\0" \
> + "findfdt="\
> + "if test $board_name = HUMMINGBOARD && test $board_rev = MX6Q ; then " \
> + "setenv fdtfile imx6q-hummingboard.dtb; fi; " \
> + "if test $board_name = HUMMINGBOARD && test $board_rev = MX6DL ; then " \
> + "setenv fdtfile imx6dl-hummingboard.dtb; fi; " \
> + "if test $board_name = CUBOXI && test $board_rev = MX6Q ; then " \
> + "setenv fdtfile imx6q-cubox-i.dtb; fi; " \
> + "if test $board_name = CUBOXI && test $board_rev = MX6DL ; then " \
For the history: checkpatch compliants about the length here, but I find
it *much* more readable on one line as splitted into more lines. I will
ignore these warnings.
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: sbabic at denx.de
=====================================================================
next prev parent reply other threads:[~2015-04-27 7:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-25 21:47 [U-Boot] [PATCH v5 1/6] mx6cuboxi: Fix the defconfig name Fabio Estevam
2015-04-25 21:47 ` [U-Boot] [PATCH v5 2/6] mx6cuboxi: Prepare for multi SoC support Fabio Estevam
2015-04-26 0:32 ` Tom Rini
2015-04-27 11:08 ` Stefano Babic
2015-04-25 21:47 ` [U-Boot] [PATCH v5 3/6] mx6cuboxi: Introduce multi-SoC support Fabio Estevam
2015-04-26 0:32 ` Tom Rini
2015-04-27 11:09 ` Stefano Babic
2015-04-25 21:47 ` [U-Boot] [PATCH v5 4/6] mx6cuboxi: Differentiate Cubox-i and Hummingboard Fabio Estevam
2015-04-26 0:32 ` Tom Rini
2015-04-27 11:09 ` Stefano Babic
2015-04-25 21:47 ` [U-Boot] [PATCH v5 5/6] mx6cuboxi: Use more standard namings for fdt variables Fabio Estevam
2015-04-26 0:31 ` Tom Rini
2015-04-27 11:09 ` Stefano Babic
2015-04-25 21:47 ` [U-Boot] [PATCH v5 6/6] mx6cuboxi: Load the correct 'fdtfile' variable Fabio Estevam
2015-04-25 23:26 ` Vagrant Cascadian
2015-04-26 0:30 ` Tom Rini
2015-04-27 7:51 ` Stefano Babic [this message]
2015-04-27 10:11 ` Fabio Estevam
2015-04-27 10:56 ` Stefano Babic
2015-04-27 11:10 ` Stefano Babic
2015-04-26 0:31 ` [U-Boot] [PATCH v5 1/6] mx6cuboxi: Fix the defconfig name Tom Rini
2015-04-27 11:08 ` 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=553DEA6C.1050506@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox