summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2016-06-03 11:14:52 -0500
committerJesse Gilles <jgilles@multitech.com>2016-06-03 11:14:52 -0500
commitb217993d7bf5a022a59a36933252ce9b6ecba603 (patch)
tree780848b0a9f1db7ec87c0ef59db0654c44a420cd
parent4fcb490b5b2a5b8e33a58c66006460d448cc1c23 (diff)
downloadmts-io-b217993d7bf5a022a59a36933252ce9b6ecba603.tar.gz
mts-io-b217993d7bf5a022a59a36933252ce9b6ecba603.tar.bz2
mts-io-b217993d7bf5a022a59a36933252ce9b6ecba603.zip
add initial support for MTCDT refresh, add MTCDT-0.1 hw version
-rw-r--r--io-module/mtcdt.c382
-rw-r--r--io-module/mts_io.c4
-rw-r--r--io-module/mts_io.h2
3 files changed, 388 insertions, 0 deletions
diff --git a/io-module/mtcdt.c b/io-module/mtcdt.c
index d945a43..4621d53 100644
--- a/io-module/mtcdt.c
+++ b/io-module/mtcdt.c
@@ -256,6 +256,345 @@ static struct gpio_pin gpio_pins_mtcdt_0_0[] = {
{ },
};
+static struct gpio_pin gpio_pins_mtcdt_0_1[] = {
+ {
+ .name = "RADIO_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PC3,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "radio-reset",
+ },
+ },
+ {
+ .name = "RADIO_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PC3,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "radio-power",
+ },
+ },
+ {
+ .name = "DEVICE_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PC2,
+ .flags = GPIOF_IN,
+ .label = "reset",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LS_LED", /* LED7 */
+ .pin = {
+ .gpio = AT91_PIN_PA14,
+#if LED_LS_CONTROLLABLE
+ .flags = GPIOF_OUT_INIT_HIGH,
+#else
+ .flags = GPIOF_IN,
+#endif
+ .label = "led-ls",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "STATUS_LED", /* LED2 */
+ .pin = {
+ .gpio = AT91_PIN_PA24,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-status",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED5",
+ .pin = {
+ .gpio = AT91_PIN_PA25,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-cd",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED5",
+ .pin = {
+ .gpio = AT91_PIN_PA25,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-a",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED1",
+ .pin = {
+ .gpio = AT91_PIN_PA26,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig1",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED1",
+ .pin = {
+ .gpio = AT91_PIN_PA26,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-b",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED4",
+ .pin = {
+ .gpio = AT91_PIN_PA27,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig2",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED4",
+ .pin = {
+ .gpio = AT91_PIN_PA27,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-c",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED3",
+ .pin = {
+ .gpio = AT91_PIN_PA28,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig3",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "LED3",
+ .pin = {
+ .gpio = AT91_PIN_PA28,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-d",
+ },
+ .active_low = 1,
+ },
+
+ // gpio pins for Accessory Card 1
+ {
+ .name = "AP1_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PB12,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "ap1-reset",
+ }
+ },
+ {
+ .name = "AP1_GPIO1",
+ .pin = {
+ .gpio = AT91_PIN_PC6,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap1-gpio1",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "AP1_GPIO2",
+ .pin = {
+ .gpio = AT91_PIN_PC7,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap1-gpio2",
+ }
+ },
+ {
+ .name = "AP1_GPIO3",
+ .pin = {
+ .gpio = AT91_PIN_PC8,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap1-gpio3",
+ }
+ },
+ {
+ .name = "AP1_GPIO4",
+ .pin = {
+ .gpio = AT91_PIN_PC9,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap1-gpio4",
+ }
+ },
+ {
+ .name = "AP1_INTERRUPT1",
+ .pin = {
+ .gpio = AT91_PIN_PB14,
+ .flags = GPIOF_IN,
+ .label = "ap1-interrupt1",
+ }
+ },
+ {
+ .name = "AP1_INTERRUPT2",
+ .pin = {
+ .gpio = AT91_PIN_PB15,
+ .flags = GPIOF_IN,
+ .label = "ap1-interrupt2",
+ }
+ },
+
+ // gpio pins for Accessory Card 2
+ {
+ .name = "AP2_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PB13,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "ap2-reset",
+ }
+ },
+ {
+ .name = "AP2_GPIO1",
+ .pin = {
+ .gpio = AT91_PIN_PC20,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap2-gpio1",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "AP2_GPIO2",
+ .pin = {
+ .gpio = AT91_PIN_PC21,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap2-gpio2",
+ }
+ },
+ {
+ .name = "AP2_GPIO3",
+ .pin = {
+ .gpio = AT91_PIN_PC22,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap2-gpio3",
+ }
+ },
+ {
+ .name = "AP2_GPIO4",
+ .pin = {
+ .gpio = AT91_PIN_PC23,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ap2-gpio4",
+ }
+ },
+ {
+ .name = "AP2_INTERRUPT1",
+ .pin = {
+ .gpio = AT91_PIN_PB17,
+ .flags = GPIOF_IN,
+ .label = "ap2-interrupt1",
+ }
+ },
+ {
+ .name = "AP2_INTERRUPT2",
+ .pin = {
+ .gpio = AT91_PIN_PB18,
+ .flags = GPIOF_IN,
+ .label = "ap2-interrupt2",
+ }
+ },
+ /*
+ {
+ .name = "WIFI_BT_LPWKUP",
+ .pin = {
+ .gpio = AT91_PIN_PA6,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "wifi-bt-lpwkup",
+ }
+ },
+ {
+ .name = "WIFI_BT_ULPWKUP",
+ .pin = {
+ .gpio = AT91_PIN_PA0,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "wifi-bt-ulpwkup",
+ }
+ },
+ */
+ /*
+ {
+ .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 = "MTQ_RESET",
+ .pin = {
+ .gpio = AT91_PIN_PD17,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "mtq-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",
+ }
+ },
+
+ { },
+};
+
+static DEVICE_ATTR_MTS(dev_attr_wifi_bt_lpwkup, "wifi-bt-lpwkup",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_wifi_bt_ulpwkup, "wifi-bt-ulpwkup",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_wifi_bt_reset, "wifi-bt-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_lpmode, "wifi-bt-lpmode",
+ mts_attr_show_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_gnss_reset, "gnss-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_usbhub_reset, "usbhub-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+
static struct attribute *mtcdt_platform_attributes[] = {
&dev_attr_vendor_id.attr,
&dev_attr_product_id.attr,
@@ -287,6 +626,49 @@ static struct attribute *mtcdt_platform_attributes[] = {
NULL,
};
+static struct attribute *mtcdt_0_1_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_reset.attr,
+ &dev_attr_reset_monitor.attr,
+ &dev_attr_reset_monitor_intervals.attr,
+ &dev_attr_radio_power.attr,
+ &dev_attr_radio_reset.attr,
+
+ &dev_attr_radio_reset_backoffs.attr,
+ &dev_attr_radio_reset_backoff_index.attr,
+ &dev_attr_radio_reset_backoff_seconds.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_a_gpio.attr,
+ &dev_attr_led_b_gpio.attr,
+ &dev_attr_led_c_gpio.attr,
+ &dev_attr_led_d_gpio.attr,
+
+ /*
+ &dev_attr_wifi_bt_lpwkup.attr,
+ &dev_attr_wifi_bt_ulpwkup.attr,
+ */
+ &dev_attr_wifi_bt_reset.attr,
+ &dev_attr_wifi_bt_lpmode.attr,
+ &dev_attr_gnss_reset.attr,
+ &dev_attr_usbhub_reset.attr,
+ NULL,
+};
+
static struct attribute_group mtcdt_platform_attribute_group = {
.attrs = mtcdt_platform_attributes
};
+static struct attribute_group mtcdt_0_1_platform_attribute_group = {
+ .attrs = mtcdt_0_1_platform_attributes
+};
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 84756d2..970bbbc 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -748,6 +748,10 @@ static int mts_id_eeprom_load(void)
if (mts_id_eeprom[0] == 0xFF) {
log_error("uninitialized eeprom");
return -EIO;
+ } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTCDT_0_1, strlen(HW_VERSION_MTCDT_0_1)) == 0) {
+ attr_group = &mtcdt_0_1_platform_attribute_group;
+ gpio_pins = gpio_pins_mtcdt_0_1;
+ log_info("detected board %s", HW_VERSION_MTCDT_0_1);
} else {
attr_group = &mtcdt_platform_attribute_group;
gpio_pins = gpio_pins_mtcdt_0_0;
diff --git a/io-module/mts_io.h b/io-module/mts_io.h
index 24a1760..2939894 100644
--- a/io-module/mts_io.h
+++ b/io-module/mts_io.h
@@ -62,6 +62,7 @@ struct device_attribute _dev_name = { \
#define HW_VERSION_MTR_0_0 "MTR-0.0"
#define HW_VERSION_MTR_0_1 "MTR-0.1"
#define HW_VERSION_MTCDT_0_0 "MTCDT-0.0"
+#define HW_VERSION_MTCDT_0_1 "MTCDT-0.1"
enum {
MTCDP_E1_DK_0_0,
@@ -70,6 +71,7 @@ enum {
MTR_0_0,
MTR_0_1,
MTCDT_0_0,
+ MTCDT_0_1,
};
enum {