Skip to contentSkip to conversation

i2c: i801: Gate SPD instantiation on SPD Write Disable bit

PATCH Applied Saranya Gopal 3 participants 3 messages Oct 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 i2c: i801: Gate SPD instantiation on SPD Write Disable bit

From: Yo-Jung <[email protected]>

When DDR5 memory modules are present, probing the spd5118 hub requires page-selection write transactions. If the BIOS has set the SPD Write Disable (SPD_WD) bit in SMBHSTCFG, the transaction fails and wedges the controller into an unrecoverable "SMBus is busy" state.

Pass the PCH SPD Write Disable status into the SMBus core via i2c_register_spd_write_disable(). This safely skips spd5118 instantiation under write-protection while leaving legacy DDR4 (ee1004) functional.

Retain the original #ifdef CONFIG_I2C_I801_MUX preprocessor block around mux_pdev to prevent compile-time regressions when the multiplexer driver is disabled.

---
Changes in v3:
- Introduced helper function i801_register_spd() as suggested by Andy
Shevchenko. This isolates the dynamic routing logic and cleans up
the callsite in i801_probe_optional_targets(), avoiding style/preprocessor
indentation warnings.
- Added Tested-by: Mark Pearson <[email protected]> from validation
on Lenovo platforms.
- Fixed compile failure when CONFIG_I2C_I801_MUX=n in v2 by retaining the
original #ifdef structure around mux_pdev.
- Link to v2: https://lore.kernel.org/linux-i2c/20250430-for-upstream-i801-spd5118-no-instantiate-v2-2-2f54d91ae2c7@canonical.com/
Changes in v2:
- Switched to i2c_register_spd_write_disable() dynamically.
Changes in v1:
- Initial submission.

 drivers/i2c/busses/i2c-i801.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-i801.c +9 -1
index b29c99ed3883..810f61e39cad 100644
@@ -1170,6 +1170,14 @@ static void dmi_check_onboard_devices(const struct dmi_header *dm, void *adap)
 	}
 }
 
+static void i801_register_spd(struct i801_priv *priv)
+{
+	if (priv->original_hstcfg & SMBHSTCFG_SPD_WD)
+		i2c_register_spd_write_disable(&priv->adapter);
+	else
+		i2c_register_spd_write_enable(&priv->adapter);
+}
+
 /* Register optional targets */
 static void i801_probe_optional_targets(struct i801_priv *priv)
 {
@@ -1193,7 +1201,7 @@ static void i801_probe_optional_targets(struct i801_priv *priv)
 #ifdef CONFIG_I2C_I801_MUX
 	if (!priv->mux_pdev)
 #endif
-		i2c_register_spd_write_enable(&priv->adapter);
+		i801_register_spd(priv);
 }
 #else
 static void __init input_apanel_init(void) {}
Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 7 lines · Saranya Gopal

From: Yo-Jung <[email protected]>

When DDR5 memory modules are present, probing the spd5118 hub requires page-selection write transactions. If the BIOS has set the SPD Write Disable (SPD_WD) bit in SMBHSTCFG, the transaction fails and wedges the controller into an unrecoverable "SMBus is busy" state.

Quoted 7 lines

Pass the PCH SPD Write Disable status into the SMBus core via i2c_register_spd_write_disable(). This safely skips spd5118 instantiation under write-protection while leaving legacy DDR4 (ee1004) functional.

Retain the original #ifdef CONFIG_I2C_I801_MUX preprocessor block around mux_pdev to prevent compile-time regressions when the multiplexer driver is disabled.

LGTM now,

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#2 lore raw
In reply to Saranya Gopal

Hi Saranya,

Quoted 15 lines · Saranya Gopal

From: Yo-Jung <[email protected]>

When DDR5 memory modules are present, probing the spd5118 hub requires page-selection write transactions. If the BIOS has set the SPD Write Disable (SPD_WD) bit in SMBHSTCFG, the transaction fails and wedges the controller into an unrecoverable "SMBus is busy" state.

Pass the PCH SPD Write Disable status into the SMBus core via i2c_register_spd_write_disable(). This safely skips spd5118 instantiation under write-protection while leaving legacy DDR4 (ee1004) functional.

Retain the original #ifdef CONFIG_I2C_I801_MUX preprocessor block around mux_pdev to prevent compile-time regressions when the multiplexer driver is disabled.

Quoted 5 lines

pushed to i2c/i2c.

Thanks,
Andi