summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Nicholson <mikempls@users.noreply.github.com>2019-07-19 16:15:12 -0500
committerMike Nicholson <mikempls@users.noreply.github.com>2019-07-19 16:15:12 -0500
commitb7ce14e05a4a2fb00935a9e4995002a267a9d469 (patch)
tree1764c7c408366546e5e5b300374af1e696a5fed2
parent6edda2b3a73cbf41f6f92055d8949a4095f24d33 (diff)
downloadmts-io-b7ce14e05a4a2fb00935a9e4995002a267a9d469.tar.gz
mts-io-b7ce14e05a4a2fb00935a9e4995002a267a9d469.tar.bz2
mts-io-b7ce14e05a4a2fb00935a9e4995002a267a9d469.zip
MTCDT3 support (missing device reset, MTQ reset)
-rw-r--r--io-module/machine/mtcap.c (renamed from io-module/mtcap.c)0
-rw-r--r--io-module/machine/mtcdt.c (renamed from io-module/mtcdt.c)0
-rw-r--r--io-module/machine/mtcdt3.c258
-rw-r--r--io-module/machine/mths.c (renamed from io-module/mths.c)0
-rw-r--r--io-module/machine/mtr.c (renamed from io-module/mtr.c)0
-rw-r--r--io-module/mts-io.c26
-rw-r--r--io-module/mts_io_module.h7
7 files changed, 286 insertions, 5 deletions
diff --git a/io-module/mtcap.c b/io-module/machine/mtcap.c
index bd08d5a..bd08d5a 100644
--- a/io-module/mtcap.c
+++ b/io-module/machine/mtcap.c
diff --git a/io-module/mtcdt.c b/io-module/machine/mtcdt.c
index 69f87f7..69f87f7 100644
--- a/io-module/mtcdt.c
+++ b/io-module/machine/mtcdt.c
diff --git a/io-module/machine/mtcdt3.c b/io-module/machine/mtcdt3.c
new file mode 100644
index 0000000..9cc00c3
--- /dev/null
+++ b/io-module/machine/mtcdt3.c
@@ -0,0 +1,258 @@
+#include "mts_io.h"
+
+#define OMAP_GPIO(BANK, GPIO) ((BANK*32)+GPIO)
+/*
+ * Within a struct gpio_pin, there is only one
+ * occurrence of each pin, so there is only one
+ * pin label set for each gpio pin.
+ */
+static struct gpio_pin gpio_pins_mtcdt3[] = {
+ {
+ .name = "RADIO_RESET",
+ .pin = {
+ .gpio = OMAP_GPIO(5,9), /* 5_9 */
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "radio-reset",
+ },
+ },
+#if 0
+ /* This goes through the PMIC for now */
+ {
+ .name = "RADIO_POWER",
+ .pin = {
+ .gpio = 0,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "radio-power",
+ },
+ },
+#endif
+ {
+ .name = "DEVICE_RESET",
+ .pin = {
+ .gpio = 0, /* This is a special register */
+ .flags = GPIOF_IN,
+ .label = "reset",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "WIFI_BT_INT",
+ .pin = {
+ .gpio = OMAP_GPIO(4,12), /* 4_12 */
+ .flags = GPIOF_IN,
+ .label = "wifi-bt-int",
+ },
+ .capability = CAPA_WIFI,
+ },
+ {
+ .name = "WIFI_RESET",
+ .pin = {
+ .gpio = OMAP_GPIO(4,11), /* 4_11 */
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "wifi-reset",
+ },
+ .capability = CAPA_WIFI,
+ .active_low = 1,
+ },
+ {
+ .name = "BT_RESET",
+ .pin = {
+ .gpio = OMAP_GPIO(4,10), /* 4_10 */
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "bt-reset",
+ },
+ .capability = CAPA_WIFI,
+ .active_low = 1,
+ },
+ {
+ .name = "USBHUB_RESET",
+ .pin = {
+ .gpio = OMAP_GPIO(3, 15),
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "usbhub-reset",
+ },
+ .active_low = 1,
+ },
+ {
+ .name = "ETH_RESET",
+ .pin = {
+ .gpio = OMAP_GPIO(4,7), /* 4_7 */
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "eth-reset",
+ }
+ .active_low = 1,
+ },
+ {
+ .name = "GNSS_INT",
+ .pin = {
+ .gpio = OMAP_GPIO(5,11), /* 5_11 */
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "gnss-int",
+ },
+ .capability = CAPA_GPS,
+ },
+ {
+ .name = "GNSS_RESET",
+ .pin = {
+ .gpio = OMAP_GPIO(5,10), /* 5_10 */
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "gnss-reset",
+ },
+ .capability = CAPA_GPS,
+ .active_low = 1,
+ },
+#if 0
+ /* Link status comes directly from the MTQ out to the baseboard */
+ {
+ .name = "LS_LED",
+ .pin = {
+ .gpio = 0,
+ .flags = GPIOF_IN,
+ .label = "led-ls",
+ },
+ .active_low = 1,
+ },
+#endif
+ {
+ .name = "STATUS_LED",
+ .pin = {
+ .gpio = OMAP_GPIO(0, 20),
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-status",
+ },
+ },
+ {
+ .name = "CD",
+ .pin = {
+ .gpio = OMAP_GPIO(0, 21),
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-cd",
+ },
+ },
+ {
+ .name = "LED1",
+ .pin = {
+ .gpio = OMAP_GPIO(4, 26),
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-sig1",
+ },
+ },
+ {
+ .name = "LED2",
+ .pin = {
+ .gpio = OMAP_GPIO(4, 27),
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-sig2",
+ },
+ },
+ {
+ .name = "LED3",
+ .pin = {
+ .gpio = OMAP_GPIO(4, 28),
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-sig3",
+ },
+ },
+ { },
+};
+
+static DEVICE_ATTR_MTS(dev_attr_wifi_reset_mtcdt3, "wifi-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_bt_reset_mtcdt3, "bt-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_int_mtcdt3, "wifi-bt-int",
+ mts_attr_show_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_gnss_reset_mtcdt3, "gnss-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_usbhub_reset_mtcdt3, "usbhub-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_eth_reset_mtcdt3, "eth-reset",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_gnss_int_mtcdt3, "gnss-int",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_lora_reset_mtcdt3, "reset",
+ mts_attr_show_lora_gpio_pin, mts_attr_store_lora_gpio_pin);
+static DEVICE_ATTR_RO_MTS(dev_attr_lora_cdone_mtcdt3, "cdone",
+ mts_attr_show_lora_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_lora_creset_mtcdt3, "creset",
+ mts_attr_show_lora_gpio_pin, mts_attr_store_lora_gpio_pin);
+static DEVICE_ATTR_RO_MTS(dev_attr_lora_eui_mtcdt3, "eui",
+ mts_attr_show_lora_product_info);
+static DEVICE_ATTR_RO_MTS(dev_attr_lora_product_id_mtcdt3, "product-id",
+ mts_attr_show_lora_product_info);
+static DEVICE_ATTR_RO_MTS(dev_attr_lora_hw_version_mtcdt3, "hw-version",
+ mts_attr_show_lora_product_info);
+
+static struct attribute *mtcdt3_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_reset.attr,
+ &dev_attr_reset_monitor.attr,
+ &dev_attr_reset_monitor_intervals.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_usbhub_reset.attr,
+ &dev_attr_eth_reset.attr,
+
+ // radio feature is last to be able to
+ // easily remove radio.
+ // is_radio_power_attr_mtcdt() searches
+ // for this for truncation.
+ &dev_attr_radio_power.attr, /* Must be first radio attribute */
+ &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,
+
+ NULL,
+};
+
+static struct attribute *mtcdt3_wifi_bt_attributes[] = {
+ &dev_attr_wifi_reset_mtcdt3.attr,
+ &dev_attr_bt_reset_mtcdt3.attr,
+ &dev_attr_wifi_bt_int_mtcdt3.attr,
+};
+
+static struct attribute *mtcdt3_gnss_attributes[] = {
+ &dev_attr_gnss_reset_mtcdt3.attr,
+ &dev_attr_gnss_int_mtcdt3.attr,
+};
+
+
+static struct attribute_group mtcdt3_platform_attribute_group = {
+ .attrs = mtcdt3_platform_attributes
+};
+
+
+static int
+is_radio_power_attr_mtcdt3(struct attribute *attr)
+{
+ return (attr == &dev_attr_radio_power.attr);
+}
+
+static struct attribute *mtcdt3_lora_attributes[] = {
+ &dev_attr_lora_eui_mtcdt3.attr,
+ &dev_attr_lora_product_id_mtcdt3.attr,
+ &dev_attr_lora_hw_version_mtcdt3.attr,
+ &dev_attr_lora_reset_mtcdt3.attr,
+ &dev_attr_lora_cdone_mtcdt3.attr,
+ &dev_attr_lora_creset_mtcdt3.attr,
+ NULL,
+};
+
+static struct attribute_group mtcdt3_lora_attribute_group = {
+ .attrs = mtcdt3_lora_attributes
+};
+
diff --git a/io-module/mths.c b/io-module/machine/mths.c
index a51380c..a51380c 100644
--- a/io-module/mths.c
+++ b/io-module/machine/mths.c
diff --git a/io-module/mtr.c b/io-module/machine/mtr.c
index e47beae..e47beae 100644
--- a/io-module/mtr.c
+++ b/io-module/machine/mtr.c
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index 5e557fd..92d29ae 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -606,10 +606,11 @@ static int get_radio_model_from_product_id(void) {
#include "mts_lora.c"
/* include per-device pins and attributes */
-#include "mtcdt.c"
-#include "mtcap.c"
-#include "mtr.c"
-#include "mths.c"
+#include "machine/mtcdt.c"
+#include "machine/mtcap.c"
+#include "machine/mtr.c"
+#include "machine/mths.c"
+#include "machine/mtcdt3.c"
/* include capabilities sub-directory support */
#include "mts_capab.c"
@@ -819,6 +820,23 @@ mts_id_eeprom_load(void)
}
set_buttons(default_buttons);
log_info("detected board %s", tmp);
+ } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTCDT3_0_0, strlen(HW_VERSION_MTCDT3_0_0)) == 0) {
+ /* Capabilities */
+ if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA)) {
+ attr_group_lora = &mtcdt3_lora_attribute_group;
+ }
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
+ attr_blength += sizeof mtcdt3_wifi_bt_attributes;
+ }
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
+ attr_blength += sizeof mtcdt3_gnss_attributes;
+ }
+
+ attr_group = &mtcdt3_platform_attribute_group;
+ gpio_pins = gpio_pins_mtcdt3;
+ set_buttons(default_buttons);
+ mts_hw_version = HW_VERSION_MTCDT3_0_0;
+ log_info("detected board %s", HW_VERSION_MTCDT3_0_0);
} else {
if(noradio) {
struct attribute **ap = mtcdt_platform_attribute_group.attrs;
diff --git a/io-module/mts_io_module.h b/io-module/mts_io_module.h
index 41a27e5..4192102 100644
--- a/io-module/mts_io_module.h
+++ b/io-module/mts_io_module.h
@@ -11,7 +11,7 @@
#define DRIVER_NAME "mts-io"
#define DEBUG 0
-
+/* Atmel AT91 Platforms */
#define PRODUCT_ID_MTCDP_E1_DK "MTCDP-E1-DK"
#define PRODUCT_ID_MT100EOCG "MT100EOCG"
#define PRODUCT_ID_MTR "MTR"
@@ -40,6 +40,11 @@
#define HW_VERSION_MTHS_0_0 "MTHS-0.0"
#define HW_VERSION_MTHS_0_1 "MTHS-0.1"
+/* TI OMAP Platforms */
+#define PRODUCT_ID_MTCDT3 "MTCDT3"
+
+#define HW_VERSION_MTCDT3_0_0 "MTCDT3-0.0"
+
enum {
MTCDP_E1_DK_0_0,
MTCDP_E1_DK_1_0,