Skip to contentSkip to conversation

at91: Update MEESC board support

PATCH Superseded Daniel Gorsulowski 3 participants 5 messages Sep 10, 2009 – Sep 22, 2009

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 at91: Update MEESC board support

This patch implements several updates:
-disable CONFIG_ENV_OVERWRITE
-add new hardware style variants and set the arch numbers appropriate (autodet.) -pass the serial# and hardware revision to the kernel
-removed unused macros from include/configs/meesc.h

---
v2: - don't write the ethernet address to the EMAC module anymore

v3: - removed function meesc_set_arch_number and moved code to checkboard()
- reworked function get_board_serial()
- removed unused macros from include/configs/meesc.h

 board/esd/meesc/meesc.c |   62 +++++++++++++++++++++++++++++++++++++++++++----
 include/configs/meesc.h |   25 ++++++-------------
 2 files changed, 65 insertions(+), 22 deletions(-)
board/esd/meesc/meesc.c +57 -5
index 636d0ed..045fbe2 100644
@@ -156,8 +156,35 @@ int board_eth_init(bd_t *bis)
 int checkboard(void)
 {
 	char str[32];
-
-	puts("Board: esd CAN-EtherCAT Gateway");
+	u_char hw_type;	/* hardware type */
+
+	/* read the "Type" register of the ET1100 controller */
+	hw_type = readb(CONFIG_ET1100_BASE);
+
+	switch (hw_type) {
+		case 0x11:
+		case 0x3F:
+			/* ET1100 present,
+			   arch number of MEESC-Board */
+			gd->bd->bi_arch_number = MACH_TYPE_MEESC;
+			puts("Board: CAN-EtherCAT Gateway");
+			break;
+		case 0xFF:
+			/* no ET1100 present,
+			   arch number of EtherCAN/2-Board */
+			gd->bd->bi_arch_number = MACH_TYPE_ETHERCAN2;
+			puts("Board: EtherCAN/2 Gateway");
+			/* switch on LED1D */
+			at91_set_gpio_output(AT91_PIN_PB12, 1);
+			break;
+		default:
+			/* assume, no ET1100 present,
+			   arch number of EtherCAN/2-Board */
+			gd->bd->bi_arch_number = MACH_TYPE_ETHERCAN2;
+			printf("FATAL! Read invalid hw_type: %02X\n", hw_type);
+			puts("Board: EtherCAN/2 Gateway");
+			break;
+	}
 	if (getenv_r("serial#", str, sizeof(str)) > 0) {
 		puts(", serial# ");
 		puts(str);
@@ -167,6 +194,32 @@ int checkboard(void)
 	return 0;
 }
 
+#ifdef CONFIG_SERIAL_TAG
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+	char *str;
+
+	char *serial = getenv("serial#");
+	if (serial) {
+		str = strchr(serial, '_');
+		if (str && (strlen(str) >= 4)) {
+			serialnr->high = (*(str + 1) << 8) | *(str + 2);
+			serialnr->low = simple_strtoul(str + 3, NULL, 16);
+		}
+	} else {
+		serialnr->high = 0;
+		serialnr->low = 0;
+	}
+}
+#endif
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void)
+{
+	return hw_rev | 0x100;
+}
+#endif
+
 int board_init(void)
 {
 	/* Peripheral Clock Enable Register */
@@ -174,8 +227,8 @@ int board_init(void)
 					1 << AT91SAM9263_ID_PIOB |
 					1 << AT91SAM9263_ID_PIOCDE);
 
-	/* arch number of MEESC-Board */
-	gd->bd->bi_arch_number = MACH_TYPE_MEESC;
+	/* initialize ET1100 Controller */
+	meesc_ethercat_hw_init();
 
 	/* adress of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
@@ -184,7 +237,6 @@ int board_init(void)
 #ifdef CONFIG_CMD_NAND
 	meesc_nand_hw_init();
 #endif
-	meesc_ethercat_hw_init();
 #ifdef CONFIG_HAS_DATAFLASH
 	at91_spi0_hw_init(1 << 0);
 #endif
include/configs/meesc.h +8 -17
index 8253172..b996854 100644
@@ -36,13 +36,14 @@
 #define CONFIG_MEESC			1	/* Board is esd MEESC */
 #define CONFIG_ARM926EJS		1	/* This is an ARM926EJS Core */
 #define CONFIG_AT91SAM9263		1	/* It's an AT91SAM9263 SoC */
-#define CONFIG_ENV_OVERWRITE		1	/* necessary on prototypes */
 #define CONFIG_DISPLAY_BOARDINFO	1
 #define CONFIG_DISPLAY_CPUINFO		1	/* display cpu info and speed */
 #define CONFIG_PREBOOT				/* enable preboot variable */
 #define CONFIG_CMDLINE_TAG		1	/* enable passing of ATAGs */
 #define CONFIG_SETUP_MEMORY_TAGS	1
 #define CONFIG_INITRD_TAG		1
+#define CONFIG_SERIAL_TAG		1
+#define CONFIG_REVISION_TAG		1
 #undef CONFIG_USE_IRQ				/* don't need IRQ/FIQ stuff */
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
@@ -138,12 +139,13 @@
 #define CONFIG_SYS_USE_DATAFLASH		1
 #undef CONFIG_SYS_USE_NANDFLASH
 
-#ifdef CONFIG_SYS_USE_DATAFLASH
-
 /* CAN */
 #define CONFIG_AT91_CAN				1
 
-/* bootstrap + u-boot + env + linux in dataflash on CS0 */
+/* hw-controller addresses */
+#define CONFIG_ET1100_BASE			0x70000000
+
+/* bootstrap + u-boot + env in dataflash on CS0 */
 #define CONFIG_ENV_IS_IN_DATAFLASH	1
 #define CONFIG_SYS_MONITOR_BASE		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + \
 					0x8400)
@@ -151,18 +153,6 @@
 #define CONFIG_ENV_ADDR			(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + \
 					CONFIG_ENV_OFFSET)
 #define CONFIG_ENV_SIZE			0x4200
-#define CONFIG_BOOTCOMMAND		"cp.b C0042000 22000000 210000; bootm"
-
-#else /* CONFIG_SYS_USE_NANDFLASH */
-
-/* bootstrap + u-boot + env + linux in nandflash */
-#define CONFIG_ENV_IS_IN_NAND	1
-#define CONFIG_ENV_OFFSET		0x60000
-#define CONFIG_ENV_OFFSET_REDUND	0x80000
-#define CONFIG_ENV_SIZE			0x20000		/* 1 sector = 128 kB */
-#define CONFIG_BOOTCOMMAND		"nand read 22000000 A0000 200000; bootm"
-
-#endif
 
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
@@ -178,7 +168,8 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN		0x2D000
+#define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + \
+					128*1024, 0x1000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
 
 #define CONFIG_STACKSIZE		(32 * 1024)	/* regular stack */
Signature · 1 line
1.5.3
#1 lore raw

PATCH v3 1/1 at91: Update MEESC board support

Dear Wolfgang Denk and Jean-Christophe PLAGNIOL-VILLARD,

Quoted 10 lines · Daniel Gorsulowski

This patch implements several updates:

(quoted diff) +0 -4
-disable CONFIG_ENV_OVERWRITE
-add new hardware style variants and set the arch numbers appropriate (autodet.)
-pass the serial# and hardware revision to the kernel
-removed unused macros from include/configs/meesc.h

---
v2: - don't write the ethernet address to the EMAC module anymore

Quoted 8 lines

v3: - removed function meesc_set_arch_number and moved code to checkboard()
- reworked function get_board_serial()
- removed unused macros from include/configs/meesc.h

 board/esd/meesc/meesc.c |   62 +++++++++++++++++++++++++++++++++++++++++++----
 include/configs/meesc.h |   25 ++++++-------------
 2 files changed, 65 insertions(+), 22 deletions(-)

<snip>

what about this patch? No more comments, no "NACK", no "applied to..."?

Best regards,
Daniel Gorsulowski

#2 lore raw

PATCH v3 1/1 at91: Update MEESC board support

Dear Daniel Gorsulowski,

Quoted 1 line · In message <[email protected]> you wrote:

Dear Wolfgang Denk and Jean-Christophe PLAGNIOL-VILLARD,

...

Quoted 1 line

what about this patch? No more comments, no "NACK", no "applied to..."?

As you might have noticed, Jean-Christophe just throw in the towel as AT91 (and PXA and IXP) custodian. Until we find a new one (volunteers welcome!) Tom will have to handles this - additionally to his other work. Please be a bit patient with him. You can usually just relax as long as there is no NAK :-)

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There are three principal ways to lose money: wine, women, and engi-
neers. While the first two are more pleasant, the third is by far the
more certain."                           - Baron Rothschild, ca. 1800
#3 lore raw

PATCH v3 1/1 at91: Update MEESC board support

In reply to Daniel Gorsulowski
Quoted 17 lines · Daniel Gorsulowski

Dear Wolfgang Denk and Jean-Christophe PLAGNIOL-VILLARD,

Quoted 14 lines · Daniel Gorsulowski

This patch implements several updates:

(quoted diff) +0 -4
-disable CONFIG_ENV_OVERWRITE
-add new hardware style variants and set the arch numbers appropriate (autodet.)
-pass the serial# and hardware revision to the kernel
-removed unused macros from include/configs/meesc.h

---
v2: - don't write the ethernet address to the EMAC module anymore

v3: - removed function meesc_set_arch_number and moved code to checkboard()
- reworked function get_board_serial()
- removed unused macros from include/configs/meesc.h

Quoted 7 lines
Quoted 4 lines
 board/esd/meesc/meesc.c |   62 +++++++++++++++++++++++++++++++++++++++++++----
 include/configs/meesc.h |   25 ++++++-------------
 2 files changed, 65 insertions(+), 22 deletions(-)

<snip>

what about this patch? No more comments, no "NACK", no "applied to..."?

Daniel,
Please resend or point me to the latest version of this patch. We will resolve this shortly.
Thanks,
Tom

Quoted 7 lines

Best regards,
Daniel Gorsulowski
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH v3 1/1 at91: Update MEESC board support

In reply to Daniel Gorsulowski

Dear Daniel Gorsulowski,

Review

Quoted 3 lines · In message <[email protected]> you wrote:

This patch implements several updates:

(quoted diff) +0 -2
-disable CONFIG_ENV_OVERWRITE
-add new hardware style variants and set the arch numbers appropriate (autodet.)

LIne too long.

Quoted 4 lines
(quoted diff) +0 -2
-pass the serial# and hardware revision to the kernel
-removed unused macros from include/configs/meesc.h

...

Quoted 6 lines
board/esd/meesc/meesc.c +0 -0
@@ -156,8 +156,35 @@ int board_eth_init(bd_t *bis)
 int checkboard(void)
 {
 	char str[32];

board/esd/meesc/meesc.c int board_eth_init(bd_t *bis) · line 166

Quoted 10 lines
board/esd/meesc/meesc.c +8 -2
-
-	puts("Board: esd CAN-EtherCAT Gateway");
+	u_char hw_type;	/* hardware type */
+
+	/* read the "Type" register of the ET1100 controller */
+	hw_type = readb(CONFIG_ET1100_BASE);
+
+	switch (hw_type) {
+		case 0x11:
+		case 0x3F:

Incorrect indentation - the "case" must have the same indent as the "switch". Please fix globally.

board/esd/meesc/meesc.c int board_eth_init(bd_t *bis) · line 168

Quoted 2 lines
board/esd/meesc/meesc.c +2 -0
+			/* ET1100 present,
+			   arch number of MEESC-Board */

Incorrect multiline comment style. Please fix globally.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Lots of people drink from the wrong bottle sometimes.
	-- Edith Keeler, "The City on the Edge of Forever",
	   stardate unknown