Skip to content

Commit 3b8164f

Browse files
Luben Tuikovalexdeucher
authored andcommitted
drm/amdgpu: Decouple RAS EEPROM addresses from chips
Abstract RAS I2C EEPROM addresses from chip names, and set their macro definition names to the address they set, not the chip they attach to. Since most chips either use I2C EEPROM address 0 or 40000h for the RAS table start offset, this leaves us with only two macro definitions as opposed to five, and removes the redundancy of four. Cc: Candice Li <[email protected]> Cc: Tao Zhou <[email protected]> Cc: Alex Deucher <[email protected]> Signed-off-by: Luben Tuikov <[email protected]> Reviewed-by: Kent Russell <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent da858de commit 3b8164f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@
5151
* Depending on the size of the I2C EEPROM device(s), bits 18:16 may
5252
* address memory in a device or a device on the I2C bus, depending on
5353
* the status of pins 1-3. See top of amdgpu_eeprom.c.
54+
*
55+
* The RAS table lives either at address 0 or address 40000h of EEPROM.
5456
*/
55-
#define EEPROM_I2C_MADDR_VEGA20 0x0
56-
#define EEPROM_I2C_MADDR_ARCTURUS 0x40000
57-
#define EEPROM_I2C_MADDR_ARCTURUS_D342 0x0
58-
#define EEPROM_I2C_MADDR_SIENNA_CICHLID 0x0
59-
#define EEPROM_I2C_MADDR_ALDEBARAN 0x0
57+
#define EEPROM_I2C_MADDR_0 0x0
58+
#define EEPROM_I2C_MADDR_4 0x40000
6059

6160
/*
6261
* The 2 macros bellow represent the actual size in bytes that
@@ -135,9 +134,9 @@ static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
135134
if (strnstr(atom_ctx->vbios_version,
136135
"D342",
137136
sizeof(atom_ctx->vbios_version)))
138-
control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS_D342;
137+
control->i2c_address = EEPROM_I2C_MADDR_0;
139138
else
140-
control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS;
139+
control->i2c_address = EEPROM_I2C_MADDR_4;
141140

142141
return true;
143142
}
@@ -148,7 +147,7 @@ static bool __get_eeprom_i2c_addr_ip_discovery(struct amdgpu_device *adev,
148147
switch (adev->ip_versions[MP1_HWIP][0]) {
149148
case IP_VERSION(13, 0, 0):
150149
case IP_VERSION(13, 0, 10):
151-
control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS;
150+
control->i2c_address = EEPROM_I2C_MADDR_4;
152151
return true;
153152
default:
154153
return false;
@@ -180,18 +179,18 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
180179

181180
switch (adev->asic_type) {
182181
case CHIP_VEGA20:
183-
control->i2c_address = EEPROM_I2C_MADDR_VEGA20;
182+
control->i2c_address = EEPROM_I2C_MADDR_0;
184183
break;
185184

186185
case CHIP_ARCTURUS:
187186
return __get_eeprom_i2c_addr_arct(adev, control);
188187

189188
case CHIP_SIENNA_CICHLID:
190-
control->i2c_address = EEPROM_I2C_MADDR_SIENNA_CICHLID;
189+
control->i2c_address = EEPROM_I2C_MADDR_0;
191190
break;
192191

193192
case CHIP_ALDEBARAN:
194-
control->i2c_address = EEPROM_I2C_MADDR_ALDEBARAN;
193+
control->i2c_address = EEPROM_I2C_MADDR_0;
195194
break;
196195

197196
case CHIP_IP_DISCOVERY:
@@ -203,7 +202,7 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
203202

204203
switch (adev->ip_versions[MP1_HWIP][0]) {
205204
case IP_VERSION(13, 0, 0):
206-
control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS;
205+
control->i2c_address = EEPROM_I2C_MADDR_4;
207206
break;
208207

209208
default:

0 commit comments

Comments
 (0)