linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
@ 2025-07-29  2:40 Jacky Bai
  2025-07-29  2:40 ` [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jacky Bai @ 2025-07-29  2:40 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
	shawnguo
  Cc: linux-pm, devicetree, linux-arm-kernel, imx, kernel, festevam

The TMU used on i.MX93 has some slight differances and bugs compared to
the one used on qoriq platform even the basic function is the same. Add
imx93 specific compatible string and keep the fallback ability.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
 .../devicetree/bindings/thermal/qoriq-thermal.yaml       | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
index aa756dae512a..cc65e210e26b 100644
--- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
@@ -22,9 +22,12 @@ properties:
             Value           Device
             ----------      -----
             0x01900102      T1040
-    enum:
-      - fsl,qoriq-tmu
-      - fsl,imx8mq-tmu
+    oneOf:
+      - const: fsl,qoriq-tmu
+      - const: fsl,imx8mq-tmu
+      - items:
+          - const: fsl,imx93-tmu
+          - const: fsl,qoriq-tmu
 
   reg:
     maxItems: 1
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
  2025-07-29  2:40 [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
@ 2025-07-29  2:40 ` Jacky Bai
  2025-07-29  6:42   ` Krzysztof Kozlowski
  2025-07-29  2:40 ` [PATCH 3/4] thermal: qoriq: workaround the tmu temp jump on imx93 Jacky Bai
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Jacky Bai @ 2025-07-29  2:40 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
	shawnguo
  Cc: linux-pm, devicetree, 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>
---
 drivers/thermal/qoriq_thermal.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 01b58be0dcc6..fc1bf102350d 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);
@@ -319,6 +325,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 
 	data->ver = (ver >> 8) & 0xff;
 
+	if (of_find_compatible_node(NULL, NULL, "fsl,imx93-tmu"))
+		data->ver = TMU_VER93;
+
 	qoriq_tmu_init_device(data);	/* TMU initialization */
 
 	ret = qoriq_tmu_calibration(dev, data);	/* TMU calibration */
