This patch implements several updates: -Disable CONFIG_ENV_OVERWRITE -Add new hardware style variants and set the arch numbers appropriate (autodetect) -Pass the serial# and hardware revision to the kernel
Signed-off-by: Daniel Gorsulowski <daniel.gorsulow...@esd.eu> --- board/esd/meesc/meesc.c | 74 ++++++++++++++++++++++++++++++++++++++++++++-- include/configs/meesc.h | 6 +++- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c index 636d0ed..ecf903d 100644 --- a/board/esd/meesc/meesc.c +++ b/board/esd/meesc/meesc.c @@ -46,6 +46,7 @@ DECLARE_GLOBAL_DATA_PTR; */ static int hw_rev = -1; /* hardware revision */ +static u_char hw_type; /* hardware type */ int get_hw_rev(void) { @@ -63,6 +64,30 @@ int get_hw_rev(void) return hw_rev; } +static void meesc_set_arch_number(void) +{ + /* 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; + break; + case 0xFF: + /* no ET1100 present, + arch number of EtherCAN/2-Board */ + gd->bd->bi_arch_number = MACH_TYPE_ETHERCAN2; + break; + default: + /* assume, no ET1100 present, + arch number of EtherCAN/2-Board */ + gd->bd->bi_arch_number = MACH_TYPE_ETHERCAN2; + break; + } +} #ifdef CONFIG_CMD_NAND static void meesc_nand_hw_init(void) { @@ -157,7 +182,19 @@ int checkboard(void) { char str[32]; - puts("Board: esd CAN-EtherCAT Gateway"); + switch (hw_type) { + case 0x11: + case 0x3F: + puts("Board: CAN-EtherCAT Gateway"); + break; + case 0xFF: + puts("Board: EtherCAN/2 Gateway"); + break; + default: + 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 +204,29 @@ int checkboard(void) return 0; } +#ifdef CONFIG_SERIAL_TAG +void get_board_serial(struct tag_serialnr *serialnr) +{ + char *str; + + str = strchr(getenv("serial#"), '_'); + if (str) { + 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 +234,15 @@ 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(); + + /* set arch number by hardware type */ + meesc_set_arch_number(); + + /* switch on LED1D, if running on EtherCAN/2 hardware */ + if (hw_type == 0xFF) + at91_set_gpio_output(AT91_PIN_PB12, 1); /* adress of boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; @@ -184,7 +251,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 diff --git a/include/configs/meesc.h b/include/configs/meesc.h index 8253172..b81e24a 100644 --- a/include/configs/meesc.h +++ b/include/configs/meesc.h @@ -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 @@ -143,6 +144,9 @@ /* CAN */ #define CONFIG_AT91_CAN 1 +/* hw-controller addresses */ +#define CONFIG_ET1100_BASE 0x70000000 + /* bootstrap + u-boot + env + linux in dataflash on CS0 */ #define CONFIG_ENV_IS_IN_DATAFLASH 1 #define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + \ -- 1.5.3 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot