diff options
author | Mike Fiore <mfiore@multitech.com> | 2014-08-25 14:43:59 -0500 |
---|---|---|
committer | Mike Fiore <mfiore@multitech.com> | 2014-08-25 14:43:59 -0500 |
commit | 6709e0cb9fce54385937ccd4d42dece2159664a9 (patch) | |
tree | f5b2d0d0eee49c9cd6d5ac6344c0e071a8109baf /io-module | |
parent | 19018dbbb35bd2940721ea6f04400a58c9644839 (diff) | |
download | mts-io-6709e0cb9fce54385937ccd4d42dece2159664a9.tar.gz mts-io-6709e0cb9fce54385937ccd4d42dece2159664a9.tar.bz2 mts-io-6709e0cb9fce54385937ccd4d42dece2159664a9.zip |
mts-io: more changes for mtr2d2 HW
only log MAC addresses for BT and WIFI if capable
log contents of both accessory card EEPROMs
skip loading accessory card attributes for now - needs rework w/new HW
define MTAC-ETH in mts-io.h
Diffstat (limited to 'io-module')
-rw-r--r-- | io-module/mts_io.c | 94 | ||||
-rw-r--r-- | io-module/mts_io.h | 2 |
2 files changed, 63 insertions, 33 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c index bf0332a..e26013d 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -419,30 +419,55 @@ static DEVICE_ATTR_RO_MTS(dev_attr_eth_mac, "mac-eth", */ static int mts_ap_eeprom_load(void) { + // Accessory Card Slot 1 memcpy(&ap1_eeprom, mts_ap1_eeprom, sizeof(mts_ap1_eeprom)); if (mts_ap1_eeprom[0] == 0xFF) { - log_error("uninitialized eeprom on daughter card"); - return -EIO; + log_error("uninitialized eeprom on accessory card 1"); } else if (mts_ap1_eeprom[0] == 0x00) { - log_info("no daughter card inserted"); - return 0; + log_info("no accessory card inserted in slot 1"); + } else { + has_accessory_card_port_1 = true; + + log_info("accessory card 1 vendor-id: %.32s", ap1_eeprom.vendor_id); + log_info("accessory card 1 product-id: %.32s", ap1_eeprom.product_id); + log_info("accessory card 1 device-id: %.32s", ap1_eeprom.device_id); + log_info("accessory card 1 hw-version: %.32s", ap1_eeprom.hw_version); + if (strncmp(ap1_eeprom.product_id, PRODUCT_ID_MTDC_ETH, strlen(PRODUCT_ID_MTDC_ETH)) == 0) { + log_info("accessory card 1 mac-addr: %02X:%02X:%02X:%02X:%02X:%02X", + ap1_eeprom.mac_addr[0], + ap1_eeprom.mac_addr[1], + ap1_eeprom.mac_addr[2], + ap1_eeprom.mac_addr[3], + ap1_eeprom.mac_addr[4], + ap1_eeprom.mac_addr[5]); + } } - has_accessory_card_port_1 = true; + // Accessory Card Slot 2 + memcpy(&ap2_eeprom, mts_ap2_eeprom, sizeof(mts_ap2_eeprom)); - log_info("daughter card vendor-id: %.32s", ap1_eeprom.vendor_id); - log_info("daughter card product-id: %.32s", ap1_eeprom.product_id); - log_info("daughter card device-id: %.32s", ap1_eeprom.device_id); - log_info("daughter card hw-version: %.32s", ap1_eeprom.hw_version); - /* TODO: only show the mac address if this is the ethernet card */ - log_info("daughter card mac-addr: %02X:%02X:%02X:%02X:%02X:%02X", - ap1_eeprom.mac_addr[0], - ap1_eeprom.mac_addr[1], - ap1_eeprom.mac_addr[2], - ap1_eeprom.mac_addr[3], - ap1_eeprom.mac_addr[4], - ap1_eeprom.mac_addr[5]); + if (mts_ap2_eeprom[0] == 0xFF) { + log_error("uninitialized eeprom on accessory card 2"); + } else if (mts_ap2_eeprom[0] == 0x00) { + log_info("no accessory card inserted in slot 2"); + } else { + has_accessory_card_port_2 = true; + + log_info("accessory card 2 vendor-id: %.32s", ap2_eeprom.vendor_id); + log_info("accessory card 2 product-id: %.32s", ap2_eeprom.product_id); + log_info("accessory card 2 device-id: %.32s", ap2_eeprom.device_id); + log_info("accessory card 2 hw-version: %.32s", ap2_eeprom.hw_version); + if (strncmp(ap2_eeprom.product_id, PRODUCT_ID_MTDC_ETH, strlen(PRODUCT_ID_MTDC_ETH)) == 0) { + log_info("accessory card 2 mac-addr: %02X:%02X:%02X:%02X:%02X:%02X", + ap2_eeprom.mac_addr[0], + ap2_eeprom.mac_addr[1], + ap2_eeprom.mac_addr[2], + ap2_eeprom.mac_addr[3], + ap2_eeprom.mac_addr[4], + ap2_eeprom.mac_addr[5]); + } + } return 0; } @@ -580,20 +605,24 @@ static int mts_id_eeprom_load(void) log_info("capa-adc: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_ADC) ? "yes" : "no"); log_info("capa-wifi: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI) ? "yes" : "no"); log_info("capa-bluetooth: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_BLUETOOTH) ? "yes" : "no"); - log_info("mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X", - id_eeprom.mac_bluetooth[0], - id_eeprom.mac_bluetooth[1], - id_eeprom.mac_bluetooth[2], - id_eeprom.mac_bluetooth[3], - id_eeprom.mac_bluetooth[4], - id_eeprom.mac_bluetooth[5]); - log_info("mac-wifi: %02X:%02X:%02X:%02X:%02X:%02X", - id_eeprom.mac_wifi[0], - id_eeprom.mac_wifi[1], - id_eeprom.mac_wifi[2], - id_eeprom.mac_wifi[3], - id_eeprom.mac_wifi[4], - id_eeprom.mac_wifi[5]); + if (DEVICE_CAPA(id_eeprom.capa, CAPA_BLUETOOTH)) { + log_info("mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X", + id_eeprom.mac_bluetooth[0], + id_eeprom.mac_bluetooth[1], + id_eeprom.mac_bluetooth[2], + id_eeprom.mac_bluetooth[3], + id_eeprom.mac_bluetooth[4], + id_eeprom.mac_bluetooth[5]); + } + if (DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { + log_info("mac-wifi: %02X:%02X:%02X:%02X:%02X:%02X", + id_eeprom.mac_wifi[0], + id_eeprom.mac_wifi[1], + id_eeprom.mac_wifi[2], + id_eeprom.mac_wifi[3], + id_eeprom.mac_wifi[4], + id_eeprom.mac_wifi[5]); + } return 0; } @@ -618,7 +647,8 @@ static int __init mts_io_init(void) log_error("error reading daughter card eeprom: %d", ret); log_error("unable to initialize daughter card"); goto error1; - } else if (has_accessory_card_port_1) { + } else if (false) { + // this needs review, stay away for now /* no error and we have a daughter card */ if (strstr(ap1_eeprom.product_id, PRODUCT_ID_MTDC_GPIOB)) { mts_ap1_product_id = MTDC_GPIOB_0_0; diff --git a/io-module/mts_io.h b/io-module/mts_io.h index fc37ac5..cff0b2a 100644 --- a/io-module/mts_io.h +++ b/io-module/mts_io.h @@ -49,7 +49,7 @@ struct device_attribute _dev_name = { \ #define PRODUCT_ID_MTR2D2 "MTR2D2" #define PRODUCT_ID_MTDC_GPIOB "MTDC-GPIOB" - +#define PRODUCT_ID_MTDC_ETH "MTDC-ETH" #define HW_VERSION_MTCBA2_2_0 "MTCBA2-2.0" #define HW_VERSION_MTCDP_0_0 "MTCDP-0.0" |