Skip to contentSkip to conversation

drm/amdgpu: Set FRU bus for Aldebaran and Vega 20

PATCH In review Luben Tuikov 2 participants 4 messages Feb 4, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Set FRU bus for Aldebaran and Vega 20

The FRU and RAS EEPROMs share the same I2C bus on Aldebaran and Vega 20 ASICs. Set the FRU bus "pointer" to this single bus, as access to the FRU is sought through that bus "pointer" and not through the RAS bus "pointer".

Cc Roy Sun <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes 9c6d2ba7057abb ("drm/amd: Expose the FRU SMU I2C bus")
---
 drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c         | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +2 -1
index 87acb089cfccd5..dd2d66090d2374 100644
@@ -741,7 +741,7 @@ int smu_v11_0_i2c_control_init(struct amdgpu_device *adev)
 	i2c_set_adapdata(control, smu_i2c);
 
 	adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
-	adev->pm.fru_eeprom_i2c_bus = NULL;
+	adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
 
 	res = i2c_add_adapter(control);
 	if (res)
@@ -756,6 +756,7 @@ void smu_v11_0_i2c_control_fini(struct amdgpu_device *adev)
 
 	i2c_del_adapter(control);
 	adev->pm.ras_eeprom_i2c_bus = NULL;
+	adev->pm.fru_eeprom_i2c_bus = NULL;
 }
 
 /*
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -0
index ba4c9771ffc56b..3d96d4af92d97f 100644
@@ -1583,6 +1583,7 @@ static int aldebaran_i2c_control_init(struct smu_context *smu)
 	}
 
 	adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
+	adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
 
 	return 0;
 Out_err:

base-commit: 24b54e10043609a55194badff58bf91189c49793
prerequisite-patch-id: d694f05bfcdf100c1d6957afa209e304dad98404
prerequisite-patch-id: b106a5bd7e0d3a7c225a767ca4384162353cca9a
prerequisite-patch-id: 77d04393fc872e4f4dd158659bd44ba40b749883

Signature · 1 line
2.35.0.3.gb23dac905b
#1 lore raw
Quoted 40 lines · Luben Tuikov

The FRU and RAS EEPROMs share the same I2C bus on Aldebaran and Vega 20 ASICs. Set the FRU bus "pointer" to this single bus, as access to the FRU is sought through that bus "pointer" and not through the RAS bus "pointer".

Cc Roy Sun <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes 9c6d2ba7057abb ("drm/amd: Expose the FRU SMU I2C bus")
---
 drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c         | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +2 -1
index 87acb089cfccd5..dd2d66090d2374 100644
@@ -741,7 +741,7 @@ int smu_v11_0_i2c_control_init(struct amdgpu_device *adev)
        i2c_set_adapdata(control, smu_i2c);
 
        adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
-       adev->pm.fru_eeprom_i2c_bus = NULL;
+       adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
 
        res = i2c_add_adapter(control);
        if (res)
@@ -756,6 +756,7 @@ void smu_v11_0_i2c_control_fini(struct amdgpu_device *adev)
 
        i2c_del_adapter(control);
        adev->pm.ras_eeprom_i2c_bus = NULL;
+       adev->pm.fru_eeprom_i2c_bus = NULL;
 }
 
 /*
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
index ba4c9771ffc56b..3d96d4af92d97f 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_i2c_control_init(struct smu_context *smu) · line 1586

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -0
@@ -1583,6 +1583,7 @@ static int aldebaran_i2c_control_init(struct smu_context *smu)
        }
 
        adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
+       adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;

Does this need to be set to NULL in control_fini() for consistency? Other than that, looks good to me.

Alex

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
        return 0;
 Out_err:
 

base-commit: 24b54e10043609a55194badff58bf91189c49793
prerequisite-patch-id: d694f05bfcdf100c1d6957afa209e304dad98404
prerequisite-patch-id: b106a5bd7e0d3a7c225a767ca4384162353cca9a
prerequisite-patch-id: 77d04393fc872e4f4dd158659bd44ba40b749883 --
2.35.0.3.gb23dac905b

#2 lore raw
Quoted 43 lines · Alex Deucher
Quoted 42 lines · Luben Tuikov

The FRU and RAS EEPROMs share the same I2C bus on Aldebaran and Vega 20 ASICs. Set the FRU bus "pointer" to this single bus, as access to the FRU is sought through that bus "pointer" and not through the RAS bus "pointer".

Cc Roy Sun <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes 9c6d2ba7057abb ("drm/amd: Expose the FRU SMU I2C bus")
---
 drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c         | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +2 -1
index 87acb089cfccd5..dd2d66090d2374 100644
@@ -741,7 +741,7 @@ int smu_v11_0_i2c_control_init(struct amdgpu_device *adev)
        i2c_set_adapdata(control, smu_i2c);
 
        adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
-       adev->pm.fru_eeprom_i2c_bus = NULL;
+       adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
 
        res = i2c_add_adapter(control);
        if (res)
@@ -756,6 +756,7 @@ void smu_v11_0_i2c_control_fini(struct amdgpu_device *adev)
 
        i2c_del_adapter(control);
        adev->pm.ras_eeprom_i2c_bus = NULL;
+       adev->pm.fru_eeprom_i2c_bus = NULL;
 }
 
 /*
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
index ba4c9771ffc56b..3d96d4af92d97f 100644
@@ -1583,6 +1583,7 @@ static int aldebaran_i2c_control_init(struct smu_context *smu)
        }
 
Quoted 5 lines

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_i2c_control_init(struct smu_context *smu) · line 1586

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -0
        adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
+       adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;

Does this need to be set to NULL in control_fini() for consistency? Other than that, looks good to me.

It already is--I didn't need to add it as I did above for Vega20.

Regards,
Luben

Quoted 15 lines

Alex

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
        return 0;
 Out_err:
 

base-commit: 24b54e10043609a55194badff58bf91189c49793
prerequisite-patch-id: d694f05bfcdf100c1d6957afa209e304dad98404
prerequisite-patch-id: b106a5bd7e0d3a7c225a767ca4384162353cca9a
prerequisite-patch-id: 77d04393fc872e4f4dd158659bd44ba40b749883 --
2.35.0.3.gb23dac905b

Regards,

Signature · 1 line
Luben
Reviewed-by
#3 lore raw
Quoted 45 lines · Luben Tuikov
Quoted 43 lines · Alex Deucher
Quoted 42 lines · Luben Tuikov

The FRU and RAS EEPROMs share the same I2C bus on Aldebaran and Vega 20 ASICs. Set the FRU bus "pointer" to this single bus, as access to the FRU is sought through that bus "pointer" and not through the RAS bus "pointer".

Cc Roy Sun <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes 9c6d2ba7057abb ("drm/amd: Expose the FRU SMU I2C bus")
---
 drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c         | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +2 -1
index 87acb089cfccd5..dd2d66090d2374 100644
@@ -741,7 +741,7 @@ int smu_v11_0_i2c_control_init(struct amdgpu_device *adev)
        i2c_set_adapdata(control, smu_i2c);
 
        adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
-       adev->pm.fru_eeprom_i2c_bus = NULL;
+       adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
 
        res = i2c_add_adapter(control);
        if (res)
@@ -756,6 +756,7 @@ void smu_v11_0_i2c_control_fini(struct amdgpu_device *adev)
 
        i2c_del_adapter(control);
        adev->pm.ras_eeprom_i2c_bus = NULL;
+       adev->pm.fru_eeprom_i2c_bus = NULL;
 }
 
 /*
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
index ba4c9771ffc56b..3d96d4af92d97f 100644
@@ -1583,6 +1583,7 @@ static int aldebaran_i2c_control_init(struct smu_context *smu)
        }
 
Quoted 7 lines
Quoted 5 lines

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_i2c_control_init(struct smu_context *smu) · line 1586

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -0
        adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
+       adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;

Does this need to be set to NULL in control_fini() for consistency? Other than that, looks good to me.

It already is--I didn't need to add it as I did above for Vega20.

In that case:

Quoted 23 lines

Regards,
Luben

Quoted 15 lines

Alex

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
        return 0;
 Out_err:
 

base-commit: 24b54e10043609a55194badff58bf91189c49793
prerequisite-patch-id: d694f05bfcdf100c1d6957afa209e304dad98404
prerequisite-patch-id: b106a5bd7e0d3a7c225a767ca4384162353cca9a
prerequisite-patch-id: 77d04393fc872e4f4dd158659bd44ba40b749883 --
2.35.0.3.gb23dac905b

Regards,
--
Luben