summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-10-02 14:36:35 -0500
committerJohn Klug <john.klug@multitech.com>2020-10-02 14:36:35 -0500
commitd6780cf49e9f4c28edcb458359dd72cefad8d697 (patch)
tree64c6ae9d8989545ee3336349c5d032f4dac2b6eb
parent867a8083c4840e55fac290f2bf51fa0afc726f96 (diff)
downloadmtac-lora-d6780cf49e9f4c28edcb458359dd72cefad8d697.tar.gz
mtac-lora-d6780cf49e9f4c28edcb458359dd72cefad8d697.tar.bz2
mtac-lora-d6780cf49e9f4c28edcb458359dd72cefad8d697.zip
User generic MTAC pin names for LoRa
-rw-r--r--mtac_lora.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/mtac_lora.c b/mtac_lora.c
index fbedd7b..665bbf6 100644
--- a/mtac_lora.c
+++ b/mtac_lora.c
@@ -1,4 +1,4 @@
-#define DRIVER_VERSION "v1.1.4"
+#define DRIVER_VERSION "v1.1.5"
#define DRIVER_AUTHOR "John Klug <john.klug@multitech.com>"
#define DRIVER_DESC "MTS LoRa Accessory Card"
#define DRIVER_NAME "mtac-lora"
@@ -6,6 +6,12 @@
#include <linux/types.h>
#include <linux/gpio.h>
+#ifdef TI43X
+#include <linux/ti43x_gpio.h>
+#endif
+#ifdef SAM9G25
+#include <linux/sam9g25_gpio.h>
+#endif
#include <linux/platform_device.h>
#include <linux/kmod.h>
#include <linux/bitops.h>
@@ -14,12 +20,13 @@
#include <linux/mtac.h>
#include <linux/mts_io.h>
-static struct gpio_pin gpio_pins_mtcdt_mtac_lora_0_0[] = {
+
+static struct gpio_pin gpio_pins_mtac_lora_0_0[] = {
// gpio pins for Accessory Card 1
{
.name = "AP1_RESET",
.pin = {
- .gpio = AT91_PIN_PB12,
+ .gpio = M_AP1_NRESET,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap1-reset",
}
@@ -29,7 +36,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_0_0[] = {
{
.name = "AP2_RESET",
.pin = {
- .gpio = AT91_PIN_PB13,
+ .gpio = M_AP2_NRESET,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap2-reset",
}
@@ -37,12 +44,12 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_0_0[] = {
{ },
};
-static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = {
+static struct gpio_pin gpio_pins_mtac_lora_1_5[] = {
// gpio pins for Accessory Card 1
{
.name = "AP1_RESET",
.pin = {
- .gpio = AT91_PIN_PB12,
+ .gpio = M_AP1_NRESET,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap1-reset",
}
@@ -50,7 +57,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = {
{
.name = "AP1_CDONE",
.pin = {
- .gpio = AT91_PIN_PC6,
+ .gpio = M_AP1_GPIO1,
.flags = GPIOF_IN,
.label = "ap1-cdone",
},
@@ -58,7 +65,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = {
{
.name = "AP1_CRESET",
.pin = {
- .gpio = AT91_PIN_PC7,
+ .gpio = M_AP1_GPIO4,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap1-creset",
}
@@ -68,7 +75,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = {
{
.name = "AP2_RESET",
.pin = {
- .gpio = AT91_PIN_PB13,
+ .gpio = M_AP2_NRESET,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap2-reset",
}
@@ -76,7 +83,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = {
{
.name = "AP2_CDONE",
.pin = {
- .gpio = AT91_PIN_PC20,
+ .gpio = M_AP2_GPIO1,
.flags = GPIOF_IN,
.label = "ap2-cdone",
},
@@ -84,7 +91,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = {
{
.name = "AP2_CRESET",
.pin = {
- .gpio = AT91_PIN_PC21,
+ .gpio = M_AP2_GPIO2,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap2-creset",
}
@@ -92,12 +99,12 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = {
{ },
};
-static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = {
+static struct gpio_pin gpio_pins_mtac_lora_2g4_0_0[] = {
// gpio pins for Accessory Card 1
{
.name = "AP1_RESET",
.pin = {
- .gpio = AT91_PIN_PB12,
+ .gpio = M_AP1_NRESET,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap1-reset",
}
@@ -105,7 +112,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = {
{
.name = "AP1_BOOT",
.pin = {
- .gpio = AT91_PIN_PC6,
+ .gpio = M_AP1_GPIO1,
.flags = GPIOF_OUT_INIT_LOW,
.label = "ap1-boot",
},
@@ -115,7 +122,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = {
{
.name = "AP2_RESET",
.pin = {
- .gpio = AT91_PIN_PB13,
+ .gpio = M_AP2_NRESET,
.flags = GPIOF_OUT_INIT_HIGH,
.label = "ap2-reset",
}
@@ -123,7 +130,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = {
{
.name = "AP2_BOOT",
.pin = {
- .gpio = AT91_PIN_PC20,
+ .gpio = M_AP2_GPIO1,
.flags = GPIOF_OUT_INIT_LOW,
.label = "ap2-boot",
},
@@ -283,13 +290,13 @@ static bool lora_setup(enum ap port) {
if ((lora_hw_version == MTAC_LORA_0_0) || (lora_hw_version == MTAC_LORA_1_0)) {
ap_lora_attrs_size = ATTRS_SIZE_0_0;
- mtac_set_port_pins(port_index,gpio_pins_mtcdt_mtac_lora_0_0,subdir);
+ mtac_set_port_pins(port_index,gpio_pins_mtac_lora_0_0,subdir);
} else if ((lora_hw_version == MTAC_LORA_2G4_0_0) || (lora_hw_version == MTAC_LORA_2G4_0_0)) {
ap_lora_attrs_size = ATTRS_SIZE_2G4_0_0;
- mtac_set_port_pins(port_index,gpio_pins_mtcdt_mtac_lora_2g4_0_0,subdir);
+ mtac_set_port_pins(port_index,gpio_pins_mtac_lora_2g4_0_0,subdir);
} else {
ap_lora_attrs_size = ATTRS_SIZE_1_5;
- mtac_set_port_pins(port_index,gpio_pins_mtcdt_mtac_lora_1_5,subdir);
+ mtac_set_port_pins(port_index,gpio_pins_mtac_lora_1_5,subdir);
}