summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2022-02-28 16:53:09 -0600
committerJohn Klug <john.klug@multitech.com>2022-02-28 18:49:44 -0600
commitf0d840d1902b8f09687d253c793bee7ad9624c3f (patch)
tree722ffb274186e3d54c0dacd05ed59b7e15122603
parentfb1341ca0996b26fc95857a4763e3bc6d94db24d (diff)
downloadmtac-pulse-2.0.0.tar.gz
mtac-pulse-2.0.0.tar.bz2
mtac-pulse-2.0.0.zip
Move MTAC-PULSE to GPIO descriptor library in the kernelHEAD2.0.0master
-rw-r--r--AUTHORS3
-rw-r--r--README33
-rw-r--r--mtac_pulse.c65
3 files changed, 50 insertions, 51 deletions
diff --git a/AUTHORS b/AUTHORS
index 38df722..d338ebe 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,2 +1 @@
-Gary Cole <garycole@connecteddev.com>
-John Klug <john.klug@multitech.com>
+Multi-Tech <info@multitech.com>
diff --git a/README b/README
index fa298b0..787c4ff 100644
--- a/README
+++ b/README
@@ -6,11 +6,34 @@ This driver requires the mtac.ko driver
loaded first. depmod should take care
of this.
-Documentation for this board is here:
+This driver used to attempt to set "open drain" from
+the GPIO driver. This is not allowed by the Atmel
+GPIO driver. In newer kernels it warns that this
+does not work. Open drain must be set by the
+Atmel pinctrl driver for Atmel GPIO controllers.
-http://www.multitech.net/developer/software/mlinux/using-mlinux/mlinux-using-accessory-cards/mtac-pulse-usage/
+Atmel calls "Open Drain" "MultiDriver".
-An init script can look in:
-/lib/modules/$(uname -r)/extra/mtac_xdot.ko
+The lack of multidrive was verified in
+kernel 3.12.70, mLinux 4.1.1 with MTAC-PULSE-BP
+in slot AP1. The pin for AP1_NRESET is PB12.
+The AP2_NRESET is PB13.
-to find the driver.
+The device address for PIOB is 0xFFFF F600.
+The offset for register PIO_MDSR is 0x58.
+PIO_MDSR is Multi-Driver Status Register, and
+Multi-Driver is what Atmel calls Open Drain.
+
+ mtcdt:/home/mtadm# devmem2 0xfffff658 * /dev/mem opened.
+ Memory mapped at address 0xb6f35000.
+ Read at address 0xFFFFF658 (0xb6f35658): 0x00000000
+
+This says that in 4.1.1 mLinux, no outputs for PIOB
+are set to multi-driver.
+
+ mtcdt:/sys/devices/platform/mts-io/ap1# cat hw-version
+ MTAC-PULSE-0.0
+
+pinctrl settings must be done in device tree for Atmel
+processors when trying to set pull-up, pull-down, or
+multi-drive.
diff --git a/mtac_pulse.c b/mtac_pulse.c
index 569e640..ac58f5e 100644
--- a/mtac_pulse.c
+++ b/mtac_pulse.c
@@ -1,10 +1,9 @@
-#define DRIVER_VERSION "v1.1.1"
+#define DRIVER_VERSION "v2.0.0"
#define DRIVER_AUTHOR "Multi-Tech"
#define DRIVER_DESC "MTAC Pulse Accessory Card"
#define DRIVER_NAME "mtac-pulse"
#include <linux/types.h>
-#include <linux/gpio.h>
#include <linux/platform_device.h>
#include <linux/kmod.h>
#include <linux/bitops.h>
@@ -12,67 +11,56 @@
#include <linux/slab.h>
#include <linux/mtac.h>
#include <linux/mts_io.h>
-#ifdef TI43X
-#include <linux/ti43x_gpio.h>
-#endif
-#ifdef SAM9G25
-#include <linux/sam9g25_gpio.h>
-#endif
+#include <linux/gpio/consumer.h>
/**********************************************************************
* COPYRIGHT 2012-2018 CONNECTED DEVELOPMENT, LLC
*
- * ALL RIGHTS RESERVED BY AND FOR THE EXCLUSIVE BENEFIT OF
- * CONNECTED DEVELOPMENT, LLC.
- *
- * CONNECTED DEVELOPMENT, LLC - CONFIDENTIAL AND PROPRIETARY
- * INFORMATION AND/OR TRADE SECRET.
- *
- * NOTICE: ALL CODE, PROGRAM, INFORMATION, SCRIPT, INSTRUCTION,
- * DATA, AND COMMENT HEREIN IS AND SHALL REMAIN THE CONFIDENTIAL
- * INFORMATION AND PROPERTY OF CONNECTED DEVELOPMENT, LLC.
- * USE AND DISCLOSURE THEREOF, EXCEPT AS STRICTLY AUTHORIZED IN A
- * WRITTEN AGREEMENT SIGNED BY CONNECTED DEVELOPMENT, LLC IS PROHIBITED.
- *
+ * Copyright 2022 Multi-Tech Systems
***********************************************************************/
static struct gpio_pin gpio_pins_mtac_pulse[] = {
// gpio pins for Accessory Card 1
{
- .name = "AP1_RESET",
+ .name = "AP1_NRESET",
.pin = {
- .gpio = M_AP1_NRESET,
- .flags = GPIOF_OUT_INIT_HIGH,
+ .gpio = ~0U,
+ .flags = GPIOD_OUT_HIGH, /* Not setting Open-Drain see README */
.label = "ap1-reset",
- }
+ },
+ .do_gpio_desc = 1,
},
{
.name = "AP1_GPIO1",
.pin = {
- .gpio = M_AP1_GPIO1,
- .flags = GPIOF_OUT_INIT_LOW,
+ .gpio = ~0,
+ .flags = GPIOD_OUT_LOW,
.label = "ap1-gpio1",
},
+ .do_gpio_desc = 1,
.active_low = 1,
},
// gpio pins for Accessory Card 2
{
- .name = "AP2_RESET",
+ .name = "AP2_NRESET",
.pin = {
- .gpio = M_AP1_NRESET,
- .flags = GPIOF_OUT_INIT_HIGH,
+ .gpio = ~0,
+ .flags = GPIOD_OUT_HIGH, /* Not setting Open-Drain see README */
.label = "ap2-reset",
- }
+ },
+ .do_gpio_desc = 1,
},
{
.name = "AP2_GPIO1",
.pin = {
- .gpio = M_AP2_GPIO1,
- .flags = GPIOF_OUT_INIT_LOW,
+ .gpio = ~0,
+ .flags = GPIOD_OUT_LOW,
.label = "ap2-gpio1",
},
+ .do_gpio_desc = 1,
.active_low = 1,
- }
+ },
+ {},
};
static char* pulse_gpio_pin_name_by_attr_name(const char *name, int port) {
@@ -211,17 +199,6 @@ static bool pulse_setup(enum ap port) {
return false;
}
- /* override ap_reset output mode to open drain */
- if (port == 1) {
- res = gpio_request_one(M_AP1_NRESET, GPIOF_OUT_INIT_HIGH | GPIOF_OPEN_DRAIN, "ap1-reset");
- } else {
- res = gpio_request_one(M_AP2_NRESET, GPIOF_OUT_INIT_HIGH | GPIOF_OPEN_DRAIN, "ap2-reset");
- }
- if (res != 0)
- {
- log_error("failed to change ap%d_reset to open drain output", port);
- }
-
return true;
}