Skip to contentSkip to conversation

i2c: riic: Allow setting frequencies lower than 50KHz

PATCH Applied Claudiu 2 participants 2 messages Sep 23, 2025

Subsystems (2)
lore
Share & tools
lore

Claudiu

author
#0 lore raw

PATCH 1/1 i2c: riic: Allow setting frequencies lower than 50KHz

From: Claudiu Beznea <[email protected]>

The MR1.CKS field is 3 bits wide and all the possible values (from 0 to
7) are valid. This is true for all the SoCs currently integrated in upstream Linux. Take into account CKS=7 which allows setting bus frequencies lower than 50KHz. This may be useful at least for debugging.

Fixes d982d6651419 ("i2c: riic: remove clock and frequency restrictions")
---
 drivers/i2c/busses/i2c-riic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-riic.c +1 -1
index 9c164a4b9bb9..b0ee9ac45a97 100644
@@ -386,7 +386,7 @@ static int riic_init_hw(struct riic_dev *riic)
 	 */
 	total_ticks = DIV_ROUND_UP(rate, t->bus_freq_hz ?: 1);
 
-	for (cks = 0; cks < 7; cks++) {
+	for (cks = 0; cks <= 7; cks++) {
 		/*
 		 * 60% low time must be less than BRL + 2 + 1
 		 * BRL max register value is 0x1F.
Signature · 1 line
2.43.0
Applied
#1 lore raw
Quoted 9 lines · Claudiu

From: Claudiu Beznea <[email protected]>

The MR1.CKS field is 3 bits wide and all the possible values (from 0 to
7) are valid. This is true for all the SoCs currently integrated in upstream Linux. Take into account CKS=7 which allows setting bus frequencies lower than 50KHz. This may be useful at least for debugging.

Fixes d982d6651419 ("i2c: riic: remove clock and frequency restrictions")

Applied to for-current, thanks!