Skip to contentSkip to conversation

Support Apalis/Colibri imx6 v1.2

PATCH In review [email protected] 2 participants 4 messages Mar 7, 2025 – Mar 13, 2025 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

v2 cover Support Apalis/Colibri imx6 v1.2

From: Ernest Van Hoecke <[email protected]>

Apalis/Colibri iMX6 V1.2 will replace the STMPE811 ADC/Touch controller which is EOL by the TLA2024 ADC and AD7879 touch controller. To support this new version, we detect the presence of either the STMPE811 or TLA2024 during boot and set a new environment variable named "variant". This will allow us to select the correct DT easily.

"variant" environment variable behaviour:
- Empty or absent for all versions below v1.2 (STMPE811)
- "-v1.2" for all versions starting from v1.2 (TLA2024 + AD7879)

This behaviour is then used by the PREBOOT logic:
preboot=test -n ${fdtfile} || setenv fdtfile imx6q-apalis${variant}-${fdt_board}.dtb

v2: Fixed the "From" field
v1: https://lore.kernel.org/u-boot/[email protected]/

Ernest Van Hoecke (2):
board: toradex: apalis/colibri imx6: Detect new v1.2 SoM variant
toradex: apalis/colibri imx6: Select correct DTB for SoM v1.2+

 board/toradex/apalis_imx6/apalis_imx6.c   | 31 +++++++++++++++++++++++
 board/toradex/colibri_imx6/colibri_imx6.c | 31 +++++++++++++++++++++++
 configs/apalis_imx6_defconfig             |  2 +-
 configs/colibri_imx6_defconfig            |  2 +-
 4 files changed, 64 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/2 board: toradex: apalis/colibri imx6: Detect new v1.2 SoM variant

From: Ernest Van Hoecke <[email protected]>

Apalis/Colibri iMX6 V1.2 will replace the STMPE811 ADC/Touch controller which is EOL by the TLA2024 ADC and AD7879 touch controller.

To support this new version, we detect the presence of the TLA2024 during boot and set a new environment variable named "variant". This will allow us and users to select the correct DT easily.

By probing via I2C we have a robust detection method instead of relying on the existing "board_rev" environment variable which is set by the config block. Users can use "variant" in their DT selection and do not have to map the board revision to a device tree.

"variant" environment variable behaviour:
* Empty or absent for all versions below v1.2 (STMPE811)
* "-v1.2" for all versions starting from v1.2 (TLA2024 + AD7879)

Usage example:
setenv fdtfile imx6q-apalis${variant}-${fdt_board}.dtb

---
v2: Fixed the "From" field
v1: https://lore.kernel.org/u-boot/[email protected]/

---
 board/toradex/apalis_imx6/apalis_imx6.c   | 31 +++++++++++++++++++++++
 board/toradex/colibri_imx6/colibri_imx6.c | 31 +++++++++++++++++++++++
 2 files changed, 62 insertions(+)
board/toradex/apalis_imx6/apalis_imx6.c +31 -0
index ec0f223c4aa6..e0a7c661270e 100644
@@ -36,6 +36,7 @@
 #include <dwc_ahsata.h>
 #include <env.h>
 #include <fsl_esdhc_imx.h>
+#include <i2c.h>
 #include <imx_thermal.h>
 #include <micrel.h>
 #include <miiphy.h>
@@ -77,6 +78,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define APALIS_IMX6_SATA_INIT_RETRIES	10
 
+#define I2C_PWR	1
+
 int dram_init(void)
 {
 	/* use the DDR controllers configured size */
@@ -689,6 +692,32 @@ int board_init(void)
 	return 0;
 }
 
+static bool is_som_variant_1_2(void)
+{
+	struct udevice *bus;
+	struct udevice *i2c_dev;
+	int ret;
+
+	ret = uclass_get_device_by_seq(UCLASS_I2C, I2C_PWR, &bus);
+	if (ret) {
+		printf("Failed to get I2C_PWR\n");
+		return false;
+	}
+
+	/* V1.2 uses the TLA2024 at 0x49 instead of the STMPE811 at 0x41 */
+	ret = dm_i2c_probe(bus, 0x49, 0, &i2c_dev);
+
+	return (bool)!ret;
+}
+
+static void select_dt_from_module_version(void)
+{
+	if (is_som_variant_1_2())
+		env_set("variant", "-v1.2");
+	else
+		env_set("variant", "");
+}
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
@@ -696,6 +725,8 @@ int board_late_init(void)
 	char env_str[256];
 	u32 rev;
 
+	select_dt_from_module_version();
+
 	rev = get_board_revision();
 	snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
 	env_set("board_rev", env_str);
