[PATCH 2/2] clk: stm32mp13: remove LSE from the RNG1 clock sources

Gabriel Fernandez gabriel.fernandez at foss.st.com
Fri Nov 27 02:36:18 PST 2026


On STM32MP13 silicon cut 1.1, the value 0b10 of the RNG1SRC field of
RCC_RNG1CKSELR is reserved: LSE can no longer be selected as the RNG1
kernel clock source.

Simply dropping ck_lse from the parents of rng1_k is not enough: the
parent index would no longer match the register value, and ck_lsi,
encoded as 0b11, would be at index 2, so selecting it would write the
reserved value 0b10. Remove ck_lse and describe the remaining parents
(ck_csi, pll4_r and ck_lsi) with a mux table { 0, 1, 3 }, so that the
reserved value is never written to the register.

If the register holds a value that is not in the table, for instance if
LSE was left selected by an earlier boot stage, rng1_k is reported as an
orphan instead of being given a wrong parent.

rng1_k is not registered when RNG1 is secured (RNG1SECF set), so this
only concerns configurations where Linux owns RNG1.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez at foss.st.com>
---
 drivers/clk/stm32/clk-stm32mp13.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/stm32/clk-stm32mp13.c b/drivers/clk/stm32/clk-stm32mp13.c
index 90c4bfe1b2c4..fb0d5e0cc4a3 100644
--- a/drivers/clk/stm32/clk-stm32mp13.c
+++ b/drivers/clk/stm32/clk-stm32mp13.c
@@ -352,20 +352,28 @@ enum enum_mux_cfg {
 	MUX_NB
 };
 
-#define _CFG_MUX(_id, _offset, _shift, _witdh, _ready, _flags)\
+#define _CFG_MUX(_id, _offset, _shift, _witdh, _ready, _table, _num_table, _flags)\
 	[_id] = {\
 		.offset		= (_offset),\
 		.shift		= (_shift),\
 		.width		= (_witdh),\
 		.ready		= (_ready),\
+		.table		= (_table),\
+		.num_table	= (_num_table),\
 		.flags		= (_flags),\
 	}
 
 #define CFG_MUX(_id, _offset, _shift, _witdh)\
-	_CFG_MUX(_id, _offset, _shift, _witdh, MUX_NO_RDY, 0)
+	_CFG_MUX(_id, _offset, _shift, _witdh, MUX_NO_RDY, NULL, 0, 0)
+
+#define CFG_MUX_TABLE(_id, _offset, _shift, _witdh, _table)\
+	_CFG_MUX(_id, _offset, _shift, _witdh, MUX_NO_RDY, _table, ARRAY_SIZE(_table), 0)
 
 #define CFG_MUX_SAFE(_id, _offset, _shift, _witdh)\
-	_CFG_MUX(_id, _offset, _shift, _witdh, MUX_NO_RDY, MUX_SAFE)
+	_CFG_MUX(_id, _offset, _shift, _witdh, MUX_NO_RDY, NULL, 0, MUX_SAFE)
+
+/* RCC_RNG1CKSELR value 0b10 is reserved */
+static const u32 rng1_mux_table[] = { 0, 1, 3 };
 
 static const struct stm32_mux_cfg stm32mp13_muxes[] = {
 	CFG_MUX(MUX_I2C12,	RCC_I2C12CKSELR,	0, 3),
@@ -387,7 +395,7 @@ static const struct stm32_mux_cfg stm32mp13_muxes[] = {
 	CFG_MUX(MUX_LPTIM3,	RCC_LPTIM23CKSELR,	3, 3),
 	CFG_MUX(MUX_MCO1,	RCC_MCO1CFGR,		0, 3),
 	CFG_MUX(MUX_MCO2,	RCC_MCO2CFGR,		0, 3),
-	CFG_MUX(MUX_RNG1,	RCC_RNG1CKSELR,		0, 2),
+	CFG_MUX_TABLE(MUX_RNG1,	RCC_RNG1CKSELR,		0, 2, rng1_mux_table),
 	CFG_MUX(MUX_SAES,	RCC_SAESCKSELR,		0, 2),
 	CFG_MUX(MUX_SAI1,	RCC_SAI1CKSELR,		0, 3),
 	CFG_MUX(MUX_SAI2,	RCC_SAI2CKSELR,		0, 3),
@@ -586,7 +594,7 @@ static const char * const qspi_src[] = {
 };
 
 static const char * const rng1_src[] = {
-	"ck_csi", "pll4_r", "ck_lse", "ck_lsi"
+	"ck_csi", "pll4_r", "ck_lsi"
 };
 
 static const char * const saes_src[] = {

-- 
2.43.0




More information about the linux-arm-kernel mailing list