Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Resolved offchip EEPROM I/O issue

Updated target I2C address

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: John Clements <john.clements@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

John Clements and committed by
Alex Deucher
5985ebbe 94662169

+13 -5
+12 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
··· 27 27 #include <linux/bits.h> 28 28 #include "smu_v11_0_i2c.h" 29 29 30 - #define EEPROM_I2C_TARGET_ADDR 0xA0 30 + #define EEPROM_I2C_TARGET_ADDR_ARCTURUS 0xA8 31 + #define EEPROM_I2C_TARGET_ADDR_VEGA20 0xA0 31 32 32 33 /* 33 34 * The 2 macros bellow represent the actual size in bytes that ··· 84 83 { 85 84 int ret = 0; 86 85 struct i2c_msg msg = { 87 - .addr = EEPROM_I2C_TARGET_ADDR, 86 + .addr = 0, 88 87 .flags = 0, 89 88 .len = EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE, 90 89 .buf = buff, ··· 93 92 94 93 *(uint16_t *)buff = EEPROM_HDR_START; 95 94 __encode_table_header_to_buff(&control->tbl_hdr, buff + EEPROM_ADDRESS_SIZE); 95 + 96 + msg.addr = control->i2c_address; 96 97 97 98 ret = i2c_transfer(&control->eeprom_accessor, &msg, 1); 98 99 if (ret < 1) ··· 206 203 unsigned char buff[EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE] = { 0 }; 207 204 struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr; 208 205 struct i2c_msg msg = { 209 - .addr = EEPROM_I2C_TARGET_ADDR, 206 + .addr = 0, 210 207 .flags = I2C_M_RD, 211 208 .len = EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE, 212 209 .buf = buff, ··· 216 213 217 214 switch (adev->asic_type) { 218 215 case CHIP_VEGA20: 216 + control->i2c_address = EEPROM_I2C_TARGET_ADDR_VEGA20; 219 217 ret = smu_v11_0_i2c_eeprom_control_init(&control->eeprom_accessor); 220 218 break; 221 219 222 220 case CHIP_ARCTURUS: 221 + control->i2c_address = EEPROM_I2C_TARGET_ADDR_ARCTURUS; 223 222 ret = smu_i2c_eeprom_init(&adev->smu, &control->eeprom_accessor); 224 223 break; 225 224 ··· 233 228 DRM_ERROR("Failed to init I2C controller, ret:%d", ret); 234 229 return ret; 235 230 } 231 + 232 + msg.addr = control->i2c_address; 236 233 237 234 /* Read/Create table header from EEPROM address 0 */ 238 235 ret = i2c_transfer(&control->eeprom_accessor, &msg, 1); ··· 415 408 * Update bits 16,17 of EEPROM address in I2C address by setting them 416 409 * to bits 1,2 of Device address byte 417 410 */ 418 - msg->addr = EEPROM_I2C_TARGET_ADDR | 419 - ((control->next_addr & EEPROM_ADDR_MSB_MASK) >> 15); 411 + msg->addr = control->i2c_address | 412 + ((control->next_addr & EEPROM_ADDR_MSB_MASK) >> 15); 420 413 msg->flags = write ? 0 : I2C_M_RD; 421 414 msg->len = EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE; 422 415 msg->buf = buff;
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h
··· 50 50 struct mutex tbl_mutex; 51 51 bool bus_locked; 52 52 uint32_t tbl_byte_sum; 53 + uint16_t i2c_address; // 8-bit represented address 53 54 }; 54 55 55 56 /*