[PATCH 2/2] drm/amdgpu: Retry i2c transfer once if it fails

Lazar, Lijo Lijo.Lazar at amd.com
Tue Sep 10 14:05:47 UTC 2024


[AMD Official Use Only - AMD Internal Distribution Only]

The ideal place is -
        smu_v13_0_6_request_i2c_xfer

Restricts the change to specific SOCs with collision problem.
Gives a bit more survival chance with a retry on every chunk requested.

Thanks,
Lijo
-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Kent Russell
Sent: Tuesday, September 10, 2024 7:07 PM
To: amd-gfx at lists.freedesktop.org
Cc: Russell, Kent <Kent.Russell at amd.com>
Subject: [PATCH 2/2] drm/amdgpu: Retry i2c transfer once if it fails

During init, there can be some collisions on the i2c bus that result in the EEPROM read failing. This has been mitigated in the PMFW to a degree, but there is still a small chance that the bus will be busy.
When the read fails during RAS init, that disables page retirement altogether, which is obviously not ideal. To try to avoid that situation, set the eeprom_read function to retry once if the first read fails.

Signed-off-by: Kent Russell <kent.russell at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
index 35fee3e8cde2..32755a37dcef 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
@@ -227,8 +227,14 @@ int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,
                       u32 eeprom_addr, u8 *eeprom_buf,
                       u32 bytes)
 {
-       return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,
+       int ret;
+
+       ret = amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,
+                                 true);
+       if (ret)
+               ret = amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,
                                  true);
+       return ret;
 }

 int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap,
--
2.34.1



More information about the amd-gfx mailing list