summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io-module/mtr.c343
-rw-r--r--io-module/mts_io.c84
-rw-r--r--io-module/mts_io.h2
3 files changed, 355 insertions, 74 deletions
diff --git a/io-module/mtr.c b/io-module/mtr.c
index fd50e78..cb9de17 100644
--- a/io-module/mtr.c
+++ b/io-module/mtr.c
@@ -917,6 +917,287 @@ static struct gpio_pin gpio_pins_mtrv1_0_1[] = {
{ },
};
+static struct gpio_pin gpio_pins_mtrv1_0_2[] = {
+ {
+ .name = "ETH_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PC6,
+ .flags = GPIOF_OUT_INIT_HIGH | GPIOF_OPEN_DRAIN, /* without GPIOF_OPEN_DRAIN causes issues with the Micrel KSZ8091RNBCA (RMII) PHY */
+ .label = "eth-reset",
+ },
+ .active_low = 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_PC21,
+ .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-cd",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED4",
+ .pin = {
+ .gpio = AT91_PIN_PC20,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-c",
+ },
+ .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-d",
+ },
+ .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-e",
+ },
+ .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-f",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "RI_B",
+ .pin = {
+ .gpio = AT91_PIN_PC25,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-ri",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "DTR_B",
+ .pin = {
+ .gpio = AT91_PIN_PC26,
+ .flags = GPIOF_IN,
+ .label = "extserial-dtr",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "DSR_B",
+ .pin = {
+ .gpio = AT91_PIN_PC27,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dsr",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "DCD_B",
+ .pin = {
+ .gpio = AT91_PIN_PC28,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dcd",
+ },
+ .active_low = 1,
+ },
+
+ // The difference between MTRv1_0_0 and MTRv1_0_1 starts here
+ {
+ .name = "WIFI_BT_ULPWKUP",
+ .pin = {
+ .gpio = AT91_PIN_PA0,
+ .flags = GPIOF_IN,
+ .label = "wifi-bt-ulpwkup",
+ }
+ },
+ {
+ .name = "WIFI_BT_LPWKUP",
+ .pin = {
+ .gpio = AT91_PIN_PA6,
+ .flags = GPIOF_IN,
+ .label = "wifi-bt-lpwkup",
+ }
+ },
+ {
+ .name = "WIFI_BT_INT",
+ .pin = {
+ .gpio = AT91_PIN_PB11,
+ .flags = GPIOF_IN,
+ .label = "wifi-bt-int",
+ }
+ },
+ {
+ .name = "WIFI_BT_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PD14,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "wifi-bt-reset",
+ }
+ },
+ {
+ .name = "WIFI_BT_LPMODE",
+ .pin = {
+ .gpio = AT91_PIN_PD20,
+ .flags = GPIOF_IN,
+ .label = "wifi-bt-lpmode",
+ }
+ },
+ {
+ .name = "GNSS_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PD15,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "gnss-reset",
+ }
+ },
+ {
+ .name = "SECURE_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PD16,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "secure-reset",
+ }
+ },
+ {
+ .name = "USBHUB_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PD18,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "usbhub-reset",
+ }
+ },
+ {
+ .name = "GNSS_INT",
+ .pin = {
+ .gpio = AT91_PIN_PD19,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "gnss-int",
+ }
+ },
+ // Difference with mtrv1_0_1 starts here
+ {
+ .name = "RADIO_WM_LK_M", // WM LINK Monitor for CAT M
+ .pin = {
+ .gpio = AT91_PIN_PA14,
+ .flags = GPIOF_IN,
+ .label = "radio-wm-lk-m",
+ }
+ },
+
+ { },
+};
+
/* radio control (power/reset) for mtr */
static int radio_off_mtr(void)
@@ -1191,6 +1472,10 @@ static DEVICE_ATTR_MTS(dev_attr_usbhub_reset_mtr, "usbhub-reset",
static DEVICE_ATTR_RO_MTS(dev_attr_gnss_int_mtr, "gnss-int",
mts_attr_show_gpio_pin);
+static DEVICE_ATTR_RO_MTS(dev_attr_radio_wm_lk_m, "radio-wm-lk-m",
+ mts_attr_show_gpio_pin);
+
+
static int
is_radio_power_attr_mtr(struct attribute *attr)
{
@@ -1305,3 +1590,61 @@ static struct attribute *mtrv1_0_1_platform_attributes[] = {
static struct attribute_group mtrv1_0_1_platform_attribute_group = {
.attrs = mtrv1_0_1_platform_attributes
};
+
+static struct attribute *mtrv1_0_2_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_mtr.attr,
+
+ &dev_attr_reset.attr,
+ &dev_attr_reset_monitor.attr,
+ &dev_attr_reset_monitor_intervals.attr,
+ &dev_attr_radio_power_mtr.attr,
+ &dev_attr_radio_reset_mtr.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_mtr.attr,
+ &dev_attr_extserial_dtr_mtr.attr,
+ &dev_attr_extserial_dsr_gpio_mtr.attr,
+ &dev_attr_extserial_dcd_gpio_mtr.attr,
+
+ &dev_attr_eth_reset_mtr.attr,
+ &dev_attr_wifi_bt_lpwkup_mtr.attr,
+ &dev_attr_wifi_bt_ulpwkup_mtr.attr,
+ &dev_attr_wifi_bt_reset_mtr.attr,
+ &dev_attr_wifi_bt_lpmode_mtr.attr,
+ &dev_attr_wifi_bt_int_mtr.attr,
+ &dev_attr_gnss_reset_mtr.attr,
+ &dev_attr_usbhub_reset_mtr.attr,
+ &dev_attr_gnss_int_mtr.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_mtr.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_mtr.attr,
+
+ &dev_attr_radio_wm_lk_m.attr, // CAT M feature
+
+ NULL,
+};
+
+static struct attribute_group mtrv1_0_2_platform_attribute_group = {
+ .attrs = mtrv1_0_2_platform_attributes
+};
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 3310208..d360256 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.3"
+#define DRIVER_VERSION "v2.0.4"
#define DRIVER_AUTHOR "James Maki <jmaki@multitech.com>"
#define DRIVER_DESC "MTS-IO Controller"
#define DRIVER_NAME "mts-io"
@@ -926,94 +926,30 @@ mts_id_eeprom_load(void)
}
log_info("detected board %s", tmp);
} else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR_0_0, strlen(HW_VERSION_MTR_0_0)) == 0) {
- if(noradio) {
- struct attribute **ap = mtcap_0_0_platform_attribute_group.attrs;
- while(1) {
- if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
- break;
- }
- j++;
- if (is_radio_power_attr_mtr(ap[j])) {
- log_info("Pruning radio feature from mts-io",j);
- ap[j] = NULL;
- break;
- }
- }
- }
-
attr_group = &mtr_platform_attribute_group;
gpio_pins = gpio_pins_mtr_0_0;
mts_hw_version = MTR_0_0;
log_info("detected board %s", HW_VERSION_MTR_0_0);
} else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR_0_1, strlen(HW_VERSION_MTR_0_1)) == 0) {
- if(noradio) {
- struct attribute **ap = mtr_platform_attribute_group.attrs;
- while(1) {
- if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
- break;
- }
- j++;
- if (is_radio_power_attr_mtr(ap[j])) {
- log_info("Pruning radio feature from mts-io",j);
- ap[j] = NULL;
- break;
- }
- }
- }
-
attr_group = &mtr_platform_attribute_group;
gpio_pins = gpio_pins_mtr_0_1;
mts_hw_version = MTR_0_1;
log_info("detected board %s", HW_VERSION_MTR_0_1);
} else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTRV1_0_0, strlen(HW_VERSION_MTRV1_0_0)) == 0) {
- if(noradio) {
- struct attribute **ap = mtr_platform_attribute_group.attrs;
- while(1) {
- if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
- break;
- }
- j++;
- if (is_radio_power_attr_mtr(ap[j])) {
- log_info("Pruning radio feature from mts-io",j);
- ap[j] = NULL;
- break;
- }
- }
- }
-
- attr_group = &mtr_platform_attribute_group;
- gpio_pins = gpio_pins_mtrv1_0_0;
- mts_hw_version = MTRV1_0_0;
- log_info("detected board %s", HW_VERSION_MTRV1_0_0);
+ attr_group = &mtr_platform_attribute_group;
+ gpio_pins = gpio_pins_mtrv1_0_0;
+ mts_hw_version = MTRV1_0_0;
+ log_info("detected board %s", HW_VERSION_MTRV1_0_0);
} else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTRV1_0_1, strlen(HW_VERSION_MTRV1_0_1)) == 0) {
- current_blength = attr_blength = sizeof mtrv1_0_1_platform_attributes;
- current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */
-
- /* See if we have no radio, and if so, prune out the stuff that follows */
- if(noradio) {
- struct attribute **ap = mtrv1_0_1_platform_attribute_group.attrs;
- while(1) {
- if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
- break;
- }
- j++;
- if (is_radio_power_attr_mtr(ap[j])) {
- log_info("Pruning radio feature from mts-io",j);
- ap[j] = NULL;
- current_blength = attr_blength = j * sizeof (ap[j]);
- break;
- }
- }
- }
-
attr_group = &mtrv1_0_1_platform_attribute_group;
gpio_pins = gpio_pins_mtrv1_0_1;
mts_hw_version = MTRV1_0_1;
log_info("detected board %s", HW_VERSION_MTRV1_0_1);
+ } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTRV1_0_2, strlen(HW_VERSION_MTRV1_0_2)) == 0) {
+ attr_group = &mtrv1_0_2_platform_attribute_group;
+ 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 (((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 5870146..23f48f5 100644
--- a/io-module/mts_io.h
+++ b/io-module/mts_io.h
@@ -70,6 +70,7 @@ struct device_attribute mts_dev_name = { \
#define HW_VERSION_MTR_0_1 "MTR-0.1"
#define HW_VERSION_MTRV1_0_0 "MTRV1-0.0"
#define HW_VERSION_MTRV1_0_1 "MTRV1-0.1"
+#define HW_VERSION_MTRV1_0_2 "MTRV1-0.2" // Cat M
#define HW_VERSION_MTCDT_0_0 "MTCDT-0.0"
#define HW_VERSION_MTCDT_0_1 "MTCDT-0.1"
#define HW_VERSION_MTCDTIP_0_0 "MTCDTIP-0.0"
@@ -85,6 +86,7 @@ enum {
MTR_0_1,
MTRV1_0_0,
MTRV1_0_1,
+ MTRV1_0_2,
MTCDT_0_0,
MTCDT_0_1,
MTCDTIPHP_0_0,