From ec92fa999d5efb9ba0a9bba169b18bcce80a4f2b Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Thu, 24 Apr 2014 08:36:00 -0500 Subject: 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 --- io-module/mts_io.c | 960 ++++++++++++++++++++++++++--------------------------- io-module/mts_io.h | 8 +- 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 #include #include +#include +#include #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; } @@ -1591,44 +1595,36 @@ static int radio_reset_telit(void) static int radio_reset(void) { - int ret; struct gpio_pin *pin = gpio_pin_by_name("RADIO_RESET"); if (!pin) { return -ENODEV; } - ret = at91_set_gpio_value(pin->pin, 0); - if (ret) { - return ret; - } + gpio_set_value(pin->pin.gpio, 0); mdelay(250); - ret = at91_set_gpio_value(pin->pin, 1); + gpio_set_value(pin->pin.gpio, 1); - return ret; + return 0; } static int ndc_reset(void) { - int ret; struct gpio_pin *pin = gpio_pin_by_name("NDC_RESET"); if (!pin) { return -ENODEV; } - ret = at91_set_gpio_value(pin->pin, 0); - if (ret) { - return ret; - } + gpio_set_value(pin->pin.gpio, 0); mdelay(1); - ret = at91_set_gpio_value(pin->pin, 1); + gpio_set_value(pin->pin.gpio, 1); - return ret; + return 0; } static int ADT7302_to_celsius(int value) @@ -1655,7 +1651,7 @@ static ssize_t mts_attr_show_gpio_pin(struct device *dev, mutex_lock(&mts_io_mutex); - value = at91_get_gpio_value(pin->pin); + value = gpio_get_value(pin->pin.gpio); mutex_unlock(&mts_io_mutex); @@ -1674,7 +1670,6 @@ static ssize_t mts_attr_store_gpio_pin(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; - int err; struct gpio_pin *pin = gpio_pin_by_attr_name(attr->attr.name); if (!pin) { @@ -1691,14 +1686,10 @@ static ssize_t mts_attr_store_gpio_pin(struct device *dev, mutex_lock(&mts_io_mutex); - err = at91_set_gpio_value(pin->pin, value); + gpio_set_value(pin->pin.gpio, value); mutex_unlock(&mts_io_mutex); - if (err) { - return err; - } - return count; } @@ -2142,19 +2133,19 @@ static ssize_t mts_attr_store_led_status(struct device *dev, switch (value) { case LED_OFF: led_mode_status = LED_OFF; - ret = at91_set_gpio_value(pin->pin, 1); + gpio_set_value(pin->pin.gpio, 1); break; case LED_ON: led_mode_status = LED_ON; - ret = at91_set_gpio_value(pin->pin, 0); + gpio_set_value(pin->pin.gpio, 0); break; case LED_FLASHING: led_mode_status = LED_FLASHING; - ret = at91_set_gpio_value(pin->pin, 0); + gpio_set_value(pin->pin.gpio, 0); break; @@ -2423,9 +2414,9 @@ static ssize_t mts_attr_show_serial_mode(struct device *dev, mutex_lock(&mts_io_mutex); - smode0 = at91_get_gpio_value(pin_smode0->pin); - smode1 = at91_get_gpio_value(pin_smode1->pin); - smode2 = at91_get_gpio_value(pin_smode2->pin); + smode0 = gpio_get_value(pin_smode0->pin.gpio); + smode1 = gpio_get_value(pin_smode1->pin.gpio); + smode2 = gpio_get_value(pin_smode2->pin.gpio); if (smode2 == 0 && smode1 == 0 && smode0 == 1) ret = sprintf(buf, "rs232\n"); @@ -2482,9 +2473,9 @@ static ssize_t mts_attr_store_serial_mode(struct device *dev, mutex_lock(&mts_io_mutex); - at91_set_gpio_value(pin_smode2->pin, smode2); - at91_set_gpio_value(pin_smode1->pin, smode1); - at91_set_gpio_value(pin_smode0->pin, smode0); + gpio_set_value(pin_smode2->pin.gpio, smode2); + gpio_set_value(pin_smode1->pin.gpio, smode1); + gpio_set_value(pin_smode0->pin.gpio, smode0); mutex_unlock(&mts_io_mutex); @@ -2580,7 +2571,7 @@ struct gpio_pin *dc_gpio_pin_by_attr_name(const char *name) { } for (pin = gpio_pins; *pin->name; pin++) { - if (!strcmp(pin->attr_name, pin_attr_name)) { + if (!strcmp(pin->pin.label, pin_attr_name)) { return pin; } } @@ -2604,7 +2595,7 @@ static ssize_t mts_attr_show_dc_gpio_pin(struct device *dev, mutex_lock(&mts_io_mutex); - value = at91_get_gpio_value(pin->pin); + value = gpio_get_value(pin->pin.gpio); mutex_unlock(&mts_io_mutex); @@ -2623,7 +2614,6 @@ static ssize_t mts_attr_store_dc_gpio_pin(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; - int err; struct gpio_pin *pin = dc_gpio_pin_by_attr_name(attr->attr.name); if (!pin) { @@ -2640,14 +2630,10 @@ static ssize_t mts_attr_store_dc_gpio_pin(struct device *dev, mutex_lock(&mts_io_mutex); - err = at91_set_gpio_value(pin->pin, value); + gpio_set_value(pin->pin.gpio, value); mutex_unlock(&mts_io_mutex); - if (err) { - return err; - } - return count; } @@ -3112,7 +3098,7 @@ static struct attribute_group mtr_platform_attribute_group = { static struct platform_device *mts_io_platform_device; -static int __devinit mts_spi_sout_probe(struct spi_device *spi) +static int mts_spi_sout_probe(struct spi_device *spi) { int tmp; @@ -3150,10 +3136,10 @@ static struct spi_driver mts_spi_sout_driver = { }, .probe = mts_spi_sout_probe, - .remove = __devexit_p(mts_spi_sout_remove), + .remove = mts_spi_sout_remove, }; -static int __devinit mts_spi_dout_probe(struct spi_device *spi) +static int mts_spi_dout_probe(struct spi_device *spi) { int tmp; @@ -3196,10 +3182,10 @@ static struct spi_driver mts_spi_dout_driver = { }, .probe = mts_spi_dout_probe, - .remove = __devexit_p(mts_spi_dout_remove), + .remove = mts_spi_dout_remove, }; -static int __devinit mts_spi_din_probe(struct spi_device *spi) +static int mts_spi_din_probe(struct spi_device *spi) { int tmp; @@ -3239,10 +3225,10 @@ static struct spi_driver mts_spi_din_driver = { }, .probe = mts_spi_din_probe, - .remove = __devexit_p(mts_spi_din_remove), + .remove = mts_spi_din_remove, }; -static int __devinit mts_spi_dc_dout_probe(struct spi_device *spi) +static int mts_spi_dc_dout_probe(struct spi_device *spi) { int tmp; @@ -3285,10 +3271,10 @@ static struct spi_driver mts_spi_dc_dout_driver = { }, .probe = mts_spi_dc_dout_probe, - .remove = __devexit_p(mts_spi_dc_dout_remove), + .remove = mts_spi_dc_dout_remove, }; -static int __devinit mts_spi_dc_din_probe(struct spi_device *spi) +static int mts_spi_dc_din_probe(struct spi_device *spi) { int tmp; @@ -3328,10 +3314,10 @@ static struct spi_driver mts_spi_dc_din_driver = { }, .probe = mts_spi_dc_din_probe, - .remove = __devexit_p(mts_spi_dc_din_remove), + .remove = mts_spi_dc_din_remove, }; -static int __devinit mts_spi_dc_adc_probe(struct spi_device *spi) +static int mts_spi_dc_adc_probe(struct spi_device *spi) { int tmp; @@ -3372,10 +3358,10 @@ static struct spi_driver mts_spi_dc_adc_driver = { }, .probe = mts_spi_dc_adc_probe, - .remove = __devexit_p(mts_spi_dc_adc_remove), + .remove = mts_spi_dc_adc_remove, }; -static int __devinit mts_spi_board_temp_probe(struct spi_device *spi) +static int mts_spi_board_temp_probe(struct spi_device *spi) { int tmp; @@ -3410,7 +3396,7 @@ static struct spi_driver mts_spi_board_temp_driver = { }, .probe = mts_spi_board_temp_probe, - .remove = __devexit_p(mts_spi_board_temp_remove), + .remove = mts_spi_board_temp_remove, }; static int mts_dc_eeprom_load(void) @@ -3456,6 +3442,7 @@ static int mts_id_eeprom_load(void) if (mts_id_eeprom[0] == 0xFF) { log_error("uninitialized eeprom"); return -EIO; + /* } else if (mts_id_eeprom[0] == 0x00) { strncpy(id_eeprom.vendor_id, VENDOR_ID_MULTITECH, sizeof(id_eeprom.vendor_id) - 1); strncpy(id_eeprom.product_id, PRODUCT_ID_MTCDP_E1_DK, sizeof(id_eeprom.product_id) - 1); @@ -3477,6 +3464,7 @@ static int mts_id_eeprom_load(void) has_spi_dout = 1; has_spi_temp = 1; log_info("detected board %s", HW_VERSION_MT100EOCG_0_0); + */ } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR2_0_0, strlen(HW_VERSION_MTR2_0_0)) == 0) { attr_group = &mtr2_platform_attribute_group; gpio_pins = gpio_pins_mtr2_0_0; @@ -3533,6 +3521,7 @@ static int mts_id_eeprom_load(void) has_spi_dout = 0; has_spi_temp = 0; log_info("detected board %s", HW_VERSION_MTOCGD_0_1); + /* } else { attr_group = &mtcdp_platform_attribute_group; gpio_pins = gpio_pins_mtcdp_1_0; @@ -3542,6 +3531,7 @@ static int mts_id_eeprom_load(void) has_spi_dout = 1; has_spi_temp = 1; log_info("detected board %s", HW_VERSION_MTCDP_1_0); + */ } log_info("sizeof: %lu", (unsigned long) sizeof(struct mts_id_eeprom_layout)); @@ -3698,7 +3688,7 @@ static int __init mts_io_init(void) } } -#ifdef CONFIG_ARCH_AT91SAM9X5 +#ifdef CONFIG_SOC_AT91SAM9X5 adc_base = ioremap(AT91SAM9X5_BASE_ADC, SZ_16K); #else adc_base = ioremap(AT91SAM9260_BASE_ADC, SZ_16K); @@ -3721,24 +3711,16 @@ static int __init mts_io_init(void) } for (pin = gpio_pins; *pin->name; pin++) { - gpio_request(pin->pin, pin->name); - - if (pin->direction == GPIO_DIR_OD) { - log_info("Setting pin %s to multi-drive\n", pin->name); - at91_set_multi_drive(pin->pin, true); - } - - if (pin->direction == GPIO_DIR_OUTPUT || pin->direction == GPIO_DIR_OD) { - at91_set_gpio_output_with_pullup(pin->pin, pin->output_value, pin->use_pullup); - } else { - at91_set_gpio_input(pin->pin, pin->use_pullup); + ret = gpio_request_one(pin->pin.gpio, pin->pin.flags, pin->pin.label); + if (ret) { + log_debug("could not request pin %s (%d) but it could have already been requested under a different pin name", pin->name, ret); } } if ( has_spi_sout || has_spi_dout || has_spi_din ) { pin = gpio_pin_by_name("ENIO"); if (pin) { - at91_set_gpio_value(pin->pin, 0); + gpio_set_value(pin->pin.gpio, 0); } } diff --git a/io-module/mts_io.h b/io-module/mts_io.h index bcf8e74..0af81f2 100644 --- a/io-module/mts_io.h +++ b/io-module/mts_io.h @@ -9,6 +9,8 @@ #endif #endif +#include + #define MTS_ATTR_MODE_RW S_IWUSR | S_IRUGO #define MTS_ATTR_MODE_RO S_IRUGO @@ -122,11 +124,7 @@ enum { struct gpio_pin { char name[32]; - char attr_name[32]; - unsigned pin; - int direction; - int output_value; - int use_pullup; + struct gpio pin; int active_low; }; -- cgit v1.2.3