diff options
Diffstat (limited to 'io-module/machine/mt100eocg.c')
-rw-r--r-- | io-module/machine/mt100eocg.c | 252 |
1 files changed, 252 insertions, 0 deletions
diff --git a/io-module/machine/mt100eocg.c b/io-module/machine/mt100eocg.c new file mode 100644 index 0000000..749b85a --- /dev/null +++ b/io-module/machine/mt100eocg.c @@ -0,0 +1,252 @@ +#include "at91gpio.h" +/* Used for both MT100EOCG 0.0 */ +static struct gpio_pin gpio_pins_mt100eocg_0_0[] = { + { + .name = "ADC0", + .pin = { + .label = "adc0", + .gpio = AT91_PIN_PC0, + .flags = GPIOF_IN, + }, + }, + { + .name = "ADC1", + .pin = { + .label = "adc1", + .gpio = AT91_PIN_PC1, + .flags = GPIOF_IN, + }, + }, + { + .name = "ADC2", + .pin = { + .label = "adc2", + .gpio = AT91_PIN_PC2, + .flags = GPIOF_IN, + }, + }, + { + .name = "ADC3", + .pin = { + .label = "adc3", + .gpio = AT91_PIN_PC3, + .flags = GPIOF_IN, + }, + }, + { + .name = "DTR1", + .pin = { + .label = "extserial-dtr", + .gpio = AT91_PIN_PB18, + .flags = GPIOF_IN, + }, + .active_low = 1, + }, + { + .name = "DCD1", + .pin = { + .label = "extserial-dcd", + .gpio = AT91_PIN_PB3, + .flags = GPIOF_OUT_INIT_HIGH, + }, + .active_low = 1, + }, + { + .name = "ETH0_ENABLED", + .pin = { + .label = "eth0-enabled", + .gpio = AT91_PIN_PB31, + .flags = GPIOF_OUT_INIT_HIGH, + }, + }, + { + .name = "ENIO", + .pin = { + .label = "enio", + .gpio = AT91_PIN_PC15, + .flags = GPIOF_OUT_INIT_LOW, + }, + }, + { + .name = "DEVICE_RESET", + .pin = { + .label = "reset", + .gpio = AT91_PIN_PA22, + .flags = GPIOF_IN, + }, + .active_low = 1, + }, + { + .name = "RSERSRC", + .pin = { + .label = "rsersrc", + .gpio = AT91_PIN_PC7, + .flags = GPIOF_OUT_INIT_HIGH, + }, + .active_low = 1, + }, + { + .name = "RADIO_RESET", + .pin = { + .label = "radio-reset", + .gpio = AT91_PIN_PB30, + .flags = GPIOF_OUT_INIT_HIGH, + }, + }, + { + .name = "GPIO11", + .pin = { + .label = "gpio11", + .gpio = AT91_PIN_PB19, + .flags = GPIOF_OPEN_DRAIN | GPIOF_INIT_HIGH, + }, + }, + { + .name = "GPIO12", + .pin = { + .label = "gpio12", + .gpio = AT91_PIN_PB20, + .flags = GPIOF_OPEN_DRAIN | GPIOF_INIT_HIGH, + }, + }, + { + .name = "LED2", + .pin = { + .label = "led2", + .gpio = AT91_PIN_PA30, + .flags = GPIOF_OUT_INIT_HIGH, + }, + .active_low = 1, + }, + { + .name = "LED3", + .pin = { + .label = "led3", + .gpio = AT91_PIN_PC9, +#if LED_LS_CONTROLLABLE + .flags = GPIOF_OUT_INIT_HIGH, +#else + .flags = GPIOF_IN, +#endif + }, + .active_low = 1, + }, + /* + { + .name = "TXD1", + .pin = { + .gpio = AT91_PIN_PB17, + .flags = GPIOF_IN, + }, + },*/ + { }, +}; + +/* mt100eocg specific attributes */ +static DEVICE_ATTR_RO_MTS(dev_attr_extserial_dtr, "extserial-dtr", + mts_attr_show_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_extserial_dcd_gpio, "extserial-dcd", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_eth0_enabled, "eth0-enabled", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +static DEVICE_ATTR_MTS(dev_attr_enio, "enio", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); + +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_has_radio.attr, + &dev_attr_reset.attr, + &dev_attr_reset_monitor.attr, + &dev_attr_reset_monitor_intervals.attr, + &dev_attr_extserial_dtr.attr, + &dev_attr_extserial_dcd_gpio.attr, + &dev_attr_rsersrc.attr, // AT91_PIN_PC7 + &dev_attr_radio_reset.attr, // AT91_PIN_PB30 + &dev_attr_eth0_enabled.attr, + &dev_attr_gpio11.attr, // AT91_PIN_PB19 + &dev_attr_gpio12.attr, // AT91_PIN_PB20 + &dev_attr_enio.attr, +// SPI + &dev_attr_gpo1.attr, + &dev_attr_gpo2.attr, + &dev_attr_gpo3.attr, + &dev_attr_gpo4.attr, +// +// SPI + &dev_attr_led1.attr, +// + &dev_attr_led2.attr, // AT91_PIN_PA30 + &dev_attr_led3.attr, // AT91_PIN_PC9 +// SPI + &dev_attr_led4.attr, + &dev_attr_led5.attr, + &dev_attr_led6.attr, +// +// SPI + &dev_attr_gpi5.attr, + &dev_attr_gpi6.attr, + &dev_attr_gpi7.attr, + &dev_attr_gpi8.attr, + &dev_attr_gpi9.attr, + &dev_attr_gpi10.attr, +// +// SPI + &dev_attr_board_temperature.attr, +// +// adc + &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 +}; |