Skip to contentSkip to conversation

at91sam9260ek: move board id setup to config header

PATCH New Andreas Bießmann 2 participants 5 messages Mar 10, 2013 – May 10, 2013 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 at91sam9260ek: move board id setup to config header

---
 board/atmel/at91sam9260ek/at91sam9260ek.c |   12 ------------
 include/configs/at91sam9260ek.h           |   20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 12 deletions(-)
board/atmel/at91sam9260ek/at91sam9260ek.c +0 -12
index 3aa394a..049b3d7 100644
@@ -157,18 +157,6 @@ int board_early_init_f(void)
 
 int board_init(void)
 {
-#ifdef CONFIG_AT91SAM9G20EK_2MMC
-	/* arch number of AT91SAM9G20EK_2MMC-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK_2MMC;
-#else
-#ifdef CONFIG_AT91SAM9G20EK
-	/* arch number of AT91SAM9G20EK-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK;
-#else
-	/* arch number of AT91SAM9260EK-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9260EK;
-#endif
-#endif
 	/* adress of boot parameters */
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
include/configs/at91sam9260ek.h +20 -0
index 02696b3..2d2efb2 100644
@@ -125,6 +125,26 @@
 	(ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
 #endif
 
+/*
+ * The (arm)linux board id set by generic code depending on configured board
+ * (see boards.cfg for different boards)
+ */
+#ifdef CONFIG_AT91SAM9G20
+	/* the sam9g20 variants have two different board ids */
+# ifdef CONFIG_AT91SAM9G20EK_2MMC
+	/* we may be setup for the 2MMC variant of at91sam9g20ek */
+#  define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK_2MMC
+# else
+#  ifdef CONFIG_AT91SAM9G20EK
+	/* or the normal at91sam9g20ek */
+#   define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK
+#  endif
+# endif
+#else
+	/* otherwise default to good old at91sam9260ek */
+# define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9260EK
+#endif
+
 /* DataFlash */
 #ifndef CONFIG_AT91SAM9G20EK_2MMC
 #define CONFIG_ATMEL_DATAFLASH_SPI
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 at91sam9260ek: move board id setup to config header

Quoted 2 lines · Andreas Bie?mann
Quoted 60 lines
---
  board/atmel/at91sam9260ek/at91sam9260ek.c |   12 ------------
  include/configs/at91sam9260ek.h           |   20 ++++++++++++++++++++
  2 files changed, 20 insertions(+), 12 deletions(-)
board/atmel/at91sam9260ek/at91sam9260ek.c +0 -12
index 3aa394a..049b3d7 100644
@@ -157,18 +157,6 @@ int board_early_init_f(void)
 
  int board_init(void)
  {
-#ifdef CONFIG_AT91SAM9G20EK_2MMC
-	/* arch number of AT91SAM9G20EK_2MMC-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK_2MMC;
-#else
-#ifdef CONFIG_AT91SAM9G20EK
-	/* arch number of AT91SAM9G20EK-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK;
-#else
-	/* arch number of AT91SAM9260EK-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9260EK;
-#endif
-#endif
  	/* adress of boot parameters */
  	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
include/configs/at91sam9260ek.h +20 -0
index 02696b3..2d2efb2 100644
@@ -125,6 +125,26 @@
  	(ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
  #endif
 
+/*
+ * The (arm)linux board id set by generic code depending on configured board
+ * (see boards.cfg for different boards)
+ */
+#ifdef CONFIG_AT91SAM9G20
+	/* the sam9g20 variants have two different board ids */
+# ifdef CONFIG_AT91SAM9G20EK_2MMC
+	/* we may be setup for the 2MMC variant of at91sam9g20ek */
+#  define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK_2MMC
+# else
+#  ifdef CONFIG_AT91SAM9G20EK
+	/* or the normal at91sam9g20ek */
+#   define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK
+#  endif
+# endif
+#else
+	/* otherwise default to good old at91sam9260ek */
+# define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9260EK
+#endif
+
  /* DataFlash */
  #ifndef CONFIG_AT91SAM9G20EK_2MMC
  #define CONFIG_ATMEL_DATAFLASH_SPI
#2 lore raw

PATCH 1/1 at91sam9260ek: move board id setup to config header

Hi Bo,

Quoted 11 lines · Bo Shen
Quoted 2 lines · Andreas Bie?mann
Quoted 5 lines
---
  board/atmel/at91sam9260ek/at91sam9260ek.c |   12 ------------
  include/configs/at91sam9260ek.h           |   20 ++++++++++++++++++++
  2 files changed, 20 insertions(+), 12 deletions(-)

<snip>

Quoted 6 lines
Quoted 6 lines
include/configs/at91sam9260ek.h +0 -0
@@ -125,6 +125,26 @@
      (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
  #endif
 
Quoted 16 lines
Quoted 6 lines
include/configs/at91sam9260ek.h +2 -0
+/*
+ * The (arm)linux board id set by generic code depending on

configured board
+ * (see boards.cfg for different boards)
+ */

include/configs/at91sam9260ek.h +1 -0
+#ifdef CONFIG_AT91SAM9G20

include/configs/at91sam9260ek.h line 142

Quoted 10 lines
include/configs/at91sam9260ek.h +10 -0
+    /* the sam9g20 variants have two different board ids */
+# ifdef CONFIG_AT91SAM9G20EK_2MMC
+    /* we may be setup for the 2MMC variant of at91sam9g20ek */
+#  define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK_2MMC
+# else
+#  ifdef CONFIG_AT91SAM9G20EK
+    /* or the normal at91sam9g20ek */
+#   define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK
+#  endif
+# endif

I think I'll generate a v2 here. It is safer to have:

#ifdef AT91SAM9G20
#ifdef 2MMC
// 2MMC
#else
// default for SAM9G20
#endif
#else
// default for SAM9260
#endif

Best regards

Andreas Bie?mann

#3 lore raw

PATCH 1/1 at91sam9260ek: move board id setup to config header

Hi Andreas,

Quoted 42 lines · Andreas Bie?mann

Hi Bo,

Quoted 11 lines · Bo Shen
Quoted 2 lines · Andreas Bie?mann
Quoted 5 lines
---
   board/atmel/at91sam9260ek/at91sam9260ek.c |   12 ------------
   include/configs/at91sam9260ek.h           |   20 ++++++++++++++++++++
   2 files changed, 20 insertions(+), 12 deletions(-)

<snip>

Quoted 6 lines
Quoted 6 lines
include/configs/at91sam9260ek.h +0 -0
@@ -125,6 +125,26 @@
       (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
   #endif
 
Quoted 16 lines
Quoted 6 lines
include/configs/at91sam9260ek.h +2 -0
+/*
+ * The (arm)linux board id set by generic code depending on

configured board
+ * (see boards.cfg for different boards)
+ */

include/configs/at91sam9260ek.h +1 -0
+#ifdef CONFIG_AT91SAM9G20

include/configs/at91sam9260ek.h line 142

Quoted 10 lines
include/configs/at91sam9260ek.h +10 -0
+    /* the sam9g20 variants have two different board ids */
+# ifdef CONFIG_AT91SAM9G20EK_2MMC
+    /* we may be setup for the 2MMC variant of at91sam9g20ek */
+#  define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK_2MMC
+# else
+#  ifdef CONFIG_AT91SAM9G20EK
+    /* or the normal at91sam9g20ek */
+#   define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK
+#  endif
+# endif

I think I'll generate a v2 here. It is safer to have:

Quoted 9 lines

#ifdef AT91SAM9G20
#ifdef 2MMC
// 2MMC
#else
// default for SAM9G20
#endif
#else
// default for SAM9260
#endif

I agree.

Quoted 4 lines

Best regards

Andreas Bie?mann

Best Regards,
Bo Shen

#4 lore raw

PATCH v2 1/1 at91sam9260ek: move board id setup to config header

In reply to Andreas Bießmann

---
Changes in v2:
* use only one ifdef for sam9G variants

 board/atmel/at91sam9260ek/at91sam9260ek.c |   12 ------------
 include/configs/at91sam9260ek.h           |   18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 12 deletions(-)
board/atmel/at91sam9260ek/at91sam9260ek.c +0 -12
index 3aa394a..049b3d7 100644
@@ -157,18 +157,6 @@ int board_early_init_f(void)
 
 int board_init(void)
 {
-#ifdef CONFIG_AT91SAM9G20EK_2MMC
-	/* arch number of AT91SAM9G20EK_2MMC-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK_2MMC;
-#else
-#ifdef CONFIG_AT91SAM9G20EK
-	/* arch number of AT91SAM9G20EK-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK;
-#else
-	/* arch number of AT91SAM9260EK-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9260EK;
-#endif
-#endif
 	/* adress of boot parameters */
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
include/configs/at91sam9260ek.h +18 -0
index ebcc69a..39a8fc2 100644
@@ -128,6 +128,24 @@
 	(ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
 #endif
 
+/*
+ * The (arm)linux board id set by generic code depending on configured board
+ * (see boards.cfg for different boards)
+ */
+#ifdef CONFIG_AT91SAM9G20
+	/* the sam9g20 variants have two different board ids */
+# ifdef CONFIG_AT91SAM9G20EK_2MMC
+	/* we may be setup for the 2MMC variant of at91sam9g20ek */
+#  define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK_2MMC
+# else
+	/* or the normal at91sam9g20ek */
+#  define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9G20EK
+# endif
+#else
+	/* otherwise default to good old at91sam9260ek */
+# define CONFIG_MACH_TYPE MACH_TYPE_AT91SAM9260EK
+#endif
+
 /* DataFlash */
 #ifndef CONFIG_AT91SAM9G20EK_2MMC
 #define CONFIG_ATMEL_DATAFLASH_SPI
Signature · 1 line
1.7.10.4