#include "mts_io.h" #define OMAP_GPIO(BANK, GPIO) ((BANK*32)+GPIO) /* * 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_mtcdt3[] = { { .name = "RADIO_RESET", .pin = { .gpio = OMAP_GPIO(5,9), /* 5_9 */ .flags = GPIOF_OUT_INIT_HIGH, .label = "radio-reset", }, }, #if 0 /* This goes through the PMIC for now */ { .name = "RADIO_POWER", .pin = { .gpio = 0, .flags = GPIOF_OUT_INIT_HIGH, .label = "radio-power", }, }, #endif { .name = "DEVICE_RESET", .pin = { .gpio = OMAP_GPIO(1,29), .flags = GPIOF_IN, .label = "reset", }, .active_low = 1, }, { .name = "WIFI_BT_INT", .pin = { .gpio = OMAP_GPIO(4,12), /* 4_12 */ .flags = GPIOF_IN, .label = "wifi-bt-int", }, .capability = CAPA_BLUETOOTH, }, { .name = "WIFI_RESET", .pin = { .gpio = OMAP_GPIO(4,11), /* 4_11 */ .flags = GPIOF_OUT_INIT_HIGH, .label = "wifi-reset", }, .capability = CAPA_WIFI, .active_low = 1, }, { .name = "BT_RESET", .pin = { .gpio = OMAP_GPIO(4,10), /* 4_10 */ .flags = GPIOF_OUT_INIT_HIGH, .label = "bt-reset", }, .capability = CAPA_BLUETOOTH, .active_low = 1, }, { .name = "USBHUB_RESET", .pin = { .gpio = OMAP_GPIO(3, 15), .flags = GPIOF_OUT_INIT_HIGH, .label = "usbhub-reset", }, .active_low = 1, }, { .name = "ETH_RESET", .pin = { .gpio = OMAP_GPIO(4,7), /* 4_7 */ .flags = GPIOF_OUT_INIT_HIGH, .label = "eth-reset", }, .active_low = 1, }, { .name = "GNSS_INT", .pin = { .gpio = OMAP_GPIO(5,11), /* 5_11 */ .flags = GPIOF_OUT_INIT_HIGH, .label = "gnss-int", }, .capability = CAPA_GPS, }, { .name = "GNSS_RESET", .pin = { .gpio = OMAP_GPIO(5,10), /* 5_10 */ .flags = GPIOF_OUT_INIT_HIGH, .label = "gnss-reset", }, .capability = CAPA_GPS, .active_low = 1, }, #if 0 /* Link status comes directly from the MTQ out to the baseboard */ { .name = "LS_LED", .pin = { .gpio = 0, .flags = GPIOF_IN, .label = "led-ls", }, .active_low = 1, }, #endif { .name = "STATUS_LED", .pin = { .gpio = OMAP_GPIO(0, 20), .flags = GPIOF_OUT_INIT_LOW, .label = "led-status", }, }, { .name = "CD", .pin = { .gpio = OMAP_GPIO(0, 21), .flags = GPIOF_OUT_INIT_HIGH, .label = "led-cd", }, }, { .name = "LED1", .pin = { .gpio = OMAP_GPIO(4, 26), .flags = GPIOF_OUT_INIT_LOW, .label = "led-sig1", }, }, { .name = "LED2", .pin = { .gpio = OMAP_GPIO(4, 27), .flags = GPIOF_OUT_INIT_LOW, .label = "led-sig2", }, }, { .name = "LED3", .pin = { .gpio = OMAP_GPIO(4, 28), .flags = GPIOF_OUT_INIT_LOW, .label = "led-sig3", }, }, { }, }; static DEVICE_ATTR_MTS(dev_attr_wifi_reset_mtcdt3, "wifi-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_bt_reset_mtcdt3, "bt-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_int_mtcdt3, "wifi-bt-int", mts_attr_show_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_gnss_reset_mtcdt3, "gnss-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_usbhub_reset_mtcdt3, "usbhub-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_eth_reset_mtcdt3, "eth-reset", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_gnss_int_mtcdt3, "gnss-int", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_lora_reset_mtcdt3, "reset", mts_attr_show_lora_gpio_pin, mts_attr_store_lora_gpio_pin); static DEVICE_ATTR_RO_MTS(dev_attr_lora_cdone_mtcdt3, "cdone", mts_attr_show_lora_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_lora_creset_mtcdt3, "creset", mts_attr_show_lora_gpio_pin, mts_attr_store_lora_gpio_pin); static DEVICE_ATTR_RO_MTS(dev_attr_lora_eui_mtcdt3, "eui", mts_attr_show_lora_product_info); static DEVICE_ATTR_RO_MTS(dev_attr_lora_product_id_mtcdt3, "product-id", mts_attr_show_lora_product_info); static DEVICE_ATTR_RO_MTS(dev_attr_lora_hw_version_mtcdt3, "hw-version", mts_attr_show_lora_product_info); static struct attribute *mtcdt3_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_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, &dev_attr_wifi_reset_mtcdt3.attr, &dev_attr_bt_reset_mtcdt3.attr, &dev_attr_wifi_bt_int_mtcdt3.attr, &dev_attr_gnss_reset_mtcdt3.attr, &dev_attr_gnss_int_mtcdt3.attr, NULL, }; static struct attribute_group mtcdt3_platform_attribute_group = { .attrs = mtcdt3_platform_attributes }; static int is_radio_power_attr_mtcdt3(struct attribute *attr) { return (attr == &dev_attr_radio_power.attr); } static struct attribute *mtcdt3_lora_attributes[] = { &dev_attr_lora_eui_mtcdt3.attr, &dev_attr_lora_product_id_mtcdt3.attr, &dev_attr_lora_hw_version_mtcdt3.attr, &dev_attr_lora_reset_mtcdt3.attr, &dev_attr_lora_cdone_mtcdt3.attr, &dev_attr_lora_creset_mtcdt3.attr, NULL, }; static struct attribute_group mtcdt3_lora_attribute_group = { .attrs = mtcdt3_lora_attributes };