From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Jacky Bai <ping.bai@nxp.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
Alice Guo <alice.guo@nxp.com>, Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH v4 2/4] thermal: qoriq: add i.MX93 tmu support
Date: Fri, 19 Sep 2025 17:51:20 +0200 [thread overview]
Message-ID: <d9392dbc-806a-41df-8992-28c3d6132309@linaro.org> (raw)
In-Reply-To: <20250821-imx93_tmu-v4-2-6cf5688bf016@nxp.com>
On 21/08/2025 08:23, 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>
> ---
> - v4 changes:
> - no
>
> - v3 changes:
> - use the drv data struct for match data and refine the code
> - update the copyright
>
> - v2 changes:
> - use the compatible match data to identify the i.MX93 TMU variant
> ---
> drivers/thermal/qoriq_thermal.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index 01b58be0dcc64d14ca5e4bba654eed8f15e827fc..b2e634547271dcf512c714907baa162921d2d527 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
> @@ -66,6 +68,8 @@
> */
> #define REGS_V2_TEUMR(n) (0xf00 + 4 * (n))
>
> +#define GET_TEUMR0(drvdata) (drvdata && drvdata->teumr0 ? drvdata->teumr0 : TEUMR0_V2)
This is not adequate for code which will evolve. Please don't use this
macro.
> /*
> * Thermal zone data
> */
> @@ -73,12 +77,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;
The drvdata pointer is not usually used.
u32 model;
> };
>
> static struct qoriq_tmu_data *qoriq_sensor_to_data(struct qoriq_sensor *s)
> @@ -234,7 +243,7 @@ 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), GET_TEUMR0(data->drvdata));
regmap_write(data->regmap, REGS_V2_TEUMR(0), data->model);
> }
>
> /* Disable monitoring */
> @@ -319,6 +328,8 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
>
> data->ver = (ver >> 8) & 0xff;
>
> + data->drvdata = of_device_get_match_data(&pdev->dev);
> +
> qoriq_tmu_init_device(data); /* TMU initialization */
>
> ret = qoriq_tmu_calibration(dev, data); /* TMU calibration */
> @@ -376,9 +387,14 @@ 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 imx93_data = {
> + .teumr0 = TEUMR0_V21,
> +};
> +
Do the change for everyone
static const struct tmu_drvdata imx8mq_data = {
.model = TEUMR0_V2,
};
static const struct tmu_drvdata qoriq_data = {
.model = TEUMR0_V2,
};
> static const struct of_device_id qoriq_tmu_match[] = {
> { .compatible = "fsl,qoriq-tmu", },
> { .compatible = "fsl,imx8mq-tmu", },
> + { .compatible = "fsl,imx93-tmu", .data = &imx93_data },
> {},
> };
> MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
Thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2025-09-19 15:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 6:23 [PATCH v4 0/4] Update the thermal support for imx93 Jacky Bai
2025-08-21 6:23 ` [PATCH v4 1/4] dt-bindings: thermal: qoriq: Add compatible string " Jacky Bai
2025-08-21 6:23 ` [PATCH v4 2/4] thermal: qoriq: add i.MX93 tmu support Jacky Bai
2025-09-19 15:51 ` Daniel Lezcano [this message]
2025-09-19 16:25 ` Frank Li
2025-09-19 16:42 ` Daniel Lezcano
2025-08-21 6:23 ` [PATCH v4 3/4] thermal: qoriq: workaround unexpected temperature readings from tmu Jacky Bai
2025-08-21 14:49 ` Frank Li
2025-08-21 6:23 ` [PATCH v4 4/4] arm64: dts: imx93: update the tmu compatible string Jacky Bai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d9392dbc-806a-41df-8992-28c3d6132309@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=Frank.Li@nxp.com \
--cc=alice.guo@nxp.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=ping.bai@nxp.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).