summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--board/atmel/sama5d3xek/sama5d3xek.c20
-rw-r--r--include/configs/at91-sama5_common.h5
-rw-r--r--include/configs/sama5d3xek.h3
3 files changed, 27 insertions, 1 deletions
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c
index 2bd436a2d8..7c95f33590 100644
--- a/board/atmel/sama5d3xek/sama5d3xek.c
+++ b/board/atmel/sama5d3xek/sama5d3xek.c
@@ -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,25 @@ 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 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) && (i < MAX_STR_LEN); p++, i++)
+ *p = tolower(*p);
+
+ strcat(name, "ek.dtb");
+ setenv("dtb_name", name);
+#endif
+ return 0;
+}
+#endif
+
/* SPL */
#ifdef CONFIG_SPL_BUILD
void spl_board_init(void)
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h
index bb737a1fe8..0fe0852821 100644
--- a/include/configs/at91-sama5_common.h
+++ b/include/configs/at91-sama5_common.h
@@ -61,7 +61,10 @@
#define FAT_ENV_FILE "uboot.env"
#define CONFIG_ENV_SIZE 0x4000
-#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 at91-${board_name}.dtb; " \
+#define CONFIG_BOOTCOMMAND "if test ! -n ${dtb_name}; then " \
+ "setenv dtb_name at91-${board_name}.dtb; " \
+ "fi; " \
+ "fatload mmc 0:1 0x21000000 ${dtb_name}; " \
"fatload mmc 0:1 0x22000000 zImage; " \
"bootz 0x22000000 - 0x21000000"
#define CONFIG_BOOTARGS \
diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h
index 5c7b722da3..7b2f69a27b 100644
--- a/include/configs/sama5d3xek.h
+++ b/include/configs/sama5d3xek.h
@@ -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
OpenPOWER on IntegriCloud