diff options
author | Serhii Voloshynov <serhii.voloshynov@globallogic.com> | 2021-11-04 17:32:54 +0200 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2021-11-12 13:00:01 -0600 |
commit | 52c9be2be10509ff55078e3d654be5d2067648bf (patch) | |
tree | 53147cf59cf7af68db23c73f91f0fd8695871173 | |
parent | fd7782082655dbe5c2b99ae3be59d80d04d44b22 (diff) | |
download | mtac-mfser-52c9be2be10509ff55078e3d654be5d2067648bf.tar.gz mtac-mfser-52c9be2be10509ff55078e3d654be5d2067648bf.tar.bz2 mtac-mfser-52c9be2be10509ff55078e3d654be5d2067648bf.zip |
[MTCDT-0.2 4f4cf83] [MTX-4240] New Hardware R.5.3.X: MTCDT - New Hardware Suppor
-rw-r--r-- | mtac_mfser.c | 108 |
1 files changed, 39 insertions, 69 deletions
diff --git a/mtac_mfser.c b/mtac_mfser.c index d8548cb..c10bed7 100644 --- a/mtac_mfser.c +++ b/mtac_mfser.c @@ -12,6 +12,11 @@ #include <linux/slab.h> #include <linux/mtac.h> #include <linux/mts_io.h> +#include <linux/mts_io_module.h> + +#include <linux/mtac.h> +#include <linux/mtac_pin_defs.h> + #ifdef TI43X #include <linux/ti43x_gpio.h> #endif @@ -19,77 +24,33 @@ #include <linux/sam9g25_gpio.h> #endif -static struct gpio_pin gpio_pins_mtac_mfser[] = { +static struct gpio_pin gpio_pins_mtcdt_mtac_mfser[] = { // gpio pins for Accessory Card 1 - { - .name = "AP1_GPIO1", - .pin = { - .gpio = M_AP1_GPIO1, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap1-gpio1", - }, - .active_low = 1, - }, - { - .name = "AP1_GPIO2", - .pin = { - .gpio = M_AP1_GPIO2, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap1-gpio2", - } - }, - { - .name = "AP1_GPIO3", - .pin = { - .gpio = M_AP1_GPIO3, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap1-gpio3", - } - }, - { - .name = "AP1_GPIO4", - .pin = { - .gpio = M_AP1_GPIO4, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap1-gpio4", - } - }, - + AP1_GPIO1, + AP1_GPIO2, + AP1_GPIO3, + AP1_GPIO4, // gpio pins for Accessory Card 2 - { - .name = "AP2_GPIO1", - .pin = { - .gpio = M_AP2_GPIO1, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap2-gpio1", - }, - .active_low = 1, - }, - { - .name = "AP2_GPIO2", - .pin = { - .gpio = M_AP2_GPIO2, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap2-gpio2", - } - }, - { - .name = "AP2_GPIO3", - .pin = { - .gpio = M_AP2_GPIO3, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap2-gpio3", - } - }, - { - .name = "AP2_GPIO4", - .pin = { - .gpio = M_AP2_GPIO4, - .flags = GPIOF_OUT_INIT_LOW, - .label = "ap2-gpio4", - } - }, + AP2_GPIO1, + AP2_GPIO2, + AP2_GPIO3, + AP2_GPIO4, + { }, +}; + +static struct gpio_pin gpio_pins_mtcdt_0_2_mtac_mfser[] = { + // gpio pins for Accessory Card 1 + AP1_GPIO1, + AP1_GPIO2, + AP1_GPIO3_MTCDT0_2, + AP1_GPIO4_MTCDT0_2, + + // gpio pins for Accessory Card 2 + AP2_GPIO1, + AP2_GPIO2, + AP2_GPIO3_MTCDT0_2, + AP2_GPIO4_MTCDT0_2, { }, }; @@ -264,6 +225,7 @@ static bool mfser_setup(enum ap port) { struct kobj_attribute* attr; struct attribute **attrs; struct kobject *subdir; + char *tmp, *hw_version; log_info("loading MFSER accessory card in port %d", port); @@ -274,7 +236,15 @@ static bool mfser_setup(enum ap port) { return false; } - mtac_set_port_pins(port_index,gpio_pins_mtac_mfser,subdir); + hw_version = mts_get_hw_version(); + if ((tmp=HW_VERSION_MTCDT_0_2),strncmp(hw_version, tmp, strlen(tmp)) == 0){ + log_info("MTCDT-0.2 detected"); + mtac_set_port_pins(port_index,gpio_pins_mtcdt_0_2_mtac_mfser,subdir); + } + else { + log_info("%s detected, MTCDT pinout used", hw_version); + mtac_set_port_pins(port_index,gpio_pins_mtcdt_mtac_mfser,subdir); + }; // create the link to the apX directory this card is in // if we're in the first slot, we get plain "mfser" |