From 52c9be2be10509ff55078e3d654be5d2067648bf Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Thu, 4 Nov 2021 17:32:54 +0200 Subject: [MTCDT-0.2 4f4cf83] [MTX-4240] New Hardware R.5.3.X: MTCDT - New Hardware Suppor --- mtac_mfser.c | 108 +++++++++++++++++++++-------------------------------------- 1 file 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 #include #include +#include + +#include +#include + #ifdef TI43X #include #endif @@ -19,77 +24,33 @@ #include #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" -- cgit v1.2.3