Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/gmbus: Add Wa_16025573575 for PTL for bit-bashing
@ 2025-06-12  7:53 Ankit Nautiyal
  2025-06-12  9:05 ` ✓ CI.checkpatch: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Ankit Nautiyal @ 2025-06-12  7:53 UTC (permalink / raw)
  To: intel-gfx, intel-xe

As per Wa_16025573575 for PTL, set the GPIO masks bit before starting
bit-bashing and maintain value through the bit-bashing sequence.
After bit-bashing sequence is done, clear the GPIO masks bits.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_gmbus.c | 38 +++++++++++++++++++---
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_gmbus.c b/drivers/gpu/drm/i915/display/intel_gmbus.c
index 0d73f32fe7f1..c96167c70228 100644
--- a/drivers/gpu/drm/i915/display/intel_gmbus.c
+++ b/drivers/gpu/drm/i915/display/intel_gmbus.c
@@ -242,10 +242,17 @@ static u32 get_reserved(struct intel_gmbus *bus)
 	struct intel_display *display = bus->display;
 	u32 reserved = 0;
 
-	/* On most chips, these bits must be preserved in software. */
-	if (!display->platform.i830 && !display->platform.i845g)
-		reserved = intel_de_read_notrace(display, bus->gpio_reg) &
-			(GPIO_DATA_PULLUP_DISABLE | GPIO_CLOCK_PULLUP_DISABLE);
+	if (!display->platform.i830 && !display->platform.i845g) {
+		/* On most chips, these bits must be preserved in software. */
+		u32 preserve_bits = GPIO_DATA_PULLUP_DISABLE | GPIO_CLOCK_PULLUP_DISABLE;
+
+		/* PTL: Wa_16025573575: the masks bits need to be preserved through out */
+		if (DISPLAY_VER(display) == 30)
+			preserve_bits |= GPIO_CLOCK_DIR_MASK | GPIO_CLOCK_VAL_MASK |
+					 GPIO_DATA_DIR_MASK | GPIO_DATA_VAL_MASK;
+
+		reserved = intel_de_read_notrace(display, bus->gpio_reg) & preserve_bits;
+	}
 
 	return reserved;
 }
@@ -308,6 +315,23 @@ static void set_data(void *data, int state_high)
 	intel_de_posting_read(display, bus->gpio_reg);
 }
 
+/* PTL: Wa_16025573575 */
+static void
+ptl_handle_mask_bits(struct intel_gmbus *bus, bool set)
+{
+	struct intel_display *display = bus->display;
+	u32 reg_val = intel_de_read_notrace(display, bus->gpio_reg);
+	u32 mask_bits = GPIO_CLOCK_DIR_MASK | GPIO_CLOCK_VAL_MASK |
+			GPIO_DATA_DIR_MASK | GPIO_DATA_VAL_MASK;
+	if (set)
+		reg_val |= mask_bits;
+	else
+		reg_val &= ~mask_bits;
+
+	intel_de_write_notrace(display, bus->gpio_reg, reg_val);
+	intel_de_posting_read(display, bus->gpio_reg);
+}
+
 static int
 intel_gpio_pre_xfer(struct i2c_adapter *adapter)
 {
@@ -319,6 +343,9 @@ intel_gpio_pre_xfer(struct i2c_adapter *adapter)
 	if (display->platform.pineview)
 		pnv_gmbus_clock_gating(display, false);
 
+	if (DISPLAY_VER(display) == 30)
+		ptl_handle_mask_bits(bus, true);
+
 	set_data(bus, 1);
 	set_clock(bus, 1);
 	udelay(I2C_RISEFALL_TIME);
@@ -336,6 +363,9 @@ intel_gpio_post_xfer(struct i2c_adapter *adapter)
 
 	if (display->platform.pineview)
 		pnv_gmbus_clock_gating(display, true);
+
+	if (DISPLAY_VER(display) == 30)
+		ptl_handle_mask_bits(bus, false);
 }
 
 static void
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-06-15 15:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12  7:53 [PATCH] drm/i915/gmbus: Add Wa_16025573575 for PTL for bit-bashing Ankit Nautiyal
2025-06-12  9:05 ` ✓ CI.checkpatch: success for " Patchwork
2025-06-12  9:06 ` ✓ CI.KUnit: " Patchwork
2025-06-12  9:17 ` ✓ CI.Build: " Patchwork
2025-06-12  9:58 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-12 12:00 ` [PATCH] " Gustavo Sousa
2025-06-13  6:15   ` Nautiyal, Ankit K
2025-06-13  9:13     ` Jani Nikula
2025-06-13 10:23       ` Gustavo Sousa
2025-06-13 10:38         ` Jani Nikula
2025-06-15 15:17       ` Nautiyal, Ankit K
2025-06-12 21:08 ` ✗ Xe.CI.Full: failure for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox