From 9cf9a09c665ecfb6425a08e424b01c8cacbdb660 Mon Sep 17 00:00:00 2001 From: Jesse Gilles Date: Fri, 16 May 2014 16:43:44 -0500 Subject: Major changes to split sources up * moved common peripheral i/o functions to separate source files * moved device-specific setup to separate source files * removed LED blink functionality (unused) * mtcdp, mt100eocg are not supported, but code is included for possible future use --- io-module/mtcdp.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 310 insertions(+) create mode 100644 io-module/mtcdp.c (limited to 'io-module/mtcdp.c') diff --git a/io-module/mtcdp.c b/io-module/mtcdp.c new file mode 100644 index 0000000..31551b0 --- /dev/null +++ b/io-module/mtcdp.c @@ -0,0 +1,310 @@ + +#define USBH2_PS_CONTROLLABLE 0 + +static struct gpio_pin gpio_pins_mtcdp_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 = "LS_LED", + .attr_name = "led-ls", + .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 = "STATUS_LED", + .attr_name = "led-status", + .pin = AT91_PIN_PA30, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + }, + { + .name = "STATUS_LED", + .attr_name = "led-sdk-a", + .pin = AT91_PIN_PA30, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + }, +#endif + { + .name = "RSERSRC", + .attr_name = "rsersrc", + .pin = AT91_PIN_PC7, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + .active_low = 1, + }, + { + .name = "DTR1", + .attr_name = "extserial-dtr", + .pin = AT91_PIN_PC10, + .direction = GPIO_DIR_INPUT, + .output_value = 0, + .use_pullup = 0, + .active_low = 1, + }, + { }, +}; + +static struct gpio_pin gpio_pins_mtcdp_1_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 = "LS_LED", + .attr_name = "led-ls", + .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 = "STATUS_LED", + .attr_name = "led-status", + .pin = AT91_PIN_PA30, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + }, + { + .name = "STATUS_LED", + .attr_name = "led-sdk-a", + .pin = AT91_PIN_PA30, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + }, + { + .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 = "USBH2_PS_OC", + .attr_name = "usbh2-ps-oc", + .pin = AT91_PIN_PB19, + .direction = GPIO_DIR_INPUT, + .output_value = 0, + .use_pullup = 0, + .active_low = 1, + }, +#if USBH2_PS_CONTROLLABLE + { + .name = "USBH2_PS_ENABLED", + .attr_name = "usbh2-ps-enabled", + .pin = AT91_PIN_PB20, + .direction = GPIO_DIR_OUTPUT, + .output_value = 0, + .use_pullup = 0, + .active_low = 1, + }, +#endif + { + .name = "NDC_RESET", + .attr_name = "ndc-reset", + .pin = AT91_PIN_PB21, + .direction = GPIO_DIR_OUTPUT, + .output_value = 1, + .use_pullup = 0, + }, + { + .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, + }, + { }, +}; + +/* mtcdp specific attributes */ +static DEVICE_ATTR_MTS(dev_attr_led_sdk_a, "led-sdk-a", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); +static DEVICE_ATTR_RO_MTS(dev_attr_usbh2_ps_oc, "usbh2-ps-oc", + mts_attr_show_gpio_pin); + +#if USBH2_PS_CONTROLLABLE +static DEVICE_ATTR_MTS(dev_attr_usbh2_ps_enabled, "usbh2-ps-enabled", + mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); +#endif + +static struct attribute *mtcdp_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_reset.attr, + &dev_attr_reset_monitor.attr, + &dev_attr_radio_reset.attr, + &dev_attr_ndc_reset.attr, + &dev_attr_eth0_enabled.attr, + &dev_attr_extserial_dtr.attr, + &dev_attr_led_ls.attr, + &dev_attr_led_status.attr, + &dev_attr_led_sdk_a.attr, + &dev_attr_usbh2_ps_oc.attr, +#if USBH2_PS_CONTROLLABLE + &dev_attr_usbh2_ps_enabled.attr, +#endif + + &dev_attr_extserial_dcd.attr, + &dev_attr_extserial_ri.attr, + &dev_attr_extserial_dsr.attr, + &dev_attr_led_cd.attr, + &dev_attr_led_sdk_b.attr, + &dev_attr_led_sig1.attr, + &dev_attr_led_sdk_c.attr, + &dev_attr_led_sig2.attr, + &dev_attr_led_sdk_d.attr, + &dev_attr_led_sig3.attr, + &dev_attr_led_sdk_e.attr, + &dev_attr_led_dtr.attr, + &dev_attr_led_sdk_f.attr, + + &dev_attr_dout0.attr, + &dev_attr_dout1.attr, + &dev_attr_dout2.attr, + &dev_attr_dout3.attr, + &dev_attr_dout4.attr, + &dev_attr_dout5.attr, + &dev_attr_dout6.attr, + &dev_attr_dout7.attr, + + &dev_attr_din0.attr, + &dev_attr_din1.attr, + &dev_attr_din2.attr, + &dev_attr_din3.attr, + &dev_attr_din4.attr, + &dev_attr_din5.attr, + &dev_attr_din6.attr, + &dev_attr_din7.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 mtcdp_platform_attribute_group = { + .attrs = mtcdp_platform_attributes +}; -- cgit v1.2.3