* [PATCH v6 0/4] Update the thermal support for imx93
@ 2026-04-30 2:53 Jacky Bai
2026-04-30 2:53 ` [PATCH v6 1/4] dt-bindings: thermal: qoriq: Add compatible string " Jacky Bai
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Jacky Bai @ 2026-04-30 2:53 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Pengutronix Kernel Team, Frank Li
Cc: linux-pm, devicetree, imx, linux-arm-kernel, Jacky Bai,
Conor Dooley, Alice Guo
The TMU (Thermal Monitoring Unit) on the i.MX93 requires specific
configurations and workarounds that differ from previous implementations.
So, using the 'fsl,qoriq-tmu' compatible string is not appropriate.
To address this, a dedicated compatible string and corresponding driver
changes need to be introduced to properly support the i.MX93 TMU.
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
Changes in v6:
- Drop the unnecessary local variable
- Drop the first errata check in get_temp function
- Link to v5: https://lore.kernel.org/r/20260421-imx93_tmu-v5-0-05ea1969bb9f@nxp.com
Changes in v5:
- Drop the unnecessary macro defines in patch 2/3
- Add the drvdata info for each of the platform as suggested by Daniel
- Link to v4: https://lore.kernel.org/r/20250821-imx93_tmu-v4-0-6cf5688bf016@nxp.com
Changes in v4:
- Include bitfield.h to fix the build error for RISC-V
- Use macro to define temp rate threshold related settings
- Link to v3: https://lore.kernel.org/r/20250818-imx93_tmu-v3-0-35f79a86c072@nxp.com
---
Jacky Bai (4):
dt-bindings: thermal: qoriq: Add compatible string for imx93
thermal: qoriq: add i.MX93 tmu support
thermal: qoriq: workaround unexpected temperature readings from tmu
arm64: dts: imx93: update the tmu compatible string
.../devicetree/bindings/thermal/qoriq-thermal.yaml | 1 +
arch/arm64/boot/dts/freescale/imx93.dtsi | 2 +-
drivers/thermal/qoriq_thermal.c | 71 ++++++++++++++++++++--
3 files changed, 69 insertions(+), 5 deletions(-)
---
base-commit: c7275b05bc428c7373d97aa2da02d3a7fa6b9f66
change-id: 20250804-imx93_tmu-7888c85d176e
Best regards,
--
Jacky Bai <ping.bai@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v6 1/4] dt-bindings: thermal: qoriq: Add compatible string for imx93
2026-04-30 2:53 [PATCH v6 0/4] Update the thermal support for imx93 Jacky Bai
@ 2026-04-30 2:53 ` Jacky Bai
2026-04-30 2:53 ` [PATCH v6 2/4] thermal: qoriq: add i.MX93 tmu support Jacky Bai
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Jacky Bai @ 2026-04-30 2:53 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Pengutronix Kernel Team, Frank Li
Cc: linux-pm, devicetree, imx, linux-arm-kernel, Jacky Bai,
Conor Dooley
Add i.MX93 compatible string 'fsl,imx93-tmu' because Thermal monitor
unit(TMU) on i.MX93 has differences with QorIQ platform and not fully
compatible with existing Platform, such as fsl,qoriq-tmu.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
- v6 changes:
- no
- v5 changes:
- no
---
Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
index aa756dae512a2c6e3f0b6bb1ab4a65c01e373ea7..f3b136f5e1cba1fff7e90678d7e3d7ec3ddd25c1 100644
--- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
@@ -25,6 +25,7 @@ properties:
enum:
- fsl,qoriq-tmu
- fsl,imx8mq-tmu
+ - fsl,imx93-tmu
reg:
maxItems: 1
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v6 2/4] thermal: qoriq: add i.MX93 tmu support
2026-04-30 2:53 [PATCH v6 0/4] Update the thermal support for imx93 Jacky Bai
2026-04-30 2:53 ` [PATCH v6 1/4] dt-bindings: thermal: qoriq: Add compatible string " Jacky Bai
@ 2026-04-30 2:53 ` Jacky Bai
2026-05-06 16:17 ` Daniel Lezcano
2026-04-30 2:53 ` [PATCH v6 3/4] thermal: qoriq: workaround unexpected temperature readings from tmu Jacky Bai
2026-04-30 2:53 ` [PATCH v6 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
3 siblings, 1 reply; 6+ messages in thread
From: Jacky Bai @ 2026-04-30 2:53 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Pengutronix Kernel Team, Frank Li
Cc: linux-pm, devicetree, imx, linux-arm-kernel, Jacky Bai, Alice Guo
For Thermal monitor unit(TMU) used on i.MX93, the HW revision info read
from the ID register is the same the one used on some of the QorIQ
platform, but the config has some slight differance. Add i.MX93 compatible
string and corresponding code for it.
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
- v6 changes:
- drop the unnecessary local teumr0_val variable
- v5 changes:
- drop the unnecessary GET_TEUMR0 helper macro
- add drvdata for each of the platforms
- v4 changes:
- no
---
drivers/thermal/qoriq_thermal.c | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 01b58be0dcc64d14ca5e4bba654eed8f15e827fc..e4b61d531e44f6927b74e79a81f1e63dda7f9aca 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
//
// Copyright 2016 Freescale Semiconductor, Inc.
+// Copyright 2025 NXP
#include <linux/clk.h>
#include <linux/err.h>
@@ -24,6 +25,7 @@
#define TMTMIR_DEFAULT 0x0000000f
#define TIER_DISABLE 0x0
#define TEUMR0_V2 0x51009c00
+#define TEUMR0_V21 0x55000c00
#define TMSARA_V2 0xe
#define TMU_VER1 0x1
#define TMU_VER2 0x2
@@ -73,12 +75,17 @@ struct qoriq_sensor {
int id;
};
+struct tmu_drvdata {
+ u32 teumr0;
+};
+
struct qoriq_tmu_data {
int ver;
u32 ttrcr[NUM_TTRCR_MAX];
struct regmap *regmap;
struct clk *clk;
struct qoriq_sensor sensor[SITES_MAX];
+ const struct tmu_drvdata *drvdata;
};
static struct qoriq_tmu_data *qoriq_sensor_to_data(struct qoriq_sensor *s)
@@ -234,7 +241,8 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
regmap_write(data->regmap, REGS_TMTMIR, TMTMIR_DEFAULT);
} else {
regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
- regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V2);
+ regmap_write(data->regmap, REGS_V2_TEUMR(0),
+ data->drvdata->teumr0);
}
/* Disable monitoring */
@@ -319,6 +327,10 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
data->ver = (ver >> 8) & 0xff;
+ data->drvdata = of_device_get_match_data(&pdev->dev);
+ if (!data->drvdata)
+ return dev_err_probe(dev, -EINVAL, "Failed to get match data\n");
+
qoriq_tmu_init_device(data); /* TMU initialization */
ret = qoriq_tmu_calibration(dev, data); /* TMU calibration */
@@ -376,9 +388,22 @@ static int qoriq_tmu_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
qoriq_tmu_suspend, qoriq_tmu_resume);
+static const struct tmu_drvdata qoriq_tmu_data = {
+ .teumr0 = TEUMR0_V2,
+};
+
+static const struct tmu_drvdata imx8mq_tmu_data = {
+ .teumr0 = TEUMR0_V2,
+};
+
+static const struct tmu_drvdata imx93_data = {
+ .teumr0 = TEUMR0_V21,
+};
+
static const struct of_device_id qoriq_tmu_match[] = {
- { .compatible = "fsl,qoriq-tmu", },
- { .compatible = "fsl,imx8mq-tmu", },
+ { .compatible = "fsl,qoriq-tmu", .data = &qoriq_tmu_data },
+ { .compatible = "fsl,imx8mq-tmu", .data = &imx8mq_tmu_data },
+ { .compatible = "fsl,imx93-tmu", .data = &imx93_data },
{},
};
MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v6 3/4] thermal: qoriq: workaround unexpected temperature readings from tmu
2026-04-30 2:53 [PATCH v6 0/4] Update the thermal support for imx93 Jacky Bai
2026-04-30 2:53 ` [PATCH v6 1/4] dt-bindings: thermal: qoriq: Add compatible string " Jacky Bai
2026-04-30 2:53 ` [PATCH v6 2/4] thermal: qoriq: add i.MX93 tmu support Jacky Bai
@ 2026-04-30 2:53 ` Jacky Bai
2026-04-30 2:53 ` [PATCH v6 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
3 siblings, 0 replies; 6+ messages in thread
From: Jacky Bai @ 2026-04-30 2:53 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Pengutronix Kernel Team, Frank Li
Cc: linux-pm, devicetree, imx, linux-arm-kernel, Jacky Bai
Invalid temperature measurements may be observed across the temperature
range specified in the device data sheet. The invalid temperature can
be read from any remote site and from any capture or report registers.
The invalid change in temperature can be positive or negative and the
resulting temperature can be outside the calibrated range, in which
case the TSR[ORL] or TSR[ORH] bit will be set.
Workaround:
Use the raising/falling edge threshold to filter out the invalid temp.
Check the TIDR register to make sure no jump happens When reading the temp.
i.MX93 ERR052243:
(https://www.nxp.com/webapp/Download?colCode=IMX93_2P87F&appType=license)
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
- v6 changes:
- remove the first errata check condition in get_temp function
- v5 changes:
- replace the check errata macro with inline function
- v4 changes:
- include bitfield.h to fix compilation errors for RISC-V
- use macro define for temp rate related setting
- v3 changes:
- refine the code with FIELD_PREP macro
- add errata doc url link and refine the commit log
---
drivers/thermal/qoriq_thermal.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index e4b61d531e44f6927b74e79a81f1e63dda7f9aca..35439ec5f8bcbd97e20ab8e770f5ee00e812da1f 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -3,6 +3,7 @@
// Copyright 2016 Freescale Semiconductor, Inc.
// Copyright 2025 NXP
+#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
@@ -30,6 +31,9 @@
#define TMU_VER1 0x1
#define TMU_VER2 0x2
+/* errata ID info define */
+#define TMU_ERR052243 BIT(0)
+
#define REGS_TMR 0x000 /* Mode Register */
#define TMR_DISABLE 0x0
#define TMR_ME 0x80000000
@@ -45,6 +49,15 @@
#define REGS_TIER 0x020 /* Interrupt Enable Register */
#define TIER_DISABLE 0x0
+#define REGS_TIDR 0x24
+#define TEMP_RATE_IRQ_MASK GENMASK(25, 24)
+#define TMRTRCTR 0x70
+#define TMRTRCTR_EN BIT(31)
+#define TMRTRCTR_TEMP_MASK GENMASK(7, 0)
+#define TMFTRCTR 0x74
+#define TMFTRCTR_EN BIT(31)
+#define TMFTRCTR_TEMP_MASK GENMASK(7, 0)
+#define TEMP_RATE_THR_LVL 0x7
#define REGS_TTCFGR 0x080 /* Temperature Configuration Register */
#define REGS_TSCFGR 0x084 /* Sensor Configuration Register */
@@ -77,6 +90,7 @@ struct qoriq_sensor {
struct tmu_drvdata {
u32 teumr0;
+ u32 tmu_errata;
};
struct qoriq_tmu_data {
@@ -88,6 +102,12 @@ struct qoriq_tmu_data {
const struct tmu_drvdata *drvdata;
};
+static inline bool qoriq_tmu_has_errata(const struct tmu_drvdata *drvdata,
+ u32 flag)
+{
+ return drvdata->tmu_errata & flag;
+}
+
static struct qoriq_tmu_data *qoriq_sensor_to_data(struct qoriq_sensor *s)
{
return container_of(s, struct qoriq_tmu_data, sensor[s->id]);
@@ -97,7 +117,7 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
{
struct qoriq_sensor *qsensor = thermal_zone_device_priv(tz);
struct qoriq_tmu_data *qdata = qoriq_sensor_to_data(qsensor);
- u32 val;
+ u32 val, tidr;
/*
* REGS_TRITSR(id) has the following layout:
*
@@ -130,6 +150,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
10 * USEC_PER_MSEC))
return -ENODATA;
+ /*ERR052243: If a raising or falling edge happens, try later */
+ if (qoriq_tmu_has_errata(qdata->drvdata, TMU_ERR052243)) {
+ regmap_read(qdata->regmap, REGS_TIDR, &tidr);
+ if (tidr & TEMP_RATE_IRQ_MASK) {
+ regmap_write(qdata->regmap, REGS_TIDR, TEMP_RATE_IRQ_MASK);
+ return -EAGAIN;
+ }
+ }
+
if (qdata->ver == TMU_VER1) {
*temp = (val & GENMASK(7, 0)) * MILLIDEGREE_PER_DEGREE;
} else {
@@ -245,6 +274,14 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
data->drvdata->teumr0);
}
+ /* ERR052243: Set the raising & falling edge monitor */
+ if (qoriq_tmu_has_errata(data->drvdata, TMU_ERR052243)) {
+ regmap_write(data->regmap, TMRTRCTR, TMRTRCTR_EN |
+ FIELD_PREP(TMRTRCTR_TEMP_MASK, TEMP_RATE_THR_LVL));
+ regmap_write(data->regmap, TMFTRCTR, TMFTRCTR_EN |
+ FIELD_PREP(TMFTRCTR_TEMP_MASK, TEMP_RATE_THR_LVL));
+
+ }
/* Disable monitoring */
regmap_write(data->regmap, REGS_TMR, TMR_DISABLE);
}
@@ -398,6 +435,7 @@ static const struct tmu_drvdata imx8mq_tmu_data = {
static const struct tmu_drvdata imx93_data = {
.teumr0 = TEUMR0_V21,
+ .tmu_errata = TMU_ERR052243,
};
static const struct of_device_id qoriq_tmu_match[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v6 4/4] arm64: dts: imx93: update the tmu compatible string
2026-04-30 2:53 [PATCH v6 0/4] Update the thermal support for imx93 Jacky Bai
` (2 preceding siblings ...)
2026-04-30 2:53 ` [PATCH v6 3/4] thermal: qoriq: workaround unexpected temperature readings from tmu Jacky Bai
@ 2026-04-30 2:53 ` Jacky Bai
3 siblings, 0 replies; 6+ messages in thread
From: Jacky Bai @ 2026-04-30 2:53 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Fabio Estevam, Pengutronix Kernel Team, Frank Li
Cc: linux-pm, devicetree, imx, linux-arm-kernel, Jacky Bai
The i.MX93 TMU node compatible need to be updated to apply the SoC
specific configuration and TMU errata workaround.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
- v6 changes:
- no
- v5 changes:
- no
- v4 changes:
- no
---
arch/arm64/boot/dts/freescale/imx93.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
index b9abe143cb567e722277960ff677d460154dfc8a..06443d52a4290f9525c320f8bcf5fba1a8435d11 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -80,7 +80,7 @@ mu1: mailbox@44230000 {
};
tmu: tmu@44482000 {
- compatible = "fsl,qoriq-tmu";
+ compatible = "fsl,imx93-tmu";
reg = <0x44482000 0x1000>;
interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX93_CLK_TMC_GATE>;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v6 2/4] thermal: qoriq: add i.MX93 tmu support
2026-04-30 2:53 ` [PATCH v6 2/4] thermal: qoriq: add i.MX93 tmu support Jacky Bai
@ 2026-05-06 16:17 ` Daniel Lezcano
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2026-05-06 16:17 UTC (permalink / raw)
To: Jacky Bai, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Fabio Estevam, Pengutronix Kernel Team,
Frank Li
Cc: linux-pm, devicetree, imx, linux-arm-kernel, Alice Guo
On 4/30/26 04:53, Jacky Bai wrote:
> For Thermal monitor unit(TMU) used on i.MX93, the HW revision info read
> from the ID register is the same the one used on some of the QorIQ
> platform, but the config has some slight differance. Add i.MX93 compatible
> string and corresponding code for it.
>
> Signed-off-by: Alice Guo <alice.guo@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> ---
[ ... ]
> + data->drvdata = of_device_get_match_data(&pdev->dev);
> + if (!data->drvdata)
> + return dev_err_probe(dev, -EINVAL, "Failed to get match data\n");
I'm not sure testing the return value is something very accurate because
it is like the code is testing itself as everything is self-encapsulated
in the driver.
> +
[ ... ]
> static const struct of_device_id qoriq_tmu_match[] = {
> - { .compatible = "fsl,qoriq-tmu", },
> - { .compatible = "fsl,imx8mq-tmu", },
> + { .compatible = "fsl,qoriq-tmu", .data = &qoriq_tmu_data },
> + { .compatible = "fsl,imx8mq-tmu", .data = &imx8mq_tmu_data },
> + { .compatible = "fsl,imx93-tmu", .data = &imx93_data },
> {},
> };
> MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-05-06 16:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 2:53 [PATCH v6 0/4] Update the thermal support for imx93 Jacky Bai
2026-04-30 2:53 ` [PATCH v6 1/4] dt-bindings: thermal: qoriq: Add compatible string " Jacky Bai
2026-04-30 2:53 ` [PATCH v6 2/4] thermal: qoriq: add i.MX93 tmu support Jacky Bai
2026-05-06 16:17 ` Daniel Lezcano
2026-04-30 2:53 ` [PATCH v6 3/4] thermal: qoriq: workaround unexpected temperature readings from tmu Jacky Bai
2026-04-30 2:53 ` [PATCH v6 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox