Skip to content

Commit 0061030

Browse files
Demon000dlezcano
authored andcommitted
thermal: renesas: rzg3e: add support for RZ/T2H and RZ/N2H
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs expose the temperature calibration via SMC SIP and do not have a reset for the TSU peripheral, and use different minimum and maximum temperature values compared to the already supported RZ/G3E. Although the calibration data is stored in an OTP memory, the OTP itself is not memory-mapped, access to it is done through an OTP controller. The OTP controller is only accessible from the secure world, but the temperature calibration data stored in the OTP is exposed via SMC. Add support for retrieving the calibration data using arm_smcc_smc(). Add a compatible for RZ/T2H, RZ/N2H can use it as a fallback. Reviewed-by: John Madieu <john.madieu.xa@bp.renesas.com> Tested-by: John Madieu <john.madieu.xa@bp.renesas.com> Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://patch.msgid.link/20260108195223.193531-6-cosmin-gabriel.tanislav.xa@renesas.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent f41eaaa commit 0061030

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/thermal/renesas/rzg3e_thermal.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
* Copyright (C) 2025 Renesas Electronics Corporation
66
*/
7+
#include <linux/arm-smccc.h>
78
#include <linux/clk.h>
89
#include <linux/cleanup.h>
910
#include <linux/delay.h>
@@ -70,6 +71,10 @@
7071
#define TSU_POLL_DELAY_US 10 /* Polling interval */
7172
#define TSU_MIN_CLOCK_RATE 24000000 /* TSU_PCLK minimum 24MHz */
7273

74+
#define RZ_SIP_SVC_GET_SYSTSU 0x82000022
75+
#define OTP_TSU_REG_ADR_TEMPHI 0x01DC
76+
#define OTP_TSU_REG_ADR_TEMPLO 0x01DD
77+
7378
struct rzg3e_thermal_priv;
7479

7580
struct rzg3e_thermal_info {
@@ -362,6 +367,21 @@ static int rzg3e_thermal_get_syscon_trim(struct rzg3e_thermal_priv *priv)
362367
return 0;
363368
}
364369

370+
static int rzg3e_thermal_get_smc_trim(struct rzg3e_thermal_priv *priv)
371+
{
372+
struct arm_smccc_res local_res;
373+
374+
arm_smccc_smc(RZ_SIP_SVC_GET_SYSTSU, OTP_TSU_REG_ADR_TEMPLO,
375+
0, 0, 0, 0, 0, 0, &local_res);
376+
priv->trmval0 = local_res.a0 & TSU_CODE_MAX;
377+
378+
arm_smccc_smc(RZ_SIP_SVC_GET_SYSTSU, OTP_TSU_REG_ADR_TEMPHI,
379+
0, 0, 0, 0, 0, 0, &local_res);
380+
priv->trmval1 = local_res.a0 & TSU_CODE_MAX;
381+
382+
return 0;
383+
}
384+
365385
static int rzg3e_thermal_probe(struct platform_device *pdev)
366386
{
367387
struct device *dev = &pdev->dev;
@@ -524,8 +544,15 @@ static const struct rzg3e_thermal_info rzg3e_thermal_info = {
524544
.temp_e_mc = 126000,
525545
};
526546

547+
static const struct rzg3e_thermal_info rzt2h_thermal_info = {
548+
.get_trim = rzg3e_thermal_get_smc_trim,
549+
.temp_d_mc = -40000,
550+
.temp_e_mc = 125000,
551+
};
552+
527553
static const struct of_device_id rzg3e_thermal_dt_ids[] = {
528554
{ .compatible = "renesas,r9a09g047-tsu", .data = &rzg3e_thermal_info },
555+
{ .compatible = "renesas,r9a09g077-tsu", .data = &rzt2h_thermal_info },
529556
{ /* sentinel */ }
530557
};
531558
MODULE_DEVICE_TABLE(of, rzg3e_thermal_dt_ids);

0 commit comments

Comments
 (0)