summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Niebel <[email protected]>2026-07-13 15:01:05 +0200
committerFabio Estevam <[email protected]>2026-07-27 13:05:07 -0300
commit17abea6ca04921bf13d6c4f199e6baa83b0e9fb6 (patch)
treea50cdfd359d58bb7229deef4e241aca3560a589a
parentc6bf5b6a14e32196b889ff4b27611f883ae3f448 (diff)
board: tqma6: implement ENET errata workaround detection
TQMa6 SOM beginning with hardware rev. 0200 comes in two flavours: With and without a hardware workaround for ENET errata err006687. Therefore we need two flavours of device tree. To be able to detect the presence of the workaround we need to check GPIO1_6 is connected to I2C bus or not. If the I2C bus is detected, the workaround is not used and separate I2C buses are used for the SoM and the baseboard. Later on this detection will be used to select the correct devicetree at runtime. Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Max Merchel <[email protected]>
-rw-r--r--board/tq/tqma6/tqma6.c58
-rw-r--r--board/tq/tqma6/tqma6.h13
2 files changed, 71 insertions, 0 deletions
diff --git a/board/tq/tqma6/tqma6.c b/board/tq/tqma6/tqma6.c
index 005f08c4e5f..b740ac7d5b1 100644
--- a/board/tq/tqma6/tqma6.c
+++ b/board/tq/tqma6/tqma6.c
@@ -31,6 +31,18 @@
DECLARE_GLOBAL_DATA_PTR;
+/*
+ * Rev. 0200 and newer optionally implements GIGE errata fix.
+ * Use a global var to signal presence of the fix. This should be checked
+ * early. If fix is present, system I2C is I2C1 - otherwise I2C3
+ */
+static int has_enet_workaround = -1;
+
+int tqma6_has_enet_workaround(void)
+{
+ return has_enet_workaround;
+}
+
int dram_init(void)
{
gd->ram_size = imx_ddr_size();
@@ -38,6 +50,36 @@ int dram_init(void)
return 0;
}
+#define GPIO_REVDET_PAD_CTRL (PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_LOW | \
+ PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
+
+static const iomux_v3_cfg_t tqma6_revdet_pads[] = {
+ MX6_PAD_GPIO_6__GPIO1_IO06 | MUX_PAD_CTRL(GPIO_REVDET_PAD_CTRL),
+};
+
+void tqma6_detect_enet_workaround(void)
+{
+ int ret;
+ struct gpio_desc desc;
+
+ imx_iomux_v3_setup_multiple_pads(tqma6_revdet_pads,
+ ARRAY_SIZE(tqma6_revdet_pads));
+
+ ret = dm_gpio_lookup_name("GPIO1_6", &desc);
+ if (ret) {
+ pr_err("error: gpio lookup for enet workaround %d\n", ret);
+ return;
+ }
+
+ ret = dm_gpio_get_value(&desc);
+ if (ret == 0)
+ has_enet_workaround = 1;
+ else if (ret > 0)
+ has_enet_workaround = 0;
+
+ dm_gpio_free(NULL, &desc);
+}
+
int board_early_init_f(void)
{
return tq_bb_board_early_init_f();
@@ -99,11 +141,27 @@ int board_late_init(void)
{
env_set("board_name", tqma6_get_boardname());
+ tqma6_detect_enet_workaround();
+
tq_bb_board_late_init();
printf("Board: %s on a %s\n", tqma6_get_boardname(),
tq_bb_get_boardname());
+ puts("Enet workaround: ");
+ switch (tqma6_has_enet_workaround()) {
+ case 0:
+ puts("absent");
+ break;
+ case 1:
+ puts("implemented");
+ break;
+ default:
+ puts("Unknown");
+ break;
+ };
+ puts("\n");
+
return tq_bb_checkboard();
}
diff --git a/board/tq/tqma6/tqma6.h b/board/tq/tqma6/tqma6.h
new file mode 100644
index 00000000000..0cf38a4d1e3
--- /dev/null
+++ b/board/tq/tqma6/tqma6.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2023-2026 TQ-Systems GmbH <[email protected]>,
+ * D-82229 Seefeld, Germany.
+ * Author: Paul Gerber
+ */
+
+#ifndef __TQMA6_H
+#define __TQMA6_H
+
+int tqma6_has_enet_workaround(void);
+
+#endif /* __TQMA6_H */