[PATCH v2 2/4] thermal: qoriq: add i.MX93 TMU support
Frank Li
Frank.li at nxp.com
Fri Aug 1 07:09:06 PDT 2025
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 at nxp.com>
> Signed-off-by: Jacky Bai <ping.bai at 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
>
More information about the linux-arm-kernel
mailing list