summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io-module/mt100eocg.c14
-rw-r--r--io-module/mts-io.c25
-rw-r--r--io-module/spi.c11
3 files changed, 38 insertions, 12 deletions
diff --git a/io-module/mt100eocg.c b/io-module/mt100eocg.c
index 786b24c..00eaaf7 100644
--- a/io-module/mt100eocg.c
+++ b/io-module/mt100eocg.c
@@ -1,6 +1,14 @@
#include "at91gpio.h"
/* Used for both MT100EOCG 0.0 */
-static struct gpio_pin gpio_pins_mt100eocg_0_0[] = {
+static struct gpio_pin gpio_pins_mt100eocg_0_0[] = {
+ {
+ .name = "ENIO",
+ .pin = {
+ .label = "enio",
+ .gpio = AT91_PIN_PC15,
+ .flags = GPIOF_OUT_INIT_LOW,
+ },
+ },
{
.name = "DEVICE_RESET",
.pin = {
@@ -143,6 +151,9 @@ static struct gpio_pin gpio_pins_mt100eocg_0_0[] = {
};
/* mt100eocg specific attributes */
+static DEVICE_ATTR_MTS(dev_attr_enio, "enio",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+
static DEVICE_ATTR_MTS(dev_attr_gpo1, "gpo1",
mts_attr_show_dout, mts_attr_store_dout);
static DEVICE_ATTR_MTS(dev_attr_gpo2, "gpo2",
@@ -198,6 +209,7 @@ static struct attribute *mt100eocg_platform_attributes[] = {
// &dev_attr_eth0_enabled.attr,
&dev_attr_gpio11.attr, // AT91_PIN_PB19
&dev_attr_gpio12.attr, // AT91_PIN_PB20
+ &dev_attr_enio.attr,
// SPI
&dev_attr_gpo1.attr,
&dev_attr_gpo2.attr,
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index 6899aac..489f0d5 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -969,6 +969,23 @@ static int __init mts_io_init(void)
return ret;
}
+ if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) {
+ ret = spi_register_driver(&mts_spi_dout_driver);
+ if (ret) {
+ printk(KERN_ERR "mts-io:mts-io-dout: probe failed: %d\n", ret);
+ }
+ }
+ if (DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) {
+ ret = spi_register_driver(&mts_spi_din_driver);
+ if (ret) {
+ printk(KERN_ERR "mts-io:mts-io-din: probe failed: %d\n", ret);
+ }
+ }
+ ret = spi_register_driver(&mts_spi_board_temp_driver);
+ if (ret) {
+ printk(KERN_ERR "mts-io:mts-io-board-temp: probe failed: %d\n", ret);
+ }
+
if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) && attr_group_lora) {
mts_load_lora_port();
}
@@ -1004,6 +1021,14 @@ static int __init mts_io_init(void)
static void __exit mts_io_exit(void)
{
+ if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) {
+ spi_unregister_driver(&mts_spi_dout_driver);
+ }
+ if (DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) {
+ spi_unregister_driver(&mts_spi_din_driver);
+ }
+ spi_unregister_driver(&mts_spi_board_temp_driver);
+
struct gpio_pin *pin;
/* delete radio_reset_timer */
del_timer(&radio_reset_timer);
diff --git a/io-module/spi.c b/io-module/spi.c
index 210371c..1244cfc 100644
--- a/io-module/spi.c
+++ b/io-module/spi.c
@@ -484,11 +484,6 @@ static int mts_spi_dout_probe(struct spi_device *spi)
{
int tmp;
- if (!DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) {
- log_debug("digital outputs not available");
- return -ENODEV;
- }
-
spi->max_speed_hz = dout_max_speed_hz;
spi->mode = 0;
@@ -529,12 +524,6 @@ static struct spi_driver mts_spi_dout_driver = {
static int mts_spi_din_probe(struct spi_device *spi)
{
int tmp;
-
- if (!DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) {
- log_debug("digital inputs not available");
- return -ENODEV;
- }
-
spi->max_speed_hz = din_max_speed_hz;
spi->mode = SPI_CPOL;