diff options
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r-- | io-module/mts_io.c | 215 |
1 files changed, 212 insertions, 3 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 60ab232..ba9996f 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -42,7 +42,7 @@ #include "mts_io.h" -#define DRIVER_VERSION "v0.6.2" +#define DRIVER_VERSION "v0.6.3" #define DRIVER_AUTHOR "James Maki <jmaki@multitech.com>" #define DRIVER_DESC "MTS-IO Controller" #define DRIVER_NAME "mts-io" @@ -827,6 +827,206 @@ 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, + }, + { + .name = "3G_RST", + .attr_name = "radio-reset", + .pin = AT91_PIN_PA22, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 1, + }, + { + .name = "3G_ONOFF", + .attr_name = "radio-enabled", + .pin = AT91_PIN_PA21, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 1, + }, + { + .name = "DEVICE_RESET", + .attr_name = "reset", + .pin = AT91_PIN_PC4, + .direction = GPIO_DIR_INPUT, + .output_value = 0, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LS_LED", + .attr_name = "led-ls", + .pin = AT91_PIN_PC16, +#if LED_LS_CONTROLLABLE + .direction = GPIO_DIR_OUTPUT, +#else + .direction = GPIO_DIR_INPUT, +#endif + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "STATUS_LED", + .attr_name = "led-status", + .pin = AT91_PIN_PC21, + .direction = GPIO_DIR_OUTPUT, + .output_value = 0, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED3", + .attr_name = "led-wifi", + .pin = AT91_PIN_PC15, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED3", + .attr_name = "led-b", + .pin = AT91_PIN_PC15, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED4", + .attr_name = "led-cd", + .pin = AT91_PIN_PC20, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED4", + .attr_name = "led-c", + .pin = AT91_PIN_PC20, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED6", + .attr_name = "led-sig1", + .pin = AT91_PIN_PC19, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED6", + .attr_name = "led-d", + .pin = AT91_PIN_PC19, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED7", + .attr_name = "led-sig2", + .pin = AT91_PIN_PC18, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED7", + .attr_name = "led-e", + .pin = AT91_PIN_PC18, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED8", + .attr_name = "led-sig3", + .pin = AT91_PIN_PC17, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "LED8", + .attr_name = "led-f", + .pin = AT91_PIN_PC17, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "RI_B", + .attr_name = "extserial-ri", + .pin = AT91_PIN_PC25, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "DTR_B", + .attr_name = "extserial-dtr", + .pin = AT91_PIN_PC26, + .direction = GPIO_DIR_INPUT, + .output_value = 0, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "DSR_B", + .attr_name = "extserial-dsr", + .pin = AT91_PIN_PC27, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "DCD_B", + .attr_name = "extserial-dcd", + .pin = AT91_PIN_PC28, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "BT_EN", + .attr_name = "bt-enabled", + .pin = AT91_PIN_PA28, + .direction = GPIO_DIR_OUTPUT, + .output_value = 0, + .use_pullup = 0, + }, + { + .name = "WLAN_EN", + .attr_name = "wlan-enabled", + .pin = AT91_PIN_PA27, + .direction = GPIO_DIR_OUTPUT, + .output_value = 0, + .use_pullup = 0, + }, + { }, +}; struct gpio_pin *gpio_pin_by_name(const char *name) { struct gpio_pin *pin; @@ -1035,7 +1235,7 @@ static int radio_reset_telit(void) msleep(500); - // set pin high (high Z) + // set pin high ret = at91_set_gpio_output_with_pullup(rst_pin->pin, 1, rst_pin->use_pullup); if (ret) { return ret; @@ -1052,7 +1252,7 @@ static int radio_reset_telit(void) msleep(6000); - // set on/off pin high (high Z) + // set on/off pin high ret = at91_set_gpio_output_with_pullup(onoff_pin->pin, 1, onoff_pin->use_pullup); if (ret) { return ret; @@ -2433,6 +2633,15 @@ static int mts_id_eeprom_load(void) has_spi_dout = 0; has_spi_temp = 0; log_info("detected board %s", HW_VERSION_MTR_0_0); + } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR_0_1, strlen(HW_VERSION_MTR_0_1)) == 0) { + attr_group = &mtr_platform_attribute_group; + gpio_pins = gpio_pins_mtr_0_1; + mts_product_id = MTR_0_1; + has_spi_sout = 0; + has_spi_din = 0; + has_spi_dout = 0; + has_spi_temp = 0; + log_info("detected board %s", HW_VERSION_MTR_0_1); } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTOCGD3_0_0, strlen(HW_VERSION_MTOCGD3_0_0)) == 0) { attr_group = &mtr2_platform_attribute_group; gpio_pins = gpio_pins_mtr2_0_0; |