diff options
Diffstat (limited to 'io-module')
-rw-r--r-- | io-module/mths.c | 372 | ||||
-rw-r--r-- | io-module/mts_io.c | 8 | ||||
-rw-r--r-- | io-module/mts_io.h | 3 |
3 files changed, 382 insertions, 1 deletions
diff --git a/io-module/mths.c b/io-module/mths.c new file mode 100644 index 0000000..18af942 --- /dev/null +++ b/io-module/mths.c @@ -0,0 +1,372 @@ +static struct gpio_pin gpio_pins_mths_0_0[] = { + { + .name = "RADIO_POWER_MONITOR", + .pin = { + .gpio = AT91_PIN_PA23, + .flags = GPIOF_IN, + .label = "radio-power-monitor", + }, + .active_low = 0, + }, + { + .name = "RADIO_RESET", + .pin = { + .gpio = AT91_PIN_PA22, + .flags = GPIOF_OUT_INIT_HIGH | GPIOF_PULLUP, + .label = "radio-reset", + }, + .active_low = 0, + }, + { + .name = "RADIO_POWER", + .pin = { + .gpio = AT91_PIN_PA21, + .flags = GPIOF_OUT_INIT_HIGH | GPIOF_PULLUP, + .label = "radio-power", + }, + .active_low = 0, + }, + { + .name = "DEVICE_RESET", + .pin = { + .gpio = AT91_PIN_PC4, + .flags = GPIOF_IN, + .label = "reset", + }, + .active_low = 1, + }, + { + .name = "LS_LED", + .pin = { + .gpio = AT91_PIN_PC4, +#if LED_LS_CONTROLLABLE + .flags = GPIOF_OUT_INIT_HIGH, +#else + .flags = GPIOF_IN, +#endif + .label = "led-ls", + }, + .active_low = 1, + }, + { + .name = "STATUS_LED", + .pin = { + .gpio = AT91_PIN_PC16, + .flags = GPIOF_OUT_INIT_LOW, + .label = "led-status", + }, + .active_low = 1, + }, + { + .name = "LED3", + .pin = { + .gpio = AT91_PIN_PC15, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-wifi", + }, + .active_low = 1, + }, + { + .name = "LED3", + .pin = { + .gpio = AT91_PIN_PC15, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-b", + }, + .active_low = 1, + }, + { + .name = "LED4", + .pin = { + .gpio = AT91_PIN_PC20, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-bt", + }, + .active_low = 1, + }, + { + .name = "LED4", + .pin = { + .gpio = AT91_PIN_PC20, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-c", + }, + .active_low = 1, + }, + { + .name = "LED5", + .pin = { + .gpio = AT91_PIN_PC16, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-link-status", + }, + .active_low = 1, + }, + { + .name = "LED5", + .pin = { + .gpio = AT91_PIN_PC16, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-d", + }, + .active_low = 1, + }, + { + .name = "LED6", + .pin = { + .gpio = AT91_PIN_PC19, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-sig1", + }, + .active_low = 1, + }, + { + .name = "LED6", + .pin = { + .gpio = AT91_PIN_PC19, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-e", + }, + .active_low = 1, + }, + { + .name = "LED7", + .pin = { + .gpio = AT91_PIN_PC18, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-sig2", + }, + .active_low = 1, + }, + { + .name = "LED7", + .pin = { + .gpio = AT91_PIN_PC18, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-f", + }, + .active_low = 1, + }, + { + .name = "LED8", + .pin = { + .gpio = AT91_PIN_PC17, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-sig3", + }, + .active_low = 1, + }, + { + .name = "LED8", + .pin = { + .gpio = AT91_PIN_PC17, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "led-g", + }, + .active_low = 1, + }, + + // The difference between MTRv1_0_0 and MTRv1_0_1 starts here + { + .name = "WIFI_BT_ULPWKUP", + .pin = { + .gpio = AT91_PIN_PB9, + .flags = GPIOF_IN, + .label = "wifi-bt-ulpwkup", + } + }, + { + .name = "WIFI_BT_LPWKUP", + .pin = { + .gpio = AT91_PIN_PB11, + .flags = GPIOF_IN, + .label = "wifi-bt-lpwkup", + } + }, + { + .name = "WIFI_BT_INT", // WLAN_IRQ on schematic + .pin = { + .gpio = AT91_PIN_PB13, + .flags = GPIOF_IN, + .label = "wifi-bt-int", + } + }, + { + .name = "WIFI_BT_RESET", + .pin = { + .gpio = AT91_PIN_PB10, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "wifi-bt-reset", + } + }, + { + .name = "WIFI_BT_LPMODE", + .pin = { + .gpio = AT91_PIN_PB12, + .flags = GPIOF_IN, + .label = "wifi-bt-lpmode", + } + }, + { + .name = "GNSS_RESET", + .pin = { + .gpio = AT91_PIN_PC6, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "gnss-reset", + } + }, + { + .name = "USBHUB_RESET", + .pin = { + .gpio = AT91_PIN_PB6, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "usbhub-reset", + } + }, + { + .name = "GNSS_INT", + .pin = { + .gpio = AT91_PIN_PC7, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "gnss-int", + } + }, + { + .name = "WIFI_BUTTON", + .pin = { + .gpio = AT91_PIN_PA13, + .flags = GPIOF_IN, + .label = "wifi-button", + }, + .active_low = 0, + }, + { + .name = "WIFI_BUTTON", + .pin = { + .gpio = AT91_PIN_PA12, + .flags = GPIOF_IN, + .label = "wifi-button", + }, + .active_low = 0, + }, + { }, +}; + + + +static DEVICE_ATTR_MTS(dev_attr_radio_power_hs, "radio-power", + mts_attr_show_radio_power, mts_attr_store_radio_power_mtr); + +static DEVICE_ATTR_MTS(dev_attr_radio_reset_hs, "radio-reset", + mts_attr_show_gpio_pin, mts_attr_store_radio_reset_mtr); + +static DEVICE_ATTR_MTS(dev_attr_eth_reset_hs, "eth-reset", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_bt_enabled_hs, "bt-enabled", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_wlan_enabled_hs, "wlan-enabled", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_led_wifi_gpio_hs, "led-wifi", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_led_f_gpio_hs, "led-f", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_extserial_ri_gpio_hs, "extserial-ri", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_RO_MTS(dev_attr_extserial_dtr_hs, "extserial-dtr", + mts_attr_show_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_extserial_dsr_gpio_hs, "extserial-dsr", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_extserial_dcd_gpio_hs, "extserial-dcd", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_RO_MTS(dev_attr_wifi_mac_hs, "mac-wifi", + mts_attr_show_product_info); + +static DEVICE_ATTR_MTS(dev_attr_wifi_bt_lpwkup_hs, "wifi-bt-lpwkup", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_wifi_bt_ulpwkup_hs, "wifi-bt-ulpwkup", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_wifi_bt_reset_hs, "wifi-bt-reset", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_lpmode_hs, "wifi-bt-lpmode", + mts_attr_show_gpio_pin); + +static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_int_hs, "wifi-bt-int", + mts_attr_show_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_gnss_reset_hs, "gnss-reset", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_usbhub_reset_hs, "usbhub-reset", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_RO_MTS(dev_attr_gnss_int_hs, "gnss-int", + mts_attr_show_gpio_pin); + +static struct attribute *mths_0_0_platform_attributes[] = { + &dev_attr_vendor_id.attr, + &dev_attr_product_id.attr, + &dev_attr_device_id.attr, + &dev_attr_uuid.attr, + &dev_attr_hw_version.attr, + &dev_attr_imei.attr, + &dev_attr_eth_mac.attr, + &dev_attr_has_radio.attr, + &dev_attr_wifi_mac_hs.attr, + + &dev_attr_reset.attr, + &dev_attr_reset_monitor.attr, + &dev_attr_reset_monitor_intervals.attr, + &dev_attr_radio_power_hs.attr, + &dev_attr_radio_reset_hs.attr, + + &dev_attr_radio_reset_backoffs.attr, + &dev_attr_radio_reset_backoff_index.attr, + &dev_attr_radio_reset_backoff_seconds.attr, + + &dev_attr_extserial_ri_gpio_hs.attr, + &dev_attr_extserial_dtr_hs.attr, + &dev_attr_extserial_dsr_gpio_hs.attr, + &dev_attr_extserial_dcd_gpio_hs.attr, + + &dev_attr_eth_reset_hs.attr, + &dev_attr_wifi_bt_lpwkup_hs.attr, + &dev_attr_wifi_bt_ulpwkup_hs.attr, + &dev_attr_wifi_bt_reset_hs.attr, + &dev_attr_wifi_bt_lpmode_hs.attr, + &dev_attr_wifi_bt_int_hs.attr, + &dev_attr_gnss_reset_hs.attr, + &dev_attr_usbhub_reset_hs.attr, + &dev_attr_gnss_int_hs.attr, + + &dev_attr_led_status.attr, + &dev_attr_led_cd_gpio.attr, + &dev_attr_led_sig1_gpio.attr, + &dev_attr_led_sig2_gpio.attr, + &dev_attr_led_sig3_gpio.attr, + &dev_attr_led_wifi_gpio_hs.attr, + + &dev_attr_led_b_gpio.attr, + &dev_attr_led_c_gpio.attr, + &dev_attr_led_d_gpio.attr, + &dev_attr_led_e_gpio.attr, + &dev_attr_led_f_gpio_hs.attr, + + NULL, +}; + +static struct attribute_group mths_0_0_platform_attribute_group = { + .attrs = mths_0_0_platform_attributes +}; + diff --git a/io-module/mts_io.c b/io-module/mts_io.c index d360256..35146ea 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -47,7 +47,7 @@ #include "mts_io.h" -#define DRIVER_VERSION "v2.0.4" +#define DRIVER_VERSION "v2.0.5" #define DRIVER_AUTHOR "James Maki <jmaki@multitech.com>" #define DRIVER_DESC "MTS-IO Controller" #define DRIVER_NAME "mts-io" @@ -721,6 +721,7 @@ static int get_radio_model_from_product_id(void) { #include "mtcdt.c" #include "mtcap.c" #include "mtr.c" +#include "hs.c" /* include capabilities sub-directory support */ #include "mts_capab.c" @@ -950,6 +951,11 @@ mts_id_eeprom_load(void) gpio_pins = gpio_pins_mtrv1_0_2; mts_hw_version = MTRV1_0_2; log_info("detected board %s", HW_VERSION_MTRV1_0_2); + } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTHS_0_0, strlen(HW_VERSION_MTHS_0_0)) == 0) { + attr_group = &mths_0_0_platform_attribute_group; + gpio_pins = gpio_pins_mths_0_0; + mts_hw_version = MTHS_0_0; + log_info("detected board %s", HW_VERSION_MTHS_0_0); } else if (((tmp=HW_VERSION_MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { current_blength = attr_blength = sizeof mtcdt_0_1_platform_attributes; diff --git a/io-module/mts_io.h b/io-module/mts_io.h index 23f48f5..b622330 100644 --- a/io-module/mts_io.h +++ b/io-module/mts_io.h @@ -52,6 +52,7 @@ struct device_attribute mts_dev_name = { \ #define PRODUCT_ID_MTAC_MFSER "MTAC-MFSER" #define PRODUCT_ID_MTAC_ETH "MTAC-ETH" #define PRODUCT_ID_MTAC_LORA "MTAC-LORA" +#define PRODUCT_ID_MTHS "MTHS" /* Hardware version must be fewer characters than hw_version in struct mts_ap_eeprom_layout */ @@ -77,6 +78,7 @@ struct device_attribute mts_dev_name = { \ #define HW_VERSION_MTCDTIPHP_0_0 "MTCDTIPHP-0.0" #define HW_VERSION_MTCAP_0_0 "MTCAP-0.0" #define HW_VERSION_MTCAP_0_1 "MTCAP-0.1" +#define HW_VERSION_MTHS_0_0 "MTHS-0.0" enum { MTCDP_E1_DK_0_0, @@ -92,6 +94,7 @@ enum { MTCDTIPHP_0_0, MTCAP_0_0, MTCAP_0_1, + MTHS_0_0, }; enum { |