]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - board/atmel/sama5d3xek/sama5d3xek.c
ARM: at91: sama5d3xek: use a $dtb_name to load dtb
[karo-tx-uboot.git] / board / atmel / sama5d3xek / sama5d3xek.c
index 2bd436a2d837dedf6ac3302d68f5b5b929f84643..7c95f33590ed87596ca269b576171ba9bc48cb2c 100644 (file)
@@ -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)