Browse Source

board: at91sam9x5: add environment var for cpu type

When booting and CPU is detected from cpuid, we also need an environment
variable that will be used in boot commands to load the proper devicetree.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Eugen Hristev 3 years ago
parent
commit
61b4dbb0d0
2 changed files with 11 additions and 0 deletions
  1. 4 0
      board/atmel/at91sam9x5ek/at91sam9x5ek.c
  2. 7 0
      board/atmel/common/board.c

+ 4 - 0
board/atmel/at91sam9x5ek/at91sam9x5ek.c

@@ -20,6 +20,9 @@ DECLARE_GLOBAL_DATA_PTR;
20 20
 /*
21 21
  * Miscelaneous platform dependent initialisations
22 22
  */
23
+
24
+void at91_prepare_cpu_var(void);
25
+
23 26
 #ifdef CONFIG_CMD_NAND
24 27
 static void at91sam9x5ek_nand_hw_init(void)
25 28
 {
@@ -85,6 +88,7 @@ int board_late_init(void)
85 88
 #ifdef CONFIG_DM_VIDEO
86 89
 	at91_video_show_board_info();
87 90
 #endif
91
+	at91_prepare_cpu_var();
88 92
 	return 0;
89 93
 }
90 94
 #endif

+ 7 - 0
board/atmel/common/board.c

@@ -13,6 +13,8 @@
13 13
 #define AT91_PDA_EEPROM_ID_LENGTH		5
14 14
 #define AT91_PDA_EEPROM_DEFAULT_BUS		0
15 15
 
16
+char *get_cpu_name(void);
17
+
16 18
 void dummy(void)
17 19
 {
18 20
 }
@@ -66,3 +68,8 @@ void at91_pda_detect(void)
66 68
 {
67 69
 }
68 70
 #endif
71
+
72
+void at91_prepare_cpu_var(void)
73
+{
74
+	env_set("cpu", get_cpu_name());
75
+}