summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2014-04-24 08:36:00 -0500
committerMike Fiore <mfiore@multitech.com>2014-04-24 08:36:00 -0500
commitec92fa999d5efb9ba0a9bba169b18bcce80a4f2b (patch)
treed47346043a4dd0cc937d26ab377410bbff6afbf7
parentd8c7bd7a42f29e11b84df011da0d7ab4f465da92 (diff)
downloadmts-io-ec92fa999d5efb9ba0a9bba169b18bcce80a4f2b.tar.gz
mts-io-ec92fa999d5efb9ba0a9bba169b18bcce80a4f2b.tar.bz2
mts-io-ec92fa999d5efb9ba0a9bba169b18bcce80a4f2b.zip
mts-io: add support for 3.12 kernel and all its fun changes
this commit should build and function for mtocgd and mtocgd2 support for mtcdp and eocg platforms is not yet implemented
-rw-r--r--io-module/mts_io.c960
-rw-r--r--io-module/mts_io.h8
2 files changed, 474 insertions, 494 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index b0d2207..79351fa 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -39,6 +39,8 @@
#include <linux/spi/spi.h>
#include <linux/i2c/at24.h>
#include <linux/kmod.h>
+#include <linux/io.h>
+#include <linux/module.h>
#include "mts_io.h"
@@ -83,6 +85,8 @@ static int led_mode_status = LED_OFF;
#define SOUT_LED_SIG3_BIT BIT(6)
#define SOUT_EXTSERIAL_DCD_BIT BIT(7)
+#define AT91SAM9X5_BASE_ADC 0xf804c000
+
/* on-board EEPROM */
extern uint8_t mts_id_eeprom[512];
static struct mts_id_eeprom_layout id_eeprom;
@@ -109,6 +113,7 @@ static struct attribute_group *attr_group;
static struct gpio_pin *gpio_pins;
+/*
static struct gpio_pin gpio_pins_mtcdp_0_0[] = {
{
.name = "ENIO",
@@ -461,300 +466,301 @@ static struct gpio_pin gpio_pins_mt100eocg_0_0[] = {
},
{ },
};
+*/
static struct gpio_pin gpio_pins_mtr2_0_0[] = {
{
.name = "NETH_RST",
- .attr_name = "eth-switch-enabled",
- .pin = AT91_PIN_PC6,
- .direction = GPIO_DIR_OD,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC6,
+ .flags = GPIOF_OPEN_DRAIN | GPIOF_INIT_HIGH,
+ .label = "eth-switch-enabled",
+ },
},
{
.name = "RADIO_RESET",
- .attr_name = "radio-reset",
- .pin = AT91_PIN_PC5,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC5,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "radio-reset",
+ },
},
{
.name = "RADIO_RESET",
- .attr_name = "radio-power",
- .pin = AT91_PIN_PC5,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC5,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "radio-power",
+ },
},
{
.name = "DEVICE_RESET",
- .attr_name = "reset",
- .pin = AT91_PIN_PC4,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC4,
+ .flags = GPIOF_IN,
+ .label = "reset",
+ },
.active_low = 1,
},
{
.name = "LS_LED",
- .attr_name = "led-ls",
- .pin = AT91_PIN_PA14,
+ .pin = {
+ .gpio = AT91_PIN_PA14,
#if LED_LS_CONTROLLABLE
- .direction = GPIO_DIR_OUTPUT,
+ .flags = GPIOF_OUT_INIT_HIGH,
#else
- .direction = GPIO_DIR_INPUT,
+ .flags = GPIOF_IN,
#endif
- .output_value = 1,
- .use_pullup = 0,
+ .label = "led-ls",
+ },
.active_low = 1,
},
{
.name = "STATUS_LED",
- .attr_name = "led-status",
- .pin = AT91_PIN_PA24,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA24,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-status",
+ },
.active_low = 1,
},
{
.name = "LED7",
- .attr_name = "led-cd",
- .pin = AT91_PIN_PA25,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA25,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-cd",
+ },
.active_low = 1,
},
{
.name = "LED7",
- .attr_name = "led-c",
- .pin = AT91_PIN_PA25,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA25,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-c",
+ },
.active_low = 1,
},
{
.name = "LED10",
- .attr_name = "led-sig1",
- .pin = AT91_PIN_PA26,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA26,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig1",
+ },
.active_low = 1,
},
{
.name = "LED10",
- .attr_name = "led-d",
- .pin = AT91_PIN_PA26,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA26,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-d",
+ },
.active_low = 1,
},
{
.name = "LED11",
- .attr_name = "led-sig2",
- .pin = AT91_PIN_PA27,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA27,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig2",
+ },
.active_low = 1,
},
{
.name = "LED11",
- .attr_name = "led-e",
- .pin = AT91_PIN_PA27,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA27,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-e",
+ },
.active_low = 1,
},
{
.name = "LED12",
- .attr_name = "led-sig3",
- .pin = AT91_PIN_PA28,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA28,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig3",
+ },
.active_low = 1,
},
{
.name = "LED12",
- .attr_name = "led-f",
- .pin = AT91_PIN_PA28,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA28,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-f",
+ },
.active_low = 1,
},
{
.name = "LED13",
- .attr_name = "led-wifi",
- .pin = AT91_PIN_PA29,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA29,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-wifi",
+ },
.active_low = 1,
},
{
.name = "LED13",
- .attr_name = "led-b",
- .pin = AT91_PIN_PA29,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA29,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-b",
+ },
.active_low = 1,
},
{
.name = "UART3_DTR",
- .attr_name = "extserial-dtr",
- .pin = AT91_PIN_PC12,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC12,
+ .flags = GPIOF_IN,
+ .label = "extserial-dtr",
+ },
.active_low = 1,
},
{
.name = "UART3_DSR",
- .attr_name = "extserial-dsr",
- .pin = AT91_PIN_PC11,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC11,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dsr",
+ },
.active_low = 1,
},
{
.name = "UART3_DCD",
- .attr_name = "extserial-dcd",
- .pin = AT91_PIN_PC10,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC10,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dcd",
+ },
.active_low = 1,
},
{
.name = "UART3_RI",
- .attr_name = "extserial-ri",
- .pin = AT91_PIN_PC13,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC13,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-ri",
+ },
.active_low = 1,
},
{
.name = "NDC_RESET",
- .attr_name = "ndc-reset",
- .pin = AT91_PIN_PC3,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC3,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "ndc-reset",
+ },
},
{
.name = "NDC_EEPROM_WRITE_PROTECT",
- .attr_name = "ndc-eeprom-wp",
- .pin = AT91_PIN_PC26,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC26,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "ndc-eeprom-wp",
+ },
},
{
.name = "BT_EN",
- .attr_name = "bt-enabled",
- .pin = AT91_PIN_PD21,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PD21,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "bt-enabled",
+ },
},
{
.name = "WLAN_EN",
- .attr_name = "wlan-enabled",
- .pin = AT91_PIN_PC1,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC1,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "wlan-enabled",
+ },
},
{
.name = "SERIAL_MODE0",
- .attr_name = "serial_mode",
- .pin = AT91_PIN_PC23,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC23,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serial-mode",
+ },
},
{
.name = "SERIAL_MODE1",
- .attr_name = "serial_mode",
- .pin = AT91_PIN_PC24,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC24,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serial-mode",
+ },
},
{
.name = "SERIAL_MODE2",
- .attr_name = "serial_mode",
- .pin = AT91_PIN_PC25,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC25,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serial-mode",
+ },
},
{
.name = "RS4XX_TERM_RES",
- .attr_name = "rs4xx-term-res",
- .pin = AT91_PIN_PC26,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC26,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "rs4xx-term-res",
+ },
},
{
.name = "NDC_GPIO1",
- .attr_name = "dc-gpio1",
- .pin = AT91_PIN_PC0,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC0,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "dc-gpio1",
+ },
},
{
.name = "NDC_GPIO2",
- .attr_name = "dc-gpio2",
- .pin = AT91_PIN_PC14,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC14,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "dc-gpio2",
+ },
},
{
.name = "NDC_GPIO3",
- .attr_name = "dc-gpio3",
- .pin = AT91_PIN_PC29,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC29,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "dc-gpio3",
+ },
},
{
.name = "NDC_GPIO4",
- .attr_name = "dc-gpio4",
- .pin = AT91_PIN_PC30,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC30,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "dc-gpio4",
+ },
},
{
.name = "NDC_INTERRUPT1",
- .attr_name = "dc-int1",
- .pin = AT91_PIN_PC20,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC20,
+ .flags = GPIOF_IN,
+ .label = "dc-int1",
+ },
},
{
.name = "NDC_INTERRUPT2",
- .attr_name = "dc-int2",
- .pin = AT91_PIN_PC21,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC21,
+ .flags = GPIOF_IN,
+ .label = "dc-int2",
+ },
},
{ },
};
@@ -762,209 +768,208 @@ static struct gpio_pin gpio_pins_mtr2_0_0[] = {
static struct gpio_pin gpio_pins_mtr_0_0[] = {
{
.name = "NETH_RST",
- .attr_name = "eth0-enabled",
- .pin = AT91_PIN_PC6,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC6,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "eth0-enabled",
+ },
},
{
.name = "PWRMON",
- .attr_name = "radio-power",
- .pin = AT91_PIN_PA23,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
- .active_low = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA23,
+ .flags = GPIOF_IN,
+ .label = "radio-power",
+ },
},
{
.name = "3G_RST",
- .attr_name = "radio-reset",
- .pin = AT91_PIN_PA22,
- .direction = GPIO_DIR_OD,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA22,
+ .flags = GPIOF_OPEN_DRAIN | GPIOF_INIT_HIGH,
+ .label = "radio-reset",
+ },
},
{
.name = "3G_ONOFF",
- .attr_name = "radio-enabled",
- .pin = AT91_PIN_PA21,
- .direction = GPIO_DIR_OD,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA21,
+ .flags = GPIOF_OPEN_DRAIN | GPIOF_INIT_HIGH,
+ .label = "radio-enabled",
+ },
},
{
.name = "DEVICE_RESET",
- .attr_name = "reset",
- .pin = AT91_PIN_PC4,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC4,
+ .flags = GPIOF_IN,
+ .label = "reset",
+ },
.active_low = 1,
},
{
.name = "LS_LED",
- .attr_name = "led-ls",
- .pin = AT91_PIN_PC16,
+ .pin = {
+ .gpio = AT91_PIN_PC16,
#if LED_LS_CONTROLLABLE
- .direction = GPIO_DIR_OUTPUT,
+ .flags = GPIOF_OUT_INIT_HIGH,
#else
- .direction = GPIO_DIR_INPUT,
+ .flags = GPIOF_IN,
#endif
- .output_value = 1,
- .use_pullup = 0,
+ .label = "led-ls",
+ },
.active_low = 1,
},
{
.name = "STATUS_LED",
- .attr_name = "led-status",
- .pin = AT91_PIN_PC21,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC21,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-status",
+ },
.active_low = 1,
},
{
.name = "LED3",
- .attr_name = "led-wifi",
- .pin = AT91_PIN_PC15,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC15,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-wifi",
+ },
.active_low = 1,
},
{
.name = "LED3",
- .attr_name = "led-b",
- .pin = AT91_PIN_PC15,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC15,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-b",
+ },
.active_low = 1,
},
{
.name = "LED4",
- .attr_name = "led-cd",
- .pin = AT91_PIN_PC20,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC20,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-cd",
+ },
.active_low = 1,
},
{
.name = "LED4",
- .attr_name = "led-c",
- .pin = AT91_PIN_PC20,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC20,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-c",
+ },
.active_low = 1,
},
{
.name = "LED6",
- .attr_name = "led-sig1",
- .pin = AT91_PIN_PC19,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC19,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig1",
+ },
.active_low = 1,
},
{
.name = "LED6",
- .attr_name = "led-d",
- .pin = AT91_PIN_PC19,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC19,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-d",
+ },
.active_low = 1,
},
{
.name = "LED7",
- .attr_name = "led-sig2",
- .pin = AT91_PIN_PC18,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC18,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig2",
+ },
.active_low = 1,
},
{
.name = "LED7",
- .attr_name = "led-e",
- .pin = AT91_PIN_PC18,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC18,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-e",
+ },
.active_low = 1,
},
{
.name = "LED8",
- .attr_name = "led-sig3",
- .pin = AT91_PIN_PC17,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC17,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig3",
+ },
.active_low = 1,
},
{
.name = "LED8",
- .attr_name = "led-f",
- .pin = AT91_PIN_PC17,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC17,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-f",
+ },
.active_low = 1,
},
{
.name = "RI_B",
- .attr_name = "extserial-ri",
- .pin = AT91_PIN_PC25,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC25,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-ri",
+ },
.active_low = 1,
},
{
.name = "DTR_B",
- .attr_name = "extserial-dtr",
- .pin = AT91_PIN_PC26,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC26,
+ .flags = GPIOF_IN,
+ .label = "extserial-dtr",
+ },
.active_low = 1,
},
{
.name = "DSR_B",
- .attr_name = "extserial-dsr",
- .pin = AT91_PIN_PC27,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC27,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dsr",
+ },
.active_low = 1,
},
{
.name = "DCD_B",
- .attr_name = "extserial-dcd",
- .pin = AT91_PIN_PC28,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC28,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dcd",
+ },
.active_low = 1,
},
{
.name = "BT_EN",
- .attr_name = "bt-enabled",
- .pin = AT91_PIN_PA28,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA28,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "bt-enabled",
+ },
},
{
.name = "WLAN_EN",
- .attr_name = "wlan-enabled",
- .pin = AT91_PIN_PA27,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA27,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "wlan-enabled",
+ },
},
{ },
};
@@ -972,209 +977,208 @@ static struct gpio_pin gpio_pins_mtr_0_0[] = {
static struct gpio_pin gpio_pins_mtr_0_1[] = {
{
.name = "NETH_RST",
- .attr_name = "eth0-enabled",
- .pin = AT91_PIN_PC6,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC6,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "eth0-enabled",
+ },
},
{
.name = "PWRMON",
- .attr_name = "radio-power",
- .pin = AT91_PIN_PA23,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
- .active_low = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA23,
+ .flags = GPIOF_IN,
+ .label = "radio-power",
+ },
},
{
.name = "3G_RST",
- .attr_name = "radio-reset",
- .pin = AT91_PIN_PA22,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 1,
+ .pin = {
+ .gpio = AT91_PIN_PA22,
+ .flags = GPIOF_OUT_INIT_HIGH | GPIOF_PULLUP,
+ .label = "radio-reset",
+ },
},
{
.name = "3G_ONOFF",
- .attr_name = "radio-enabled",
- .pin = AT91_PIN_PA21,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 1,
+ .pin = {
+ .gpio = AT91_PIN_PA21,
+ .flags = GPIOF_OUT_INIT_HIGH | GPIOF_PULLUP,
+ .label = "radio-enabled",
+ },
},
{
.name = "DEVICE_RESET",
- .attr_name = "reset",
- .pin = AT91_PIN_PC4,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC4,
+ .flags = GPIOF_IN,
+ .label = "reset",
+ },
.active_low = 1,
},
{
.name = "LS_LED",
- .attr_name = "led-ls",
- .pin = AT91_PIN_PC16,
+ .pin = {
+ .gpio = AT91_PIN_PC16,
#if LED_LS_CONTROLLABLE
- .direction = GPIO_DIR_OUTPUT,
+ .flags = GPIOF_OUT_INIT_HIGH,
#else
- .direction = GPIO_DIR_INPUT,
+ .flags = GPIOF_IN,
#endif
- .output_value = 1,
- .use_pullup = 0,
+ .label = "led-ls",
+ },
.active_low = 1,
},
{
.name = "STATUS_LED",
- .attr_name = "led-status",
- .pin = AT91_PIN_PC21,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC21,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "led-status",
+ },
.active_low = 1,
},
{
.name = "LED3",
- .attr_name = "led-wifi",
- .pin = AT91_PIN_PC15,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC15,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-wifi",
+ },
.active_low = 1,
},
{
.name = "LED3",
- .attr_name = "led-b",
- .pin = AT91_PIN_PC15,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC15,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-b",
+ },
.active_low = 1,
},
{
.name = "LED4",
- .attr_name = "led-cd",
- .pin = AT91_PIN_PC20,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC20,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-cd",
+ },
.active_low = 1,
},
{
.name = "LED4",
- .attr_name = "led-c",
- .pin = AT91_PIN_PC20,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC20,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-c",
+ },
.active_low = 1,
},
{
.name = "LED6",
- .attr_name = "led-sig1",
- .pin = AT91_PIN_PC19,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC19,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig1",
+ },
.active_low = 1,
},
{
.name = "LED6",
- .attr_name = "led-d",
- .pin = AT91_PIN_PC19,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC19,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-d",
+ },
.active_low = 1,
},
{
.name = "LED7",
- .attr_name = "led-sig2",
- .pin = AT91_PIN_PC18,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC18,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig2",
+ },
.active_low = 1,
},
{
.name = "LED7",
- .attr_name = "led-e",
- .pin = AT91_PIN_PC18,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC18,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-e",
+ },
.active_low = 1,
},
{
.name = "LED8",
- .attr_name = "led-sig3",
- .pin = AT91_PIN_PC17,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC17,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-sig3",
+ },
.active_low = 1,
},
{
.name = "LED8",
- .attr_name = "led-f",
- .pin = AT91_PIN_PC17,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC17,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "led-f",
+ },
.active_low = 1,
},
{
.name = "RI_B",
- .attr_name = "extserial-ri",
- .pin = AT91_PIN_PC25,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC25,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-ri",
+ },
.active_low = 1,
},
{
.name = "DTR_B",
- .attr_name = "extserial-dtr",
- .pin = AT91_PIN_PC26,
- .direction = GPIO_DIR_INPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC26,
+ .flags = GPIOF_IN,
+ .label = "extserial-dtr",
+ },
.active_low = 1,
},
{
.name = "DSR_B",
- .attr_name = "extserial-dsr",
- .pin = AT91_PIN_PC27,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC27,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dsr",
+ },
.active_low = 1,
},
{
.name = "DCD_B",
- .attr_name = "extserial-dcd",
- .pin = AT91_PIN_PC28,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PC28,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "extserial-dcd",
+ },
.active_low = 1,
},
{
.name = "BT_EN",
- .attr_name = "bt-enabled",
- .pin = AT91_PIN_PA28,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA28,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "bt-enabled",
+ },
},
{
.name = "WLAN_EN",
- .attr_name = "wlan-enabled",
- .pin = AT91_PIN_PA27,
- .direction = GPIO_DIR_OUTPUT,
- .output_value = 0,
- .use_pullup = 0,
+ .pin = {
+ .gpio = AT91_PIN_PA27,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "wlan-enabled",
+ },
},
{ },
};
@@ -1197,7 +1201,7 @@ struct gpio_pin *gpio_pin_by_attr_name(const char *name) {
struct gpio_pin *pin;
for (pin = gpio_pins; *pin->name; pin++) {
- if (!strcmp(pin->attr_name, name)) {
+ if (!strcmp(pin->pin.label, name)) {
return pin;
}
}
@@ -1361,7 +1365,7 @@ static void blink_callback(struct work_struct *ignored)
pin = gpio_pin_by_name("DEVICE_RESET");
if (pin) {
- reset_pressed = !at91_get_gpio_value(pin->pin);
+ reset_pressed = !gpio_get_value(pin->pin.gpio);
}
if (reset_pid > 0) {
@@ -1393,7 +1397,7 @@ static void blink_callback(struct work_struct *ignored)
if (led_mode_status == LED_FLASHING) {
pin = gpio_pin_by_name("STATUS_LED");
if (pin) {
- at91_set_gpio_value(pin->pin, !at91_get_gpio_value(pin->pin));
+ gpio_set_value(pin->pin.gpio, !gpio_get_value(pin->pin.gpio));
}
}
@@ -1413,7 +1417,7 @@ static int radio_off_telit(void)
return -ENODEV;
}
- value = at91_get_gpio_value(pwrmon_pin->pin);
+ value = gpio_get_value(pwrmon_pin->pin.gpio);
if(value == 0) {
log_error("radio is already off");
return -EINVAL;
@@ -1421,7 +1425,7 @@ static int radio_off_telit(void)
// drive on/off pin low for at least 3 sec
log_info("shutting down radio");
- ret = at91_set_gpio_output_with_pullup(onoff_pin->pin, 0, onoff_pin->use_pullup);
+ ret = gpio_direction_output_pullup(onoff_pin->pin.gpio, 0, onoff_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1429,7 +1433,7 @@ static int radio_off_telit(void)
msleep(3500);
// set on/off pin high
- ret = at91_set_gpio_output_with_pullup(onoff_pin->pin, 1, onoff_pin->use_pullup);
+ ret = gpio_direction_output_pullup(onoff_pin->pin.gpio, 1, onoff_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1438,11 +1442,11 @@ static int radio_off_telit(void)
msleep(5000);
// check that power is low
- value = at91_get_gpio_value(pwrmon_pin->pin);
+ value = gpio_get_value(pwrmon_pin->pin.gpio);
if(value != 0) {
log_warning("radio is still on. performing radio reset.");
//Perform Hard Reset
- ret = at91_set_gpio_output_with_pullup(rst_pin->pin, 0, rst_pin->use_pullup);
+ ret = gpio_direction_output_pullup(rst_pin->pin.gpio, 0, rst_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1450,7 +1454,7 @@ static int radio_off_telit(void)
msleep(500);
// set pin high
- ret = at91_set_gpio_output_with_pullup(rst_pin->pin, 1, rst_pin->use_pullup);
+ ret = gpio_direction_output_pullup(rst_pin->pin.gpio, 1, rst_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1472,7 +1476,7 @@ static int radio_on_telit(void)
return -ENODEV;
}
- value = at91_get_gpio_value(pwrmon_pin->pin);
+ value = gpio_get_value(pwrmon_pin->pin.gpio);
if(value != 0) {
log_error("radio is already on");
return -EINVAL;
@@ -1480,7 +1484,7 @@ static int radio_on_telit(void)
// drive on/off pin low for at least 5 sec
log_info("turning on radio");
- ret = at91_set_gpio_output_with_pullup(onoff_pin->pin, 0, onoff_pin->use_pullup);
+ ret = gpio_direction_output_pullup(onoff_pin->pin.gpio, 0, onoff_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1488,7 +1492,7 @@ static int radio_on_telit(void)
msleep(5500);
// set on/off pin high
- ret = at91_set_gpio_output_with_pullup(onoff_pin->pin, 1, onoff_pin->use_pullup);
+ ret = gpio_direction_output_pullup(onoff_pin->pin.gpio, 1, onoff_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1496,11 +1500,11 @@ static int radio_on_telit(void)
msleep(200);
// check that power is high
- value = at91_get_gpio_value(pwrmon_pin->pin);
+ value = gpio_get_value(pwrmon_pin->pin.gpio);
if(value == 0) {
log_warning("radio is still off. performing radio reset");
//Perform Hard Reset
- ret = at91_set_gpio_output_with_pullup(rst_pin->pin, 0, rst_pin->use_pullup);
+ ret = gpio_direction_output_pullup(rst_pin->pin.gpio, 0, rst_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1508,7 +1512,7 @@ static int radio_on_telit(void)
msleep(500);
// set pin high
- ret = at91_set_gpio_output_with_pullup(rst_pin->pin, 1, rst_pin->use_pullup);
+ ret = gpio_direction_output_pullup(rst_pin->pin.gpio, 1, rst_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1556,7 +1560,7 @@ static int radio_reset_telit(void)
}
// drive reset pin low for 500ms
- ret = at91_set_gpio_output_with_pullup(rst_pin->pin, 0, rst_pin->use_pullup);
+ ret = gpio_direction_output_pullup(rst_pin->pin.gpio, 0, rst_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1564,7 +1568,7 @@ static int radio_reset_telit(void)
msleep(500);
// set pin high
- ret = at91_set_gpio_output_with_pullup(rst_pin->pin, 1, rst_pin->use_pullup);
+ ret = gpio_direction_output_pullup(rst_pin->pin.gpio, 1, rst_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1573,7 +1577,7 @@ static int radio_reset_telit(void)
msleep(2000);
// drive on/off pin low for 6 sec
- ret = at91_set_gpio_output_with_pullup(onoff_pin->pin, 0, onoff_pin->use_pullup);
+ ret = gpio_direction_output_pullup(onoff_pin->pin.gpio, 0, onoff_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;
}
@@ -1581,7 +1585,7 @@ static int radio_reset_telit(void)
msleep(6000);
// set on/off pin high
- ret = at91_set_gpio_output_with_pullup(onoff_pin->pin, 1, onoff_pin->use_pullup);
+ ret = gpio_direction_output_pullup(onoff_pin->pin.gpio, 1, onoff_pin->pin.flags & GPIOF_PULLUP);
if (ret) {
return ret;