From 3eb107eb75d909c0a940b99cb1c033b6da485f9c Mon Sep 17 00:00:00 2001 From: Jesse Gilles Date: Mon, 14 Jan 2013 18:15:58 -0600 Subject: read hw_version for MTR, MTR2, log detected board config * allows for different product-id as long as hw-version is right (MTR3) --- io-module/mts_io.c | 9 +++++++-- io-module/mts_io.h | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 547f730..1f3040e 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -774,6 +774,7 @@ static int mts_id_eeprom_load(void) gpio_pins = gpio_pins_mtcdp_0_0; mts_product_id = MTCDP_E1_DK_0_0; + log_info("detected board %s", HW_VERSION_MTCDP_0_0); } else if (strncmp(id_eeprom.product_id, PRODUCT_ID_MT100EOCG, strlen(PRODUCT_ID_MT100EOCG)) == 0) { gpio_pins = gpio_pins_mt100eocg_0_0; mts_product_id = MT100EOCG_0_0; @@ -781,20 +782,23 @@ static int mts_id_eeprom_load(void) has_spi_din = 1; has_spi_dout = 1; has_spi_temp = 1; - } else if (strncmp(id_eeprom.product_id, PRODUCT_ID_MTR2, strlen(PRODUCT_ID_MTR2)) == 0) { + log_info("detected board %s", HW_VERSION_MT100EOCG_0_0); + } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR2_0_0, strlen(HW_VERSION_MTR2_0_0)) == 0) { gpio_pins = gpio_pins_mtr2_0_0; mts_product_id = MTR2_0_0; has_spi_sout = 0; has_spi_din = 0; has_spi_dout = 0; has_spi_temp = 1; - } else if (strncmp(id_eeprom.product_id, PRODUCT_ID_MTR, strlen(PRODUCT_ID_MTR)) == 0) { + log_info("detected board %s", HW_VERSION_MTR2_0_0); + } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR_0_0, strlen(HW_VERSION_MTR_0_0)) == 0) { gpio_pins = gpio_pins_mtr_0_0; mts_product_id = MTR_0_0; has_spi_sout = 0; has_spi_din = 0; has_spi_dout = 0; has_spi_temp = 0; + log_info("detected board %s", HW_VERSION_MTR_0_0); } else { gpio_pins = gpio_pins_mtcdp_1_0; mts_product_id = MTCDP_E1_DK_1_0; @@ -802,6 +806,7 @@ static int mts_id_eeprom_load(void) has_spi_din = 1; has_spi_dout = 1; has_spi_temp = 1; + log_info("detected board %s", HW_VERSION_MTCDP_1_0); } log_info("sizeof: %lu", (unsigned long) sizeof(struct mts_id_eeprom_layout)); diff --git a/io-module/mts_io.h b/io-module/mts_io.h index 5f00cda..eb40276 100644 --- a/io-module/mts_io.h +++ b/io-module/mts_io.h @@ -20,8 +20,8 @@ #define HW_VERSION_MTCDP_0_0 "MTCDP-0.0" #define HW_VERSION_MTCDP_1_0 "MTCDP-1.0" #define HW_VERSION_MT100EOCG_0_0 "MT100EOCG-0.0" -#define HW_VERSION_MTR2 "MTR2-0.0" -#define HW_VERSION_MTR "MTR-0.0" +#define HW_VERSION_MTR2_0_0 "MTR2-0.0" +#define HW_VERSION_MTR_0_0 "MTR-0.0" enum { MTCDP_E1_DK_0_0, -- cgit v1.2.3