summaryrefslogtreecommitdiff
path: root/io-module/mt100eocg.c
diff options
context:
space:
mode:
Diffstat (limited to 'io-module/mt100eocg.c')
-rw-r--r--io-module/mt100eocg.c221
1 files changed, 221 insertions, 0 deletions
diff --git a/io-module/mt100eocg.c b/io-module/mt100eocg.c
new file mode 100644
index 0000000..8d2338d
--- /dev/null
+++ b/io-module/mt100eocg.c
@@ -0,0 +1,221 @@
+
+static struct gpio_pin gpio_pins_mt100eocg_0_0[] = {
+ {
+ .name = "ENIO",
+ .pin = AT91_PIN_PC15,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ },
+ {
+ .name = "ETH0_ENABLED",
+ .attr_name = "eth0-enabled",
+ .pin = AT91_PIN_PB31,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ },
+ {
+ .name = "RADIO_RESET",
+ .attr_name = "radio-reset",
+ .pin = AT91_PIN_PB30,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ },
+ {
+ .name = "DEVICE_RESET",
+ .attr_name = "reset",
+ .pin = AT91_PIN_PA22,
+ .direction = GPIO_DIR_INPUT,
+ .output_value = 0,
+ .use_pullup = 0,
+ .active_low = 1,
+ },
+ {
+ .name = "LED3",
+ .attr_name = "led3",
+ .pin = AT91_PIN_PC9,
+#if LED_LS_CONTROLLABLE
+ .direction = GPIO_DIR_OUTPUT,
+#else
+ .direction = GPIO_DIR_INPUT,
+#endif
+ .output_value = 1,
+ .use_pullup = 0,
+ .active_low = 1,
+ },
+ {
+ .name = "LED2",
+ .attr_name = "led2",
+ .pin = AT91_PIN_PA30,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ .active_low = 1,
+ },
+ {
+ .name = "RSERSRC",
+ .attr_name = "rsersrc",
+ .pin = AT91_PIN_PC7,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ .active_low = 1,
+ },
+ {
+ .name = "TXD1",
+ .pin = AT91_PIN_PB17,
+ .direction = GPIO_DIR_INPUT,
+ .output_value = 0,
+ .use_pullup = 0,
+ },
+ {
+ .name = "DTR1",
+ .attr_name = "extserial-dtr",
+ .pin = AT91_PIN_PB18,
+ .direction = GPIO_DIR_INPUT,
+ .output_value = 0,
+ .use_pullup = 0,
+ .active_low = 1,
+ },
+ {
+ .name = "DCD1",
+ .attr_name = "extserial-dcd",
+ .pin = AT91_PIN_PB3,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ .active_low = 1,
+ },
+ {
+ .name = "GPIO11",
+ .attr_name = "gpio11",
+ .pin = AT91_PIN_PB19,
+ .direction = GPIO_DIR_OD,
+ .output_value = 1,
+ .use_pullup = 1,
+ },
+ {
+ .name = "GPIO12",
+ .attr_name = "gpio12",
+ .pin = AT91_PIN_PB20,
+ .direction = GPIO_DIR_OD,
+ .output_value = 1,
+ .use_pullup = 1,
+ },
+ {
+ .name = "ADC0",
+ .pin = AT91_PIN_PC0,
+ .direction = GPIO_DIR_INPUT,
+ .output_value = 0,
+ .use_pullup = 0,
+ },
+ {
+ .name = "ADC1",
+ .pin = AT91_PIN_PC1,
+ .direction = GPIO_DIR_INPUT,
+ .output_value = 0,
+ .use_pullup = 0,
+ },
+ {
+ .name = "ADC2",
+ .pin = AT91_PIN_PC2,
+ .direction = GPIO_DIR_INPUT,
+ .output_value = 0,
+ .use_pullup = 0,
+ },
+ {
+ .name = "ADC3",
+ .pin = AT91_PIN_PC3,
+ .direction = GPIO_DIR_INPUT,
+ .output_value = 0,
+ .use_pullup = 0,
+ },
+ { },
+};
+
+/* mt100eocg specific attributes */
+static DEVICE_ATTR_MTS(dev_attr_gpo1, "gpo1",
+ mts_attr_show_dout, mts_attr_store_dout);
+static DEVICE_ATTR_MTS(dev_attr_gpo2, "gpo2",
+ mts_attr_show_dout, mts_attr_store_dout);
+static DEVICE_ATTR_MTS(dev_attr_gpo3, "gpo3",
+ mts_attr_show_dout, mts_attr_store_dout);
+static DEVICE_ATTR_MTS(dev_attr_gpo4, "gpo4",
+ mts_attr_show_dout, mts_attr_store_dout);
+
+
+static DEVICE_ATTR_MTS(dev_attr_led1, "led1",
+ mts_attr_show_dout, mts_attr_store_dout);
+static DEVICE_ATTR_MTS(dev_attr_led2, "led2",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+
+#if LED_LS_CONTROLLABLE
+static DEVICE_ATTR_MTS(dev_attr_led3, "led3",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+#else
+static DEVICE_ATTR_RO_MTS(dev_attr_led3, "led3", mts_attr_show_gpio_pin);
+#endif
+
+static DEVICE_ATTR_MTS(dev_attr_led4, "led4",
+ mts_attr_show_dout, mts_attr_store_dout);
+static DEVICE_ATTR_MTS(dev_attr_led5, "led5",
+ mts_attr_show_dout, mts_attr_store_dout);
+static DEVICE_ATTR_MTS(dev_attr_led6, "led6",
+ mts_attr_show_dout, mts_attr_store_dout);
+
+static DEVICE_ATTR_MTS(dev_attr_gpio11, "gpio11",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+static DEVICE_ATTR_MTS(dev_attr_gpio12, "gpio12",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+
+static DEVICE_ATTR_MTS(dev_attr_rsersrc, "rsersrc",
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
+
+static struct attribute *mt100eocg_platform_attributes[] = {
+ &dev_attr_vendor_id.attr,
+ &dev_attr_product_id.attr,
+ &dev_attr_device_id.attr,
+ &dev_attr_hw_version.attr,
+ &dev_attr_imei.attr,
+ &dev_attr_eth_mac.attr,
+ &dev_attr_extserial_dtr.attr,
+ &dev_attr_extserial_dcd_gpio.attr,
+ &dev_attr_rsersrc.attr,
+ &dev_attr_radio_reset.attr,
+ &dev_attr_eth0_enabled.attr,
+ &dev_attr_gpio11.attr,
+ &dev_attr_gpio12.attr,
+
+ &dev_attr_gpo1.attr,
+ &dev_attr_gpo2.attr,
+ &dev_attr_gpo3.attr,
+ &dev_attr_gpo4.attr,
+ &dev_attr_led1.attr,
+ &dev_attr_led2.attr,
+ &dev_attr_led3.attr,
+ &dev_attr_led4.attr,
+ &dev_attr_led5.attr,
+ &dev_attr_led6.attr,
+
+ &dev_attr_gpi5.attr,
+ &dev_attr_gpi6.attr,
+ &dev_attr_gpi7.attr,
+ &dev_attr_gpi8.attr,
+ &dev_attr_gpi9.attr,
+ &dev_attr_gpi10.attr,
+
+ &dev_attr_board_temperature.attr,
+
+ &dev_attr_adc0.attr,
+ &dev_attr_adc1.attr,
+ &dev_attr_adc2.attr,
+ &dev_attr_adc3.attr,
+
+ NULL,
+};
+
+static struct attribute_group mt100eocg_platform_attribute_group = {
+ .attrs = mt100eocg_platform_attributes
+};