ARM: at91: sama5d3xek: initialized a variable:ek_name in U-Boot
PATCH 1/1 ARM: at91: sama5d3xek: initialized a variable:ek_name in U-Boot
Then we can use this ek_name variable to load corresponding dtb file in mmc boot.
Also we change the mmc boot command to load zImage as this format is prefered.
---
board/atmel/sama5d3xek/sama5d3xek.c | 21 +++++++++++++++++++++ include/configs/sama5d3xek.h | 7 +++++-- 2 files changed, 26 insertions(+), 2 deletions(-)
board/atmel/sama5d3xek/sama5d3xek.c +21 -0
@@ -15,6 +15,7 @@#include <asm/arch/gpio.h> #include <asm/arch/clk.h> #include <lcd.h> +#include <linux/ctype.h> #include <atmel_hlcdc.h> #include <atmel_mci.h> #include <phy.h>
@@ -369,6 +370,26 @@ void spi_cs_deactivate(struct spi_slave *slave) }#endif /* CONFIG_ATMEL_SPI */ +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init (void ) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +const char *BOARD_EK_NAME ="ek_name" ; +const int MAX_STR_LEN =32 ; +char name[MAX_STR_LEN ], *p; +int i; + +strncpy (name,get_cpu_name (),MAX_STR_LEN ); +for (i =0 , p = name; *p !='\0' || i <MAX_STR_LEN ; i++, p++) + *p =tolower (*p); + +strcat (name,"ek" ); +setenv (BOARD_EK_NAME , name); +#endif +return 0 ; +} +#endif +/* SPL */ #ifdef CONFIG_SPL_BUILD void spl_board_init (void )
include/configs/sama5d3xek.h +5 -2
@@ -19,6 +19,9 @@*/ #include "at91-sama5_common.h" +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +/* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_DBGU
@@ -179,8 +182,8 @@#define FAT_ENV_FILE "uboot.env"#define FAT_ENV_DEVICE_AND_PART "0"#define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 dtb; " \ - "fatload mmc 0:1 0x22000000 uImage; " \ +#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 ${ek_name}.dtb; " \ + "fatload mmc 0:1 0x22000000 zImage; " \ "bootm 0x22000000 - 0x21000000"#else #define CONFIG_ENV_IS_NOWHERE
Signature · 1 line
1.9.1
PATCH 1/1 ARM: at91: sama5d3xek: initialized a variable:ek_name in U-Boot
Hi, Andreas
Any feedback for this patch? Thanks.
Best Regards,
Josh Wu
Quoted 77 lines · Josh Wu
Then we can use this
ek_namevariable to load corresponding dtb file in mmc boot.Also we change the mmc boot command to load zImage as this format is prefered.
Signed-off-by Josh Wu <[email protected]>---
board/atmel/sama5d3xek/sama5d3xek.c | 21 +++++++++++++++++++++ include/configs/sama5d3xek.h | 7 +++++-- 2 files changed, 26 insertions(+), 2 deletions(-)board/atmel/sama5d3xek/sama5d3xek.c +21
-0@@ -15,6 +15,7 @@#include <asm/arch/gpio.h> #include <asm/arch/clk.h> #include <lcd.h> +#include <linux/ctype.h> #include <atmel_hlcdc.h> #include <atmel_mci.h> #include <phy.h> @@ -369,6 +370,26 @@ void spi_cs_deactivate(struct spi_slave *slave) }#endif /* CONFIG_ATMEL_SPI */ +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init (void ) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +const char *BOARD_EK_NAME ="ek_name" ; +const int MAX_STR_LEN =32 ; +char name[MAX_STR_LEN ], *p; +int i; + +strncpy (name,get_cpu_name (),MAX_STR_LEN ); +for (i =0 , p = name; *p !='\0' || i <MAX_STR_LEN ; i++, p++) + *p =tolower (*p); + +strcat (name,"ek" ); +setenv (BOARD_EK_NAME , name); +#endif +return 0 ; +} +#endif +/* SPL */ #ifdef CONFIG_SPL_BUILD void spl_board_init (void )include/configs/sama5d3xek.h +5
-2@@ -19,6 +19,9 @@*/ #include "at91-sama5_common.h" +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +/* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_DBGU@@ -179,8 +182,8 @@#define FAT_ENV_FILE "uboot.env"#define FAT_ENV_DEVICE_AND_PART "0"#define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 dtb; " \ - "fatload mmc 0:1 0x22000000 uImage; " \ +#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 ${ek_name}.dtb; " \ + "fatload mmc 0:1 0x22000000 zImage; " \ "bootm 0x22000000 - 0x21000000"#else #define CONFIG_ENV_IS_NOWHERE
PATCH 1/1 ARM: at91: sama5d3xek: initialized a variable:ek_name in U-Boot
In reply to Josh WuHi Josh,
sorry for the late reply!
Quoted 2 lines · Josh Wu
Then we can use this
ek_namevariable to load corresponding dtb file in mmc boot.
I appreciate this change. I wonder however why not use the CONFIG_ENV_VARS_UBOOT_CONFIG + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG and the corresponding env vars.
In include/env_default.h we define 'board_name' to the name of the board. This could then easily be used to switch the required DTB.
I think the CONFIG_ENV_VARS_UBOOT_CONFIG should only be used for boards where the name is fixed (like some older EK's). Here the runtime config is right, but let's use the $board_name, Ok?
Andreas
Quoted 76 lines
Also we change the mmc boot command to load zImage as this format is prefered.
Signed-off-by Josh Wu <[email protected]>---
board/atmel/sama5d3xek/sama5d3xek.c | 21 +++++++++++++++++++++ include/configs/sama5d3xek.h | 7 +++++-- 2 files changed, 26 insertions(+), 2 deletions(-)board/atmel/sama5d3xek/sama5d3xek.c +21
-0@@ -15,6 +15,7 @@#include <asm/arch/gpio.h> #include <asm/arch/clk.h> #include <lcd.h> +#include <linux/ctype.h> #include <atmel_hlcdc.h> #include <atmel_mci.h> #include <phy.h> @@ -369,6 +370,26 @@ void spi_cs_deactivate(struct spi_slave *slave) }#endif /* CONFIG_ATMEL_SPI */ +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init (void ) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +const char *BOARD_EK_NAME ="ek_name" ; +const int MAX_STR_LEN =32 ; +char name[MAX_STR_LEN ], *p; +int i; + +strncpy (name,get_cpu_name (),MAX_STR_LEN ); +for (i =0 , p = name; *p !='\0' || i <MAX_STR_LEN ; i++, p++) + *p =tolower (*p); + +strcat (name,"ek" ); +setenv (BOARD_EK_NAME , name); +#endif +return 0 ; +} +#endif +/* SPL */ #ifdef CONFIG_SPL_BUILD void spl_board_init (void )include/configs/sama5d3xek.h +5
-2@@ -19,6 +19,9 @@*/ #include "at91-sama5_common.h" +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +/* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_DBGU@@ -179,8 +182,8 @@#define FAT_ENV_FILE "uboot.env"#define FAT_ENV_DEVICE_AND_PART "0"#define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 dtb; " \ - "fatload mmc 0:1 0x22000000 uImage; " \ +#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 ${ek_name}.dtb; " \ + "fatload mmc 0:1 0x22000000 zImage; " \ "bootm 0x22000000 - 0x21000000"#else #define CONFIG_ENV_IS_NOWHERE