Skip to content

Commit 1f64fa3

Browse files
ppailletdlezcano
authored andcommitted
thermal: stm32: Disable interrupts at probe
In case of CPU reset, the interrupts could be enabled at boot time. Disable interrupts and clear flags. Signed-off-by: Pascal Paillet <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d4a7e05 commit 1f64fa3

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

drivers/thermal/st/stm_thermal.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
/* DTS_DR register mask definitions */
5252
#define TS1_MFREQ_MASK GENMASK(15, 0)
5353

54+
/* DTS_ITENR register mask definitions */
55+
#define ITENR_MASK (GENMASK(2, 0) | GENMASK(6, 4))
56+
57+
/* DTS_ICIFR register mask definitions */
58+
#define ICIFR_MASK (GENMASK(2, 0) | GENMASK(6, 4))
59+
5460
/* Less significant bit position definitions */
5561
#define TS1_T0_POS 16
5662
#define TS1_SMP_TIME_POS 16
@@ -330,12 +336,10 @@ static int stm_disable_irq(struct stm_thermal_sensor *sensor)
330336
{
331337
u32 value;
332338

333-
/* Disable IT generation for low and high thresholds */
339+
/* Disable IT generation */
334340
value = readl_relaxed(sensor->base + DTS_ITENR_OFFSET);
335-
writel_relaxed(value & ~(LOW_THRESHOLD | HIGH_THRESHOLD),
336-
sensor->base + DTS_ITENR_OFFSET);
337-
338-
dev_dbg(sensor->dev, "%s: IT disabled on sensor side", __func__);
341+
value &= ~ITENR_MASK;
342+
writel_relaxed(value, sensor->base + DTS_ITENR_OFFSET);
339343

340344
return 0;
341345
}
@@ -645,6 +649,11 @@ static int stm_thermal_probe(struct platform_device *pdev)
645649
return PTR_ERR(sensor->clk);
646650
}
647651

652+
stm_disable_irq(sensor);
653+
654+
/* Clear irq flags */
655+
writel_relaxed(ICIFR_MASK, sensor->base + DTS_ICIFR_OFFSET);
656+
648657
/* Register IRQ into GIC */
649658
ret = stm_register_irq(sensor);
650659
if (ret)

0 commit comments

Comments
 (0)