aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
diff options
context:
space:
mode:
authorAndrey Grodzovsky <[email protected]>2021-01-22 16:19:48 +0000
committerAlex Deucher <[email protected]>2021-07-01 04:24:39 +0000
commit2485f8cfff3898cb4dc51470f697775c27075967 (patch)
tree1b6d694e4855bff36974ed5509f321101af458a7 /drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
parentdrm/amdgpu: only set restart on first cmd of the smu i2c transaction (diff)
downloadkernel-2485f8cfff3898cb4dc51470f697775c27075967.tar.gz
kernel-2485f8cfff3898cb4dc51470f697775c27075967.zip
drm/amdgpu: Remember to wait 10ms for write buffer flush v2
EEPROM spec requests this. v2: Only to be done for write data transactions. Signed-off-by: Andrey Grodzovsky <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Reviewed-by: Luben Tuikov <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
index 105516603432..fe0e9b0c4d5a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
@@ -55,6 +55,21 @@ int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap,
r = i2c_transfer(i2c_adap, msgs, ARRAY_SIZE(msgs));
if (r <= 0)
return r;
+
+ /* Only for write data */
+ if (!msgs[1].flags)
+ /*
+ * According to EEPROM spec there is a MAX of 10 ms required for
+ * EEPROM to flush internal RX buffer after STOP was issued at the
+ * end of write transaction. During this time the EEPROM will not be
+ * responsive to any more commands - so wait a bit more.
+ *
+ * TODO Improve to wait for first ACK for slave address after
+ * internal write cycle done.
+ */
+ msleep(10);
+
+
bytes_transferred = r - EEPROM_OFFSET_LENGTH;
eeprom_addr += bytes_transferred;
msgs[0].buf[0] = ((eeprom_addr >> 8) & 0xff);