board/toradex/colibri_imx6/colibri_imx6.c +31 -0
index 64cf99e9cfcb..69a3c5f3dfd6 100644
@@ -33,6 +33,7 @@
 #include <cpu.h>
 #include <dm/platform_data/serial_mxc.h>
 #include <fsl_esdhc_imx.h>
+#include <i2c.h>
 #include <imx_thermal.h>
 #include <miiphy.h>
 #include <netdev.h>
@@ -71,6 +72,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define OUTPUT_RGB (PAD_CTL_SPEED_MED|PAD_CTL_DSE_60ohm|PAD_CTL_SRE_FAST)
 
+#define I2C_PWR	1
+
 int dram_init(void)
 {
 	/* use the DDR controllers configured size */
@@ -609,6 +612,32 @@ int board_init(void)
 	return 0;
 }
 
+static bool is_som_variant_1_2(void)
+{
+	struct udevice *bus;
+	struct udevice *i2c_dev;
+	int ret;
+
+	ret = uclass_get_device_by_seq(UCLASS_I2C, I2C_PWR, &bus);
+	if (ret) {
+		printf("Failed to get I2C_PWR\n");
+		return false;
+	}
+
+	/* V1.2 uses the TLA2024 at 0x49 instead of the STMPE811 at 0x41 */
+	ret = dm_i2c_probe(bus, 0x49, 0, &i2c_dev);
+
+	return (bool)!ret;
+}
+
+static void select_dt_from_module_version(void)
+{
+	if (is_som_variant_1_2())
+		env_set("variant", "-v1.2");
+	else
+		env_set("variant", "");
+}
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
@@ -616,6 +645,8 @@ int board_late_init(void)
 	char env_str[256];
 	u32 rev;
 
+	select_dt_from_module_version();
+
 	rev = get_board_revision();
 	snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
 	env_set("board_rev", env_str);
Signature · 1 line
2.43.0
reviewer
#2 lore raw

Re: [PATCH v2 1/2] board: toradex: apalis/colibri imx6: Detect new v1.2 SoM variant

Quoted 19 lines · On Fri, Mar 7, 2025 at 7:35 AM <[email protected]> wrote:

From: Ernest Van Hoecke <[email protected]>

Apalis/Colibri iMX6 V1.2 will replace the STMPE811 ADC/Touch controller which is EOL by the TLA2024 ADC and AD7879 touch controller.

To support this new version, we detect the presence of the TLA2024 during boot and set a new environment variable named "variant". This will allow us and users to select the correct DT easily.

By probing via I2C we have a robust detection method instead of relying on the existing "board_rev" environment variable which is set by the config block. Users can use "variant" in their DT selection and do not have to map the board revision to a device tree.

"variant" environment variable behaviour:
* Empty or absent for all versions below v1.2 (STMPE811)
* "-v1.2" for all versions starting from v1.2 (TLA2024 + AD7879)

Quoted 7 lines

Usage example:
setenv fdtfile imx6q-apalis${variant}-${fdt_board}.dtb

---
v2: Fixed the "From" field

Applied both to u-boot-imx/next, thanks.

#3 lore raw

PATCH v2 2/2 toradex: apalis/colibri imx6: Select correct DTB for SoM v1.2+

In reply to [email protected]

From: Ernest Van Hoecke <[email protected]>

When "fdtfile" is not set, use the "variant" environment variable to select the correct DTB.

Apalis/Colibri iMX6 V1.2 replaced the STMPE811 ADC/Touch controller which is EOL with the TLA2024 ADC and AD7879 touch controller. They thus require a different DTB, which we can easily select with the variant env variable.

---
v2: Fixed the "From" field
v1: https://lore.kernel.org/u-boot/[email protected]/

---
 configs/apalis_imx6_defconfig  | 2 +-
 configs/colibri_imx6_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configs/apalis_imx6_defconfig +1 -1
index a3f65c5c0269..f51386d10a88 100644
@@ -31,7 +31,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout serial,vidconsole; setenv stdin serial,usbkbd"
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6q-apalis-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6q-apalis${variant}-${fdt_board}.dtb"
 CONFIG_SYS_CBSIZE=1024
 CONFIG_SYS_PBSIZE=1055
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
configs/colibri_imx6_defconfig +1 -1
index 4c6ba80789b6..9fc844b32690 100644
@@ -30,7 +30,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout serial,vidconsole; setenv stdin serial,usbkbd"
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6dl-colibri-${fdt_board}.dtb"
+CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6dl-colibri${variant}-${fdt_board}.dtb"
 CONFIG_SYS_CBSIZE=1024
 CONFIG_SYS_PBSIZE=1056
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
Signature · 1 line
2.43.0