summaryrefslogtreecommitdiff
path: root/io-module/mths.c
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-05-18 19:31:00 -0500
committerJohn Klug <john.klug@multitech.com>2018-05-18 19:31:00 -0500
commitc2722d5ee922f52b53d6cee37d89c43ae43063c5 (patch)
tree84f49440bcc0cf52c88beb67dd0c6cbede60bd7c /io-module/mths.c
parent22ab73a75654edc33def4cf715791ead698e28bc (diff)
downloadmts-io-c2722d5ee922f52b53d6cee37d89c43ae43063c5.tar.gz
mts-io-c2722d5ee922f52b53d6cee37d89c43ae43063c5.tar.bz2
mts-io-c2722d5ee922f52b53d6cee37d89c43ae43063c5.zip
Zoll device code to be merged with HOTSPOT_1.0 branch
Diffstat (limited to 'io-module/mths.c')
-rw-r--r--io-module/mths.c372
1 files changed, 372 insertions, 0 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
+};
+