summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io-module/mts_io.c131
1 files changed, 131 insertions, 0 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 4697209..8c1251b 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -329,6 +329,13 @@ static struct gpio_pin gpio_pins_mt100ecdp_0_0[] = {
.use_pullup = 0,
},
{
+ .name = "DCD1",
+ .pin = AT91_PIN_PB3,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ },
+ {
.name = "GPIO11",
.pin = AT91_PIN_PB19,
.direction = GPIO_DIR_OUTPUT,
@@ -1840,6 +1847,109 @@ static ssize_t mts_attr_store_gpio12(struct device *dev,
return count;
}
+static ssize_t mts_attr_show_rsersrc(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int value;
+ struct gpio_pin *pin = gpio_pin_by_name("RSERSRC");
+
+ if (!pin) {
+ return -ENODEV;
+ }
+
+ mutex_lock(&mts_io_mutex);
+
+ value = at91_get_gpio_value(pin->pin);
+
+ mutex_unlock(&mts_io_mutex);
+
+ if (value < 0) {
+ return value;
+ }
+
+ return sprintf(buf, "%d\n", !value);
+}
+
+static ssize_t mts_attr_store_rsersrc(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int value;
+ int err;
+ struct gpio_pin *pin = gpio_pin_by_name("RSERSRC");
+
+ if (!pin) {
+ return -ENODEV;
+ }
+
+ if (sscanf(buf, "%i", &value) != 1) {
+ return -EINVAL;
+ }
+
+ mutex_lock(&mts_io_mutex);
+
+ err = at91_set_gpio_value(pin->pin, !value);
+
+ mutex_unlock(&mts_io_mutex);
+
+ if (err) {
+ return err;
+ }
+
+ return count;
+}
+
+static ssize_t mts_attr_show_cd(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int value;
+ struct gpio_pin *pin = gpio_pin_by_name("DCD1");
+
+ if (!pin) {
+ return -ENODEV;
+ }
+
+ mutex_lock(&mts_io_mutex);
+
+ value = at91_get_gpio_value(pin->pin);
+
+ mutex_unlock(&mts_io_mutex);
+
+ if (value < 0) {
+ return value;
+ }
+
+ return sprintf(buf, "%d\n", !value);
+}
+
+static ssize_t mts_attr_store_cd(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int value;
+ int err;
+ struct gpio_pin *pin = gpio_pin_by_name("DCD1");
+
+ if (!pin) {
+ return -ENODEV;
+ }
+
+ if (sscanf(buf, "%i", &value) != 1) {
+ return -EINVAL;
+ }
+
+ mutex_lock(&mts_io_mutex);
+
+ err = at91_set_gpio_value(pin->pin, !value);
+
+ mutex_unlock(&mts_io_mutex);
+
+ if (err) {
+ return err;
+ }
+
+ return count;
+}
+
+
static struct device_attribute dev_attr_gpo1 = {
.attr = {
.name = "gpo1",
@@ -2000,8 +2110,29 @@ static struct device_attribute dev_attr_gpio12 = {
.store = mts_attr_store_gpio12,
};
+static struct device_attribute dev_attr_rsersrc = {
+ .attr = {
+ .name = "rsersrc",
+ .mode = MTS_ATTR_MODE_RW,
+ },
+ .show = mts_attr_show_rsersrc,
+ .store = mts_attr_store_rsersrc,
+};
+
+static struct device_attribute dev_attr_extserial_cd = {
+ .attr = {
+ .name = "extserial-dcd",
+ .mode = MTS_ATTR_MODE_RW,
+ },
+ .show = mts_attr_show_cd,
+ .store = mts_attr_store_cd,
+};
+
static struct attribute *mt100ecdp_platform_attributes[] = {
+ &dev_attr_extserial_dtr.attr,
+ &dev_attr_extserial_cd.attr,
+ &dev_attr_rsersrc.attr,
&dev_attr_radio_reset.attr,
&dev_attr_eth0_enabled.attr,
&dev_attr_gpio11.attr,