@@ -379,6 +388,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", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] thermal: qoriq: workaround the tmu temp jump on imx93
  2025-07-29  2:40 [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
  2025-07-29  2:40 ` [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
@ 2025-07-29  2:40 ` Jacky Bai
  2025-07-29  2:40 ` [PATCH 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
  2025-07-29  6:41 ` [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
  3 siblings, 0 replies; 10+ messages in thread
From: Jacky Bai @ 2025-07-29  2:40 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
	shawnguo
  Cc: linux-pm, devicetree, 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 fc1bf102350d..9405a8359ab2 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] 10+ messages in thread

* [PATCH 4/4] arm64: dts: imx93: update the tmu compatible string
  2025-07-29  2:40 [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
  2025-07-29  2:40 ` [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
  2025-07-29  2:40 ` [PATCH 3/4] thermal: qoriq: workaround the tmu temp jump on imx93 Jacky Bai
@ 2025-07-29  2:40 ` Jacky Bai
  2025-07-29  6:41 ` [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
  3 siblings, 0 replies; 10+ messages in thread
From: Jacky Bai @ 2025-07-29  2:40 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, robh, krzk+dt, conor+dt,
	shawnguo
  Cc: linux-pm, devicetree, 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] 10+ messages in thread

* Re: [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
  2025-07-29  2:40 [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
                   ` (2 preceding siblings ...)
  2025-07-29  2:40 ` [PATCH 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
@ 2025-07-29  6:41 ` Krzysztof Kozlowski
  2025-07-29  6:52   ` Jacky Bai
  3 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-29  6:41 UTC (permalink / raw)
  To: Jacky Bai, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt,
	conor+dt, shawnguo
  Cc: linux-pm, devicetree, linux-arm-kernel, imx, kernel, festevam

On 29/07/2025 04:40, Jacky Bai wrote:
> The TMU used on i.MX93 has some slight differances and bugs compared to

Typo

> the one used on qoriq platform even the basic function is the same. Add

qoriq? Qoriq?

> imx93 specific compatible string and keep the fallback ability.

imx93? I.MX93? Can you use proper names for OWN products?

> 
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> ---
>  .../devicetree/bindings/thermal/qoriq-thermal.yaml       | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> index aa756dae512a..cc65e210e26b 100644
> --- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> @@ -22,9 +22,12 @@ properties:
>              Value           Device
>              ----------      -----
>              0x01900102      T1040
> -    enum:
> -      - fsl,qoriq-tmu
> -      - fsl,imx8mq-tmu
> +    oneOf:
> +      - const: fsl,qoriq-tmu
> +      - const: fsl,imx8mq-tmu


That's still enum. Don't change that.

> +      - items:
> +          - const: fsl,imx93-tmu
> +          - const: fsl,qoriq-tmu
>  
>    reg:
>      maxItems: 1


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
  2025-07-29  2:40 ` [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
@ 2025-07-29  6:42   ` Krzysztof Kozlowski
  2025-07-29  8:02     ` Jacky Bai
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-29  6:42 UTC (permalink / raw)
  To: Jacky Bai, rafael, daniel.lezcano, rui.zhang, robh, krzk+dt,
	conor+dt, shawnguo
  Cc: linux-pm, devicetree, linux-arm-kernel, imx, kernel, festevam

On 29/07/2025 04:40, 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>
> ---
>  drivers/thermal/qoriq_thermal.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index 01b58be0dcc6..fc1bf102350d 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);
> @@ -319,6 +325,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
>  
>  	data->ver = (ver >> 8) & 0xff;
>  
> +	if (of_find_compatible_node(NULL, NULL, "fsl,imx93-tmu"))
> +		data->ver = TMU_VER93;

No, you have driver match data for this.

Anyway, are you sure devices are compatible how you expressed in the
bindings?

> +
>  	qoriq_tmu_init_device(data);	/* TMU initialization */
>  
>  	ret = qoriq_tmu_calibration(dev, data);	/* TMU calibration */
> @@ -379,6 +388,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", },

Otherwise I claim devices are compatible and this should be dropped.



Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93
  2025-07-29  6:41 ` [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
@ 2025-07-29  6:52   ` Jacky Bai
  0 siblings, 0 replies; 10+ messages in thread
From: Jacky Bai @ 2025-07-29  6:52 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, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
	kernel@pengutronix.de, festevam@gmail.com

> Subject: Re: [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string
> for imx93
> 
> On 29/07/2025 04:40, Jacky Bai wrote:
> > The TMU used on i.MX93 has some slight differances and bugs compared to
> 
> Typo
> 

Thx, will fix it.

> > the one used on qoriq platform even the basic function is the same. Add
> 
> qoriq? Qoriq?
> 

QorIQ. Will fix it.

> > imx93 specific compatible string and keep the fallback ability.
> 
> imx93? I.MX93? Can you use proper names for OWN products?
> 

i.MX93. will fix it.

> >
> > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> > ---
> >  .../devicetree/bindings/thermal/qoriq-thermal.yaml       | 9
> ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> > index aa756dae512a..cc65e210e26b 100644
> > --- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> > +++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
> > @@ -22,9 +22,12 @@ properties:
> >              Value           Device
> >              ----------      -----
> >              0x01900102      T1040
> > -    enum:
> > -      - fsl,qoriq-tmu
> > -      - fsl,imx8mq-tmu
> > +    oneOf:
> > +      - const: fsl,qoriq-tmu
> > +      - const: fsl,imx8mq-tmu
> 
> 
> That's still enum. Don't change that.

Thx, will fix it.

BR
Jacky Bai
> 
> > +      - items:
> > +          - const: fsl,imx93-tmu
> > +          - const: fsl,qoriq-tmu
> >
> >    reg:
> >      maxItems: 1
> 
> 
> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
  2025-07-29  6:42   ` Krzysztof Kozlowski
@ 2025-07-29  8:02     ` Jacky Bai
  2025-07-29  8:07       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 10+ messages in thread
From: Jacky Bai @ 2025-07-29  8:02 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, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
	kernel@pengutronix.de, festevam@gmail.com

> Subject: Re: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
> 
...

> > +325,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
> >
> >  	data->ver = (ver >> 8) & 0xff;
> >
> > +	if (of_find_compatible_node(NULL, NULL, "fsl,imx93-tmu"))
> > +		data->ver = TMU_VER93;
> 
> No, you have driver match data for this.
> 

No compatible specific data info provided in the driver, will use
the 'of_device_is_compatible' to refine the above changes.

> Anyway, are you sure devices are compatible how you expressed in the
> bindings?
> 

The tmu hardware version read from the ID register is not designed as expected.
With the qoriq compatible, the tmu device can work on i.MX93. but for i.MX93,
the Central Module Configuration value suggested by design is not the same as on
QorIQ platform, and there is a TMU SW workaround need be applied on i.MX93
due to HW bug.

BR
Jacky Bai
> > +
> >  	qoriq_tmu_init_device(data);	/* TMU initialization */
> >
> >  	ret = qoriq_tmu_calibration(dev, data);	/* TMU calibration */
> > @@ -379,6 +388,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", },
> 
> Otherwise I claim devices are compatible and this should be dropped.
> 
> 
> 
> Best regards,
> Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
  2025-07-29  8:02     ` Jacky Bai
@ 2025-07-29  8:07       ` Krzysztof Kozlowski
  2025-07-29  8:21         ` Jacky Bai
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-29  8:07 UTC (permalink / raw)
  To: Jacky Bai, 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, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
	kernel@pengutronix.de, festevam@gmail.com

On 29/07/2025 10:02, Jacky Bai wrote:
>> Subject: Re: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
>>
> ...
> 
>>> +325,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
>>>
>>>  	data->ver = (ver >> 8) & 0xff;
>>>
>>> +	if (of_find_compatible_node(NULL, NULL, "fsl,imx93-tmu"))
>>> +		data->ver = TMU_VER93;
>>
>> No, you have driver match data for this.
>>
> 
> No compatible specific data info provided in the driver, will use
> the 'of_device_is_compatible' to refine the above changes.

Again, no. This does not scale, use standard methods.

NAK

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
  2025-07-29  8:07       ` Krzysztof Kozlowski
@ 2025-07-29  8:21         ` Jacky Bai
  0 siblings, 0 replies; 10+ messages in thread
From: Jacky Bai @ 2025-07-29  8:21 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, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
	kernel@pengutronix.de, festevam@gmail.com

> Subject: Re: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
> 
> On 29/07/2025 10:02, Jacky Bai wrote:
> >> Subject: Re: [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support
> >>
> > ...
> >
> >>> +325,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
> >>>
> >>>  	data->ver = (ver >> 8) & 0xff;
> >>>
> >>> +	if (of_find_compatible_node(NULL, NULL, "fsl,imx93-tmu"))
> >>> +		data->ver = TMU_VER93;
> >>
> >> No, you have driver match data for this.
> >>
> >
> > No compatible specific data info provided in the driver, will use the
> > 'of_device_is_compatible' to refine the above changes.
> 
> Again, no. This does not scale, use standard methods.
> 

thx, got it. Will refine this to use the compatible match data struct.

BR 

> NAK
> 
> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-07-29  8:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29  2:40 [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Jacky Bai
2025-07-29  2:40 ` [PATCH 2/4] thermal: qoriq: add i.MX93 TMU support Jacky Bai
2025-07-29  6:42   ` Krzysztof Kozlowski
2025-07-29  8:02     ` Jacky Bai
2025-07-29  8:07       ` Krzysztof Kozlowski
2025-07-29  8:21         ` Jacky Bai
2025-07-29  2:40 ` [PATCH 3/4] thermal: qoriq: workaround the tmu temp jump on imx93 Jacky Bai
2025-07-29  2:40 ` [PATCH 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
2025-07-29  6:41 ` [PATCH 1/4] dt-bindings: thermal: qoriq: Update compatible string for imx93 Krzysztof Kozlowski
2025-07-29  6:52   ` Jacky Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).