#include "at91gpio.h" /* * Within a struct gpio_pin, there is only one * occurrence of each pin, so there is only one * pin label set for each gpio pin. */ static struct gpio_pin gpio_pins_mtcdt_0_0[] = { { .name = "RADIO_RESET", .pin = { .gpio = AT91_PIN_PC3, .flags = GPIOF_OUT_INIT_HIGH, .label = "radio-reset", }, }, { .name = "RADIO_RESET", .pin = { .gpio = AT91_PIN_PC3, .flags = GPIOF_OUT_INIT_HIGH, .label = "radio-power", }, }, { .name = "DEVICE_RESET", .pin = { .gpio = AT91_PIN_PC2, .flags = GPIOF_IN, .label = "reset", }, .active_low = 1, }, { .name = "ETH_RESET", .pin = { .gpio = AT91_PIN_PC4, .flags = GPIOF_OUT_INIT_HIGH, .label = "eth-reset", } }, { .name = "LS_LED", /* LED7 */ .pin = { .gpio = AT91_PIN_PA14, #if LED_LS_CONTROLLABLE .flags = GPIOF_OUT_INIT_HIGH, #else .flags = GPIOF_IN, #endif .label = "led-ls", }, .active_low = 1, }, { .name = "STATUS_LED", /* LED2 */ .pin = { .gpio = AT91_PIN_PA24, .flags = GPIOF_OUT_INIT_LOW, .label = "led-status", }, .active_low = 1, }, { .name = "LED5", .pin = { .gpio = AT91_PIN_PA25, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-cd", }, .active_low = 1, }, { .name = "LED5", .pin = { .gpio = AT91_PIN_PA25, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-a", }, .active_low = 1, }, { .name = "LED1", .pin = { .gpio = AT91_PIN_PA26, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-sig1", }, .active_low = 1, }, { .name = "LED1", .pin = { .gpio = AT91_PIN_PA26, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-b", }, .active_low = 1, }, { .name = "LED4", .pin = { .gpio = AT91_PIN_PA27, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-sig2", }, .active_low = 1, }, { .name = "LED4", .pin = { .gpio = AT91_PIN_PA27, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-c", }, .active_low = 1, }, { .name = "LED3", .pin = { .gpio = AT91_PIN_PA28, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-sig3", }, .active_low = 1, }, { .name = "LED3", .pin = { .gpio = AT91_PIN_PA28, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-d", }, .active_low = 1, }, }; static struct gpio_pin gpio_pins_mtcdt_0_1[] = { { .name = "RADIO_RESET", .pin = { .gpio = AT91_PIN_PC3, .flags = GPIOF_OUT_INIT_HIGH, .label = "radio-reset", }, }, { .name = "RADIO_RESET", .pin = { .gpio = AT91_PIN_PC3, .flags = GPIOF_OUT_INIT_HIGH, .label = "radio-power", }, }, { .name = "DEVICE_RESET", .pin = { .gpio = AT91_PIN_PC2, .flags = GPIOF_IN, .label = "reset", }, .active_low = 1, }, { .name = "LS_LED", /* LED7 */ .pin = { .gpio = AT91_PIN_PA14, #if LED_LS_CONTROLLABLE .flags = GPIOF_OUT_INIT_HIGH, #else .flags = GPIOF_IN, #endif .label = "led-ls", }, .active_low = 1, }, { .name = "STATUS_LED", /* LED2 */ .pin = { .gpio = AT91_PIN_PA24, .flags = GPIOF_OUT_INIT_LOW, .label = "led-status", }, .active_low = 1, }, { .name = "LED5", .pin = { .gpio = AT91_PIN_PA25, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-cd", }, .active_low = 1, }, { .name = "LED5", .pin = { .gpio = AT91_PIN_PA25, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-a", }, .active_low = 1, }, { .name = "LED1", .pin = { .gpio = AT91_PIN_PA26, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-sig1", }, .active_low = 1, }, { .name = "LED1", .pin = { .gpio = AT91_PIN_PA26, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-b", }, .active_low = 1, }, { .name = "LED4", .pin = { .gpio = AT91_PIN_PA27, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-sig2", }, .active_low = 1, }, { .name = "LED4", .pin = { .gpio = AT91_PIN_PA27, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-c", }, .active_low = 1, }, { .name = "LED3", .pin = { .gpio = AT91_PIN_PA28, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-sig3", }, .active_low = 1, }, { .name = "LED3", .pin = { .gpio = AT91_PIN_PA28, .flags = GPIOF_OUT_INIT_HIGH, .label = "led-d", }, .active_low = 1, }, { .name = "ETH_RESET", .pin = { .gpio = AT91_PIN_PC4, .flags = GPIOF_OUT_INIT_HIGH, .label = "eth-reset", } }, { .name = "WIFI_BT_ULPWKUP", .pin = { .gpio = AT91_PIN_PA0, .flags = GPIOF_IN, .label = "wifi-bt-ulpwkup", }, .capability = CAPA_WIFI, }, { .name = "WIFI_BT_LPWKUP", .pin = { .gpio = AT91_PIN_PA6, .flags = GPIOF_IN, .label = "wifi-bt-lpwkup", }, .capability = CAPA_WIFI, }, { .name = "WIFI_BT_INT", .pin = { .gpio = AT91_PIN_PB11, .flags = GPIOF_IN, .label = "wifi-bt-int", }, .capability = CAPA_WIFI, }, { .name = "WIFI_BT_RESET", .pin = { .gpio = AT91_PIN_PD14, .flags = GPIOF_OUT_INIT_HIGH, .label = "wifi-bt-reset", }, .capability = CAPA_WIFI, }, { .name = "GNSS_RESET", .pin = { .gpio = AT91_PIN_PD15, .flags = GPIOF_OUT_INIT_LOW, /* Keep GPS quiet during boot for EXAR */ .label = "gnss-reset", }, .capability = CAPA_GPS, }, { .name = "SECURE_RESET", .pin = { .gpio = AT91_PIN_PD16, .flags = GPIOF_OUT_INIT_HIGH, .label = "secure-reset", } }, { .name = "MTQ_RESET", .pin = { .gpio = AT91_PIN_PD17, .flags = GPIOF_OUT_INIT_HIGH, .label = "mtq-reset", } }, { .name = "USBHUB_RESET", .pin = { .gpio = AT91_PIN_PD18, .flags = GPIOF_OUT_INIT_HIGH, .label = "usbhub-reset", } }, { .name = "GNSS_INT", .pin = { .gpio = AT91_PIN_PD19, .flags = GPIOF_OUT_INIT_HIGH, .label = "gnss-int", }, .capability = CAPA_GPS, }, { .name = "WIFI_BT_LPMODE", .pin = { .gpio = AT91_PIN_PD20, .flags = GPIOF_IN, .label = "wifi-bt-lpmode", }, .capability = CAPA_WIFI, }, { }, }; static DEVICE_ATTR_MTS(dev_attr_wifi_bt_lpwkup, "wifi-bt-lpwkup", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_wifi_bt_ulpwkup, "wifi-bt-ulpwkup", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_wifi_bt_reset, "wifi-bt-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_lpmode, "wifi-bt-lpmode", mts_attr_show_gpio_pin); static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_int, "wifi-bt-int", mts_attr_show_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_gnss_reset, "gnss-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_usbhub_reset, "usbhub-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_eth_reset, "eth-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_gnss_int, "gnss-int", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static struct attribute *mtcdt_platform_attributes[] = { &dev_attr_vendor_id.attr, &dev_attr_product_id.attr, &dev_attr_device_id.attr, &dev_attr_uuid.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_led_status.attr, &dev_attr_led_cd_gpio.attr, &dev_attr_led_sig1_gpio.attr, &dev_attr_led_sig2_gpio.attr, &dev_attr_led_sig3_gpio.attr, &dev_attr_led_a_gpio.attr, &dev_attr_led_b_gpio.attr, &dev_attr_led_c_gpio.attr, &dev_attr_led_d_gpio.attr, &dev_attr_eth_reset.attr, &dev_attr_radio_power.attr, &dev_attr_radio_reset.attr, &dev_attr_radio_reset_backoffs.attr, &dev_attr_radio_reset_backoff_index.attr, &dev_attr_radio_reset_backoff_seconds.attr, NULL, }; static struct attribute *mtcdt_0_1_platform_attributes[] = { &dev_attr_vendor_id.attr, &dev_attr_product_id.attr, &dev_attr_device_id.attr, &dev_attr_uuid.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_led_status.attr, &dev_attr_led_cd_gpio.attr, &dev_attr_led_sig1_gpio.attr, &dev_attr_led_sig2_gpio.attr, &dev_attr_led_sig3_gpio.attr, &dev_attr_led_a_gpio.attr, &dev_attr_led_b_gpio.attr, &dev_attr_led_c_gpio.attr, &dev_attr_led_d_gpio.attr, &dev_attr_usbhub_reset.attr, &dev_attr_eth_reset.attr, // radio feature is last to be able to // easily remove radio. // is_radio_power_attr_mtcdt() searches // for this for truncation. &dev_attr_radio_power.attr, /* Must be first radio attribute */ &dev_attr_radio_reset.attr, &dev_attr_radio_reset_backoffs.attr, &dev_attr_radio_reset_backoff_index.attr, &dev_attr_radio_reset_backoff_seconds.attr, NULL, }; static struct attribute *mtcdt_0_1_wifi_bt_attributes[] = { &dev_attr_wifi_bt_lpwkup.attr, &dev_attr_wifi_bt_ulpwkup.attr, &dev_attr_wifi_bt_reset.attr, &dev_attr_wifi_bt_lpmode.attr, &dev_attr_wifi_bt_int.attr, }; static struct attribute *mtcdt_0_1_gnss_attributes[] = { &dev_attr_gnss_reset.attr, &dev_attr_gnss_int.attr, }; static struct attribute_group mtcdt_platform_attribute_group = { .attrs = mtcdt_platform_attributes }; static struct attribute_group mtcdt_0_1_platform_attribute_group = { .attrs = mtcdt_0_1_platform_attributes }; static int is_radio_power_attr_mtcdt(struct attribute *attr) { return (attr == &dev_attr_radio_power.attr); }