From 49ca346b1165e6def3e683802cfbb769d23c559a Mon Sep 17 00:00:00 2001 From: Mike Nicholson Date: Fri, 28 Aug 2020 16:36:45 -0500 Subject: MTCAP2, MTCDTIP2 support, initial revision --- io-module/machine/mtcap.c | 79 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) (limited to 'io-module/machine') diff --git a/io-module/machine/mtcap.c b/io-module/machine/mtcap.c index bd08d5a..f701e93 100644 --- a/io-module/machine/mtcap.c +++ b/io-module/machine/mtcap.c @@ -70,8 +70,53 @@ static struct gpio_pin gpio_pins_mtcap_0_0[] = { }, .capability = CAPA_LORA, }, - - + { + .name = "GNSS_RESET", + .pin = { + .gpio = AT91_PIN_PD15, + .flags = GPIOF_OUT_INIT_LOW, + .label = "gnss-reset", + }, + .capability = CAPA_GPS, + }, + { + .name = "GNSS_INT", + .pin = { + .gpio = AT91_PIN_PD19, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "gnss-int", + }, + .capability = CAPA_GPS, + }, + { + .name = "ALLOW_RESET", + .pin = { + .gpio = AT91_PIN_PC26, + .flags = GPIOF_OUT_INIT_HIGH, + .label = "allow-reset", + }, + .active_low = 1, + .capability = CAPA_SUPERCAP, + }, + { + .name = "POWER_FAIL", + .pin = { + .gpio = AT91_PIN_PC14, + .flags = GPIOF_IN, + .label = "power-fail", + }, + .active_low = 1, + .capability = CAPA_SUPERCAP, + }, + { + .name = "SUPERCAP_FULL", + .pin = { + .gpio = AT91_PIN_PC27, + .flags = GPIOF_IN, + .label = "supercap-full", + }, + .capability = CAPA_SUPERCAP, + }, /* LEDs */ { .name = "STATUS_LED", // DEV_LED_GN @@ -116,6 +161,7 @@ static struct gpio_pin gpio_pins_mtcap_0_0[] = { .flags = GPIOF_OUT_INIT_HIGH, .label = "wlan-en", }, + .capability = CAPA_WIFI, }, { .name = "WLAN_RST", @@ -124,6 +170,7 @@ static struct gpio_pin gpio_pins_mtcap_0_0[] = { .flags = GPIOF_OUT_INIT_HIGH, .label = "wlan-rst", }, + .capability = CAPA_WIFI, }, { }, }; @@ -461,9 +508,6 @@ static struct attribute *mtcap_0_0_platform_attributes[] = { &dev_attr_led_lora_gpio_mtcap.attr, &dev_attr_led_wifi_gpio_mtcap.attr, - &dev_attr_wlan_en_gpio_mtcap.attr, - &dev_attr_wlan_rst_gpio_mtcap.attr, - /* Set to NULL if no radio -- should be 1st radio attribute */ &dev_attr_radio_power_mtcap.attr, &dev_attr_radio_reset_mtcap.attr, @@ -534,3 +578,28 @@ static struct attribute *mtcdtiphp_0_0_lora_attributes[] = { static struct attribute_group mtcdtiphp_0_0_lora_attribute_group = { .attrs = mtcdtiphp_0_0_lora_attributes }; + +static struct attribute *mtcap_0_3_gnss_attributes[] = { + &dev_attr_gnss_reset.attr, + &dev_attr_gnss_int.attr, +}; + +static DEVICE_ATTR_MTS(dev_attr_supercap_allow_reset_mtcap, "allow-reset", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_RO_MTS(dev_attr_supercap_power_fail_mtcap, "power-fail", + mts_attr_show_gpio_pin); + +static DEVICE_ATTR_RO_MTS(dev_attr_supercap_supercap_full_mtcap, "supercap-full", + mts_attr_show_gpio_pin); + +static struct attribute *mtcap_0_3_supercap_attributes[] = { + &dev_attr_supercap_allow_reset_mtcap.attr, + &dev_attr_supercap_power_fail_mtcap.attr, + &dev_attr_supercap_supercap_full_mtcap.attr, +}; + +static struct attribute *mtcap_0_0_wifi_attributes[] = { + &dev_attr_wlan_en_gpio_mtcap.attr, + &dev_attr_wlan_rst_gpio_mtcap.attr, +}; -- cgit v1.2.3