* [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
@ 2025-08-01 8:11 Jacky Bai
2025-08-01 8:11 ` [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 8:11 UTC (permalink / raw)
To: krzk, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
shawnguo
Cc: linux-pm, linux-arm-kernel, imx, kernel, festevam
The TMU used on i.MX93 has some slight differences and bugs compared with
the one used on QorIQ platforam even the basic function is the same. Add
i.MX93 specific compatible string and keep the fallback ability.
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
- v2 changes:
- keep the enum
- refine the commit log to use i.MX93 and QorIQ name
---
.../devicetree/bindings/thermal/qoriq-thermal.yaml | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
index aa756dae512a..6d8766c6a58d 100644
--- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
@@ -22,9 +22,13 @@ properties:
Value Device
---------- -----
0x01900102 T1040
- enum:
- - fsl,qoriq-tmu
- - fsl,imx8mq-tmu
+ oneOf:
+ - enum:
+ - fsl,qoriq-tmu
+ - fsl,imx8mq-tmu
+ - items:
+ - const: fsl,imx93-tmu
+ - const: fsl,qoriq-tmu
reg:
maxItems: 1
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support
2025-08-01 8:11 [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
@ 2025-08-01 8:11 ` Jacky Bai
2025-08-01 14:09 ` Frank Li
2025-08-01 8:11 ` [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump on imx93 Jacky Bai
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 8:11 UTC (permalink / raw)
To: krzk, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
shawnguo
Cc: linux-pm, linux-arm-kernel, imx, kernel, festevam
The TMU used on i.MX93 need some speccial handling and workaround to be
done even the revision info read from the ID register is the same as
Qoriq platform. Add i.MX93 compatible string and corresponding code for it.
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
- v2 changes:
- use the compatible match data to identify the i.MX93 TMU variant
---
drivers/thermal/qoriq_thermal.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 01b58be0dcc6..fd4d162fc188 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 2022-2025 NXP
#include <linux/clk.h>
#include <linux/err.h>
@@ -24,9 +25,11 @@
#define TMTMIR_DEFAULT 0x0000000f
#define TIER_DISABLE 0x0
#define TEUMR0_V2 0x51009c00
+#define TEUMR0_V21 0x55010c00
#define TMSARA_V2 0xe
#define TMU_VER1 0x1
#define TMU_VER2 0x2
+#define TMU_VER93 0x3
#define REGS_TMR 0x000 /* Mode Register */
#define TMR_DISABLE 0x0
@@ -232,6 +235,9 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
if (data->ver == TMU_VER1) {
regmap_write(data->regmap, REGS_TMTMIR, TMTMIR_DEFAULT);
+ } else if (data->ver == TMU_VER93) {
+ regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
+ regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V21);
} else {
regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V2);
@@ -312,12 +318,22 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
if (ret)
return ret;
- /* version register offset at: 0xbf8 on both v1 and v2 */
- ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver);
- if (ret)
- return dev_err_probe(dev, ret, "Failed to read IP block version\n");
+ /*
+ * for i.MX93, the TMU HW version read from the ID register does
+ * reflect the real HW implementation version, assigned the TMU
+ * version statically.
+ */
+ ver = (uintptr_t)of_device_get_match_data(&pdev->dev);
+ if (ver == TMU_VER93) {
+ data->ver = ver;
+ } else {
+ /* version register offset at: 0xbf8 on both v1 and v2 */
+ ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to read IP block version\n");
- data->ver = (ver >> 8) & 0xff;
+ data->ver = (ver >> 8) & 0xff;
+ }
qoriq_tmu_init_device(data); /* TMU initialization */
@@ -379,6 +395,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
static const struct of_device_id qoriq_tmu_match[] = {
{ .compatible = "fsl,qoriq-tmu", },
{ .compatible = "fsl,imx8mq-tmu", },
+ { .compatible = "fsl,imx93-tmu", .data = (void *) TMU_VER93 },
{},
};
MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump on imx93
2025-08-01 8:11 [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
2025-08-01 8:11 ` [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
@ 2025-08-01 8:11 ` Jacky Bai
2025-08-01 14:11 ` Frank Li
2025-08-01 8:11 ` [PATCH v2 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 8:11 UTC (permalink / raw)
To: krzk, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
shawnguo
Cc: linux-pm, linux-arm-kernel, imx, kernel, festevam
On i.MX93, the temp read from tmu may jump wrongly(ERR052243), and invalid
temp will be read out. To workaround such issue, we need to use the
raising/falling edge threshold to filter out the wrong temp. When reading
the temp, need to check the TIDR register to make sure no jump happens.
Please refer to NXP errata ERR052243 for more details.
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
drivers/thermal/qoriq_thermal.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index fd4d162fc188..664cd5f7d8af 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -46,6 +46,13 @@
#define REGS_TIER 0x020 /* Interrupt Enable Register */
#define TIER_DISABLE 0x0
+#define REGS_TIDR 0x24
+#define TMRTRCTR 0x70
+#define TMRTRCTR_EN BIT(31)
+#define TMRTRCTR_TEMP(x) ((x) & 0xFF)
+#define TMFTRCTR 0x74
+#define TMFTRCTR_EN BIT(31)
+#define TMFTRCTR_TEMP(x) ((x) & 0xFF)
#define REGS_TTCFGR 0x080 /* Temperature Configuration Register */
#define REGS_TSCFGR 0x084 /* Sensor Configuration Register */
@@ -93,7 +100,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:
*
@@ -118,6 +125,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
if (!(val & TMR_ME))
return -EAGAIN;
+ /* ERR052243: If there raising or falling edge happens, try later */
+ if (qdata->ver == TMU_VER93) {
+ regmap_read(qdata->regmap, REGS_TIDR, &tidr);
+ if (tidr & GENMASK(25, 24)) {
+ regmap_write(qdata->regmap, REGS_TIDR, GENMASK(25, 24));
+ return -EAGAIN;
+ }
+ }
+
if (regmap_read_poll_timeout(qdata->regmap,
REGS_TRITSR(qsensor->id),
val,
@@ -126,6 +142,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
10 * USEC_PER_MSEC))
return -ENODATA;
+ /*ERR052243: If there raising or falling edge happens, try later */
+ if (qdata->ver == TMU_VER93) {
+ regmap_read(qdata->regmap, REGS_TIDR, &tidr);
+ if (tidr & GENMASK(25, 24)) {
+ regmap_write(qdata->regmap, REGS_TIDR, GENMASK(25, 24));
+ return -EAGAIN;
+ }
+ }
+
if (qdata->ver == TMU_VER1) {
*temp = (val & GENMASK(7, 0)) * MILLIDEGREE_PER_DEGREE;
} else {
@@ -232,12 +257,14 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
regmap_write(data->regmap, REGS_TIER, TIER_DISABLE);
/* Set update_interval */
-
if (data->ver == TMU_VER1) {
regmap_write(data->regmap, REGS_TMTMIR, TMTMIR_DEFAULT);
} else if (data->ver == TMU_VER93) {
regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V21);
+ /* ERR052243: Set the raising & falling edge monitor */
+ regmap_write(data->regmap, TMRTRCTR, TMRTRCTR_EN | TMRTRCTR_TEMP(0x7));
+ regmap_write(data->regmap, TMFTRCTR, TMFTRCTR_EN | TMFTRCTR_TEMP(0x7));
} else {
regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V2);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 4/4] arm64: dts: imx93: update the tmu compatible string
2025-08-01 8:11 [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
2025-08-01 8:11 ` [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
2025-08-01 8:11 ` [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump on imx93 Jacky Bai
@ 2025-08-01 8:11 ` Jacky Bai
2025-08-01 8:55 ` [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
2025-08-01 14:14 ` Frank Li
4 siblings, 0 replies; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 8:11 UTC (permalink / raw)
To: krzk, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
shawnguo
Cc: linux-pm, linux-arm-kernel, imx, kernel, festevam
Update the tmu compatible string.
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
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 8a7f1cd76c76..2f1db9cbfa4e 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -544,7 +544,7 @@ clock-controller@44480000 {
};
tmu: tmu@44482000 {
- compatible = "fsl,qoriq-tmu";
+ compatible = "fsl,imx93-tmu", "fsl,qoriq-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] 12+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
2025-08-01 8:11 [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
` (2 preceding siblings ...)
2025-08-01 8:11 ` [PATCH v2 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
@ 2025-08-01 8:55 ` Krzysztof Kozlowski
2025-08-01 14:48 ` Jacky Bai
2025-08-01 14:14 ` Frank Li
4 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-01 8:55 UTC (permalink / raw)
To: Jacky Bai, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt,
conor+dt, shawnguo
Cc: linux-pm, linux-arm-kernel, imx, kernel, festevam
On 01/08/2025 10:11, Jacky Bai wrote:
> The TMU used on i.MX93 has some slight differences and bugs compared with
> the one used on QorIQ platforam even the basic function is the same. Add
> i.MX93 specific compatible string and keep the fallback ability.
>
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC. It might happen, that command when run on an older
kernel, gives you outdated entries. Therefore please be sure you base
your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline) or work on fork of kernel
(don't, instead use mainline). Just use b4 and everything should be
fine, although remember about `b4 prep --auto-to-cc` if you added new
patches to the patchset.
You missed at least devicetree list (maybe more), so this won't be
tested by automated tooling. Performing review on untested code might be
a waste of time.
Please kindly resend and include all necessary To/Cc entries.
</form letter>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support
2025-08-01 8:11 ` [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
@ 2025-08-01 14:09 ` Frank Li
2025-08-01 14:54 ` Jacky Bai
0 siblings, 1 reply; 12+ messages in thread
From: Frank Li @ 2025-08-01 14:09 UTC (permalink / raw)
To: Jacky Bai
Cc: krzk, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
shawnguo, linux-pm, linux-arm-kernel, imx, kernel, festevam
On Fri, Aug 01, 2025 at 04:11:17PM +0800, Jacky Bai wrote:
> The TMU used on i.MX93 need some speccial handling and workaround to be
> done even the revision info read from the ID register is the same as
> Qoriq platform. Add i.MX93 compatible string and corresponding code for it.
>
> Signed-off-by: Alice Guo <alice.guo@nxp.com>
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> ---
> - v2 changes:
> - use the compatible match data to identify the i.MX93 TMU variant
> ---
> drivers/thermal/qoriq_thermal.c | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index 01b58be0dcc6..fd4d162fc188 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 2022-2025 NXP
should only claim 2025.
>
> #include <linux/clk.h>
> #include <linux/err.h>
> @@ -24,9 +25,11 @@
> #define TMTMIR_DEFAULT 0x0000000f
> #define TIER_DISABLE 0x0
> #define TEUMR0_V2 0x51009c00
> +#define TEUMR0_V21 0x55010c00
> #define TMSARA_V2 0xe
> #define TMU_VER1 0x1
> #define TMU_VER2 0x2
> +#define TMU_VER93 0x3
>
> #define REGS_TMR 0x000 /* Mode Register */
> #define TMR_DISABLE 0x0
> @@ -232,6 +235,9 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
>
> if (data->ver == TMU_VER1) {
> regmap_write(data->regmap, REGS_TMTMIR, TMTMIR_DEFAULT);
> + } else if (data->ver == TMU_VER93) {
> + regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
> + regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V21);
> } else {
> regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
> regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V2);
> @@ -312,12 +318,22 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - /* version register offset at: 0xbf8 on both v1 and v2 */
> - ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver);
> - if (ret)
> - return dev_err_probe(dev, ret, "Failed to read IP block version\n");
> + /*
> + * for i.MX93, the TMU HW version read from the ID register does
> + * reflect the real HW implementation version, assigned the TMU
> + * version statically.
> + */
> + ver = (uintptr_t)of_device_get_match_data(&pdev->dev);
> + if (ver == TMU_VER93) {
> + data->ver = ver;
> + } else {
> + /* version register offset at: 0xbf8 on both v1 and v2 */
> + ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to read IP block version\n");
>
> - data->ver = (ver >> 8) & 0xff;
> + data->ver = (ver >> 8) & 0xff;
> + }
>
> qoriq_tmu_init_device(data); /* TMU initialization */
>
> @@ -379,6 +395,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
> static const struct of_device_id qoriq_tmu_match[] = {
> { .compatible = "fsl,qoriq-tmu", },
> { .compatible = "fsl,imx8mq-tmu", },
> + { .compatible = "fsl,imx93-tmu", .data = (void *) TMU_VER93 },
Now, don't prefer direct pass a ID here.
struct tmu_drv_data
{
u32 temu0; /* or other touch actual bits define, or workaround
name, ticket number ... */
}
const struct tmu_drv_data imx93_data = {
.temu0 = TEUMR0_V21;
}
Frank
> {},
> };
> MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump on imx93
2025-08-01 8:11 ` [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump on imx93 Jacky Bai
@ 2025-08-01 14:11 ` Frank Li
2025-08-01 15:10 ` Jacky Bai
0 siblings, 1 reply; 12+ messages in thread
From: Frank Li @ 2025-08-01 14:11 UTC (permalink / raw)
To: Jacky Bai
Cc: krzk, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
shawnguo, linux-pm, linux-arm-kernel, imx, kernel, festevam
On Fri, Aug 01, 2025 at 04:11:18PM +0800, Jacky Bai wrote:
> On i.MX93, the temp read from tmu may jump wrongly(ERR052243), and invalid
> temp will be read out. To workaround such issue, we need to use the
> raising/falling edge threshold to filter out the wrong temp. When reading
> the temp, need to check the TIDR register to make sure no jump happens.
>
> Please refer to NXP errata ERR052243 for more details.
Add download link here.
>
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> ---
> drivers/thermal/qoriq_thermal.c | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index fd4d162fc188..664cd5f7d8af 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -46,6 +46,13 @@
> #define REGS_TIER 0x020 /* Interrupt Enable Register */
> #define TIER_DISABLE 0x0
>
> +#define REGS_TIDR 0x24
> +#define TMRTRCTR 0x70
> +#define TMRTRCTR_EN BIT(31)
> +#define TMRTRCTR_TEMP(x) ((x) & 0xFF)
use GET_FIELD()
> +#define TMFTRCTR 0x74
> +#define TMFTRCTR_EN BIT(31)
> +#define TMFTRCTR_TEMP(x) ((x) & 0xFF)
>
> #define REGS_TTCFGR 0x080 /* Temperature Configuration Register */
> #define REGS_TSCFGR 0x084 /* Sensor Configuration Register */
> @@ -93,7 +100,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:
> *
> @@ -118,6 +125,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
> if (!(val & TMR_ME))
> return -EAGAIN;
>
> + /* ERR052243: If there raising or falling edge happens, try later */
> + if (qdata->ver == TMU_VER93) {
> + regmap_read(qdata->regmap, REGS_TIDR, &tidr);
> + if (tidr & GENMASK(25, 24)) {
> + regmap_write(qdata->regmap, REGS_TIDR, GENMASK(25, 24));
> + return -EAGAIN;
> + }
> + }
> +
> if (regmap_read_poll_timeout(qdata->regmap,
> REGS_TRITSR(qsensor->id),
> val,
> @@ -126,6 +142,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
> 10 * USEC_PER_MSEC))
> return -ENODATA;
>
> + /*ERR052243: If there raising or falling edge happens, try later */
> + if (qdata->ver == TMU_VER93) {
> + regmap_read(qdata->regmap, REGS_TIDR, &tidr);
> + if (tidr & GENMASK(25, 24)) {
> + regmap_write(qdata->regmap, REGS_TIDR, GENMASK(25, 24));
> + return -EAGAIN;
> + }
> + }
> +
> if (qdata->ver == TMU_VER1) {
> *temp = (val & GENMASK(7, 0)) * MILLIDEGREE_PER_DEGREE;
> } else {
> @@ -232,12 +257,14 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
> regmap_write(data->regmap, REGS_TIER, TIER_DISABLE);
>
> /* Set update_interval */
> -
> if (data->ver == TMU_VER1) {
> regmap_write(data->regmap, REGS_TMTMIR, TMTMIR_DEFAULT);
> } else if (data->ver == TMU_VER93) {
> regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
> regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V21);
> + /* ERR052243: Set the raising & falling edge monitor */
> + regmap_write(data->regmap, TMRTRCTR, TMRTRCTR_EN | TMRTRCTR_TEMP(0x7));
> + regmap_write(data->regmap, TMFTRCTR, TMFTRCTR_EN | TMFTRCTR_TEMP(0x7));
> } else {
> regmap_write(data->regmap, REGS_V2_TMTMIR, TMTMIR_DEFAULT);
> regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V2);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
2025-08-01 8:11 [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
` (3 preceding siblings ...)
2025-08-01 8:55 ` [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
@ 2025-08-01 14:14 ` Frank Li
2025-08-01 14:50 ` Jacky Bai
4 siblings, 1 reply; 12+ messages in thread
From: Frank Li @ 2025-08-01 14:14 UTC (permalink / raw)
To: Jacky Bai
Cc: krzk, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
shawnguo, linux-pm, linux-arm-kernel, imx, kernel, festevam
On Fri, Aug 01, 2025 at 04:11:16PM +0800, Jacky Bai wrote:
> The TMU used on i.MX93 has some slight differences and bugs compared with
> the one used on QorIQ platforam even the basic function is the same. Add
> i.MX93 specific compatible string and keep the fallback ability.
>
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> ---
> - v2 changes:
> - keep the enum
> - refine the commit log to use i.MX93 and QorIQ name
> ---
> .../devicetree/bindings/thermal/qoriq-thermal.yaml | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> index aa756dae512a..6d8766c6a58d 100644
> --- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> @@ -22,9 +22,13 @@ properties:
> Value Device
> ---------- -----
> 0x01900102 T1040
> - enum:
> - - fsl,qoriq-tmu
> - - fsl,imx8mq-tmu
> + oneOf:
> + - enum:
> + - fsl,qoriq-tmu
> + - fsl,imx8mq-tmu
> + - items:
> + - const: fsl,imx93-tmu
> + - const: fsl,qoriq-tmu
look like previous fsl,imx93-tmu have not define, which new compatible
string, and you also add it in driver, needn't fail back to fsl,qoriq-tmu
enum
- fsl,imx8mq-tmu
- fsl,imx93-tmu
- fsl,qoriq-tmu
Frank
>
> reg:
> maxItems: 1
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
2025-08-01 8:55 ` [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
@ 2025-08-01 14:48 ` Jacky Bai
0 siblings, 0 replies; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 14:48 UTC (permalink / raw)
To: Krzysztof Kozlowski, rafael@kernel.org, daniel.lezcano@linaro.org,
rui.zhang@intel.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, shawnguo@kernel.org
Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
imx@lists.linux.dev, kernel@pengutronix.de, festevam@gmail.com
> Subject: Re: [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible
> string for imx93
>
> On 01/08/2025 10:11, Jacky Bai wrote:
> > The TMU used on i.MX93 has some slight differences and bugs compared
> > with the one used on QorIQ platforam even the basic function is the
> > same. Add
> > i.MX93 specific compatible string and keep the fallback ability.
> >
> > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
>
> <form letter>
> Please use scripts/get_maintainers.pl to get a list of necessary people and
> lists to CC. It might happen, that command when run on an older kernel, gives
> you outdated entries. Therefore please be sure you base your patches on
> recent Linux kernel.
My fault. Will add all the necessary list when resend the patch. I use the get_maintainers.pl, but the
device tree list missed by mistake.
BR
>
> Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so
> fix your workflow. Tools might also fail if you work on some ancient tree (don't,
> instead use mainline) or work on fork of kernel (don't, instead use mainline).
> Just use b4 and everything should be fine, although remember about `b4 prep
> --auto-to-cc` if you added new patches to the patchset.
>
> You missed at least devicetree list (maybe more), so this won't be tested by
> automated tooling. Performing review on untested code might be a waste of
> time.
>
> Please kindly resend and include all necessary To/Cc entries.
> </form letter>
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
2025-08-01 14:14 ` Frank Li
@ 2025-08-01 14:50 ` Jacky Bai
0 siblings, 0 replies; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 14:50 UTC (permalink / raw)
To: Frank Li
Cc: krzk@kernel.org, rafael@kernel.org, daniel.lezcano@linaro.org,
rui.zhang@intel.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, shawnguo@kernel.org,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
imx@lists.linux.dev, kernel@pengutronix.de, festevam@gmail.com
> Subject: Re: [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible
> string for imx93
>
> On Fri, Aug 01, 2025 at 04:11:16PM +0800, Jacky Bai wrote:
> > The TMU used on i.MX93 has some slight differences and bugs compared
> > with the one used on QorIQ platforam even the basic function is the
> > same. Add
> > i.MX93 specific compatible string and keep the fallback ability.
> >
> > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> > ---
> > - v2 changes:
> > - keep the enum
> > - refine the commit log to use i.MX93 and QorIQ name
> > ---
> > .../devicetree/bindings/thermal/qoriq-thermal.yaml | 10
> +++++++---
> > 1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> > b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> > index aa756dae512a..6d8766c6a58d 100644
> > --- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> > +++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> > @@ -22,9 +22,13 @@ properties:
> > Value Device
> > ---------- -----
> > 0x01900102 T1040
> > - enum:
> > - - fsl,qoriq-tmu
> > - - fsl,imx8mq-tmu
> > + oneOf:
> > + - enum:
> > + - fsl,qoriq-tmu
> > + - fsl,imx8mq-tmu
> > + - items:
> > + - const: fsl,imx93-tmu
> > + - const: fsl,qoriq-tmu
>
> look like previous fsl,imx93-tmu have not define, which new compatible string,
> and you also add it in driver, needn't fail back to fsl,qoriq-tmu
>
Make sense, if no one has different opinions, will drop the fallback compatible
in next version.
BR
> enum
> - fsl,imx8mq-tmu
> - fsl,imx93-tmu
> - fsl,qoriq-tmu
>
> Frank
>
> >
> > reg:
> > maxItems: 1
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support
2025-08-01 14:09 ` Frank Li
@ 2025-08-01 14:54 ` Jacky Bai
0 siblings, 0 replies; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 14:54 UTC (permalink / raw)
To: Frank Li
Cc: krzk@kernel.org, rafael@kernel.org, daniel.lezcano@linaro.org,
rui.zhang@intel.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, shawnguo@kernel.org,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
imx@lists.linux.dev, kernel@pengutronix.de, festevam@gmail.com
> Subject: Re: [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support
>
> On Fri, Aug 01, 2025 at 04:11:17PM +0800, Jacky Bai wrote:
> > The TMU used on i.MX93 need some speccial handling and workaround to
> > be done even the revision info read from the ID register is the same
> > as Qoriq platform. Add i.MX93 compatible string and corresponding code for
> it.
> >
> > Signed-off-by: Alice Guo <alice.guo@nxp.com>
> > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> > ---
> > - v2 changes:
> > - use the compatible match data to identify the i.MX93 TMU variant
> > ---
> > drivers/thermal/qoriq_thermal.c | 27 ++++++++++++++++++++++-----
> > 1 file changed, 22 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/thermal/qoriq_thermal.c
> > b/drivers/thermal/qoriq_thermal.c index 01b58be0dcc6..fd4d162fc188
> > 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 2022-2025 NXP
>
> should only claim 2025.
>
Ok.
> >
> > #include <linux/clk.h>
> > #include <linux/err.h>
> > @@ -24,9 +25,11 @@
> > #define TMTMIR_DEFAULT 0x0000000f
> > #define TIER_DISABLE 0x0
> > #define TEUMR0_V2 0x51009c00
> > +#define TEUMR0_V21 0x55010c00
> > #define TMSARA_V2 0xe
> > #define TMU_VER1 0x1
> > #define TMU_VER2 0x2
> > +#define TMU_VER93 0x3
> >
> > #define REGS_TMR 0x000 /* Mode Register */
> > #define TMR_DISABLE 0x0
> > @@ -232,6 +235,9 @@ static void qoriq_tmu_init_device(struct
> > qoriq_tmu_data *data)
> >
> > if (data->ver == TMU_VER1) {
> > regmap_write(data->regmap, REGS_TMTMIR, TMTMIR_DEFAULT);
> > + } else if (data->ver == TMU_VER93) {
> > + regmap_write(data->regmap, REGS_V2_TMTMIR,
> TMTMIR_DEFAULT);
> > + regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V21);
> > } else {
> > regmap_write(data->regmap, REGS_V2_TMTMIR,
> TMTMIR_DEFAULT);
> > regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V2);
> @@ -312,12
> > +318,22 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
> > if (ret)
> > return ret;
> >
> > - /* version register offset at: 0xbf8 on both v1 and v2 */
> > - ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver);
> > - if (ret)
> > - return dev_err_probe(dev, ret, "Failed to read IP block
> version\n");
> > + /*
> > + * for i.MX93, the TMU HW version read from the ID register does
> > + * reflect the real HW implementation version, assigned the TMU
> > + * version statically.
> > + */
> > + ver = (uintptr_t)of_device_get_match_data(&pdev->dev);
> > + if (ver == TMU_VER93) {
> > + data->ver = ver;
> > + } else {
> > + /* version register offset at: 0xbf8 on both v1 and v2 */
> > + ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver);
> > + if (ret)
> > + return dev_err_probe(dev, ret, "Failed to read IP block
> > +version\n");
> >
> > - data->ver = (ver >> 8) & 0xff;
> > + data->ver = (ver >> 8) & 0xff;
> > + }
> >
> > qoriq_tmu_init_device(data); /* TMU initialization */
> >
> > @@ -379,6 +395,7 @@ static
> DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
> > static const struct of_device_id qoriq_tmu_match[] = {
> > { .compatible = "fsl,qoriq-tmu", },
> > { .compatible = "fsl,imx8mq-tmu", },
> > + { .compatible = "fsl,imx93-tmu", .data = (void *) TMU_VER93 },
>
> Now, don't prefer direct pass a ID here.
>
> struct tmu_drv_data
> {
> u32 temu0; /* or other touch actual bits define, or workaround
> name, ticket number ... */
> }
>
> const struct tmu_drv_data imx93_data = {
> .temu0 = TEUMR0_V21;
> }
>
Sure, will introduce a new struct to hold the match data info.
BR
> Frank
> > {},
> > };
> > MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump on imx93
2025-08-01 14:11 ` Frank Li
@ 2025-08-01 15:10 ` Jacky Bai
0 siblings, 0 replies; 12+ messages in thread
From: Jacky Bai @ 2025-08-01 15:10 UTC (permalink / raw)
To: Frank Li
Cc: krzk@kernel.org, rafael@kernel.org, daniel.lezcano@linaro.org,
rui.zhang@intel.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, shawnguo@kernel.org,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
imx@lists.linux.dev, kernel@pengutronix.de, festevam@gmail.com
> Subject: Re: [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump
> on imx93
>
> On Fri, Aug 01, 2025 at 04:11:18PM +0800, Jacky Bai wrote:
> > On i.MX93, the temp read from tmu may jump wrongly(ERR052243), and
> > invalid temp will be read out. To workaround such issue, we need to
> > use the raising/falling edge threshold to filter out the wrong temp.
> > When reading the temp, need to check the TIDR register to make sure no
> jump happens.
> >
> > Please refer to NXP errata ERR052243 for more details.
>
> Add download link here.
>
Thx, will add the url here.
> >
> > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> > ---
> > drivers/thermal/qoriq_thermal.c | 31
> +++++++++++++++++++++++++++++--
> > 1 file changed, 29 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/thermal/qoriq_thermal.c
> > b/drivers/thermal/qoriq_thermal.c index fd4d162fc188..664cd5f7d8af
> > 100644
> > --- a/drivers/thermal/qoriq_thermal.c
> > +++ b/drivers/thermal/qoriq_thermal.c
> > @@ -46,6 +46,13 @@
> > #define REGS_TIER 0x020 /* Interrupt Enable Register */
> > #define TIER_DISABLE 0x0
> >
> > +#define REGS_TIDR 0x24
> > +#define TMRTRCTR 0x70
> > +#define TMRTRCTR_EN BIT(31)
> > +#define TMRTRCTR_TEMP(x) ((x) & 0xFF)
>
> use GET_FIELD()
OK, will refine it will FILED_PREP macro.
BR
>
> > +#define TMFTRCTR 0x74
> > +#define TMFTRCTR_EN BIT(31)
> > +#define TMFTRCTR_TEMP(x) ((x) & 0xFF)
> >
> > #define REGS_TTCFGR 0x080 /* Temperature Configuration Register
> */
> > #define REGS_TSCFGR 0x084 /* Sensor Configuration Register */
> > @@ -93,7 +100,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:
> > *
> > @@ -118,6 +125,15 @@ static int tmu_get_temp(struct
> thermal_zone_device *tz, int *temp)
> > if (!(val & TMR_ME))
> > return -EAGAIN;
> >
> > + /* ERR052243: If there raising or falling edge happens, try later */
> > + if (qdata->ver == TMU_VER93) {
> > + regmap_read(qdata->regmap, REGS_TIDR, &tidr);
> > + if (tidr & GENMASK(25, 24)) {
> > + regmap_write(qdata->regmap, REGS_TIDR, GENMASK(25, 24));
> > + return -EAGAIN;
> > + }
> > + }
> > +
> > if (regmap_read_poll_timeout(qdata->regmap,
> > REGS_TRITSR(qsensor->id),
> > val,
> > @@ -126,6 +142,15 @@ static int tmu_get_temp(struct
> thermal_zone_device *tz, int *temp)
> > 10 * USEC_PER_MSEC))
> > return -ENODATA;
> >
> > + /*ERR052243: If there raising or falling edge happens, try later */
> > + if (qdata->ver == TMU_VER93) {
> > + regmap_read(qdata->regmap, REGS_TIDR, &tidr);
> > + if (tidr & GENMASK(25, 24)) {
> > + regmap_write(qdata->regmap, REGS_TIDR, GENMASK(25, 24));
> > + return -EAGAIN;
> > + }
> > + }
> > +
> > if (qdata->ver == TMU_VER1) {
> > *temp = (val & GENMASK(7, 0)) * MILLIDEGREE_PER_DEGREE;
> > } else {
> > @@ -232,12 +257,14 @@ static void qoriq_tmu_init_device(struct
> qoriq_tmu_data *data)
> > regmap_write(data->regmap, REGS_TIER, TIER_DISABLE);
> >
> > /* Set update_interval */
> > -
> > if (data->ver == TMU_VER1) {
> > regmap_write(data->regmap, REGS_TMTMIR, TMTMIR_DEFAULT);
> > } else if (data->ver == TMU_VER93) {
> > regmap_write(data->regmap, REGS_V2_TMTMIR,
> TMTMIR_DEFAULT);
> > regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V21);
> > + /* ERR052243: Set the raising & falling edge monitor */
> > + regmap_write(data->regmap, TMRTRCTR, TMRTRCTR_EN |
> TMRTRCTR_TEMP(0x7));
> > + regmap_write(data->regmap, TMFTRCTR, TMFTRCTR_EN |
> > +TMFTRCTR_TEMP(0x7));
> > } else {
> > regmap_write(data->regmap, REGS_V2_TMTMIR,
> TMTMIR_DEFAULT);
> > regmap_write(data->regmap, REGS_V2_TEUMR(0), TEUMR0_V2);
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-08-01 15:10 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 8:11 [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
2025-08-01 8:11 ` [PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
2025-08-01 14:09 ` Frank Li
2025-08-01 14:54 ` Jacky Bai
2025-08-01 8:11 ` [PATCH v2 3/4] thermal: qoriq: workaround the tmu temp jump on imx93 Jacky Bai
2025-08-01 14:11 ` Frank Li
2025-08-01 15:10 ` Jacky Bai
2025-08-01 8:11 ` [PATCH v2 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
2025-08-01 8:55 ` [PATCH v2 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
2025-08-01 14:48 ` Jacky Bai
2025-08-01 14:14 ` Frank Li
2025-08-01 14:50 ` Jacky Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox