drm/amdgpu: Add EEPROM I2C address support for ip discovery
authorjsg <jsg@openbsd.org>
Thu, 14 Dec 2023 05:23:24 +0000 (05:23 +0000)
committerjsg <jsg@openbsd.org>
Thu, 14 Dec 2023 05:23:24 +0000 (05:23 +0000)
From Candice Li
a945568638acfc7d2d95de520849857506b21252 in linux-6.1.y/6.1.68
c9bdc6c3cf39df6db9c611d05fc512b1276b1cc8 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_ras_eeprom.c

index 1b615c0..1af25e0 100644 (file)
@@ -38,7 +38,7 @@
 #define EEPROM_I2C_MADDR_ARCTURUS_D342  0x0
 #define EEPROM_I2C_MADDR_SIENNA_CICHLID 0x0
 #define EEPROM_I2C_MADDR_ALDEBARAN      0x0
-#define EEPROM_I2C_MADDR_SMU_13_0_0     (0x54UL << 16)
+#define EEPROM_I2C_MADDR_54H            (0x54UL << 16)
 
 /*
  * The 2 macros bellow represent the actual size in bytes that
@@ -128,6 +128,19 @@ static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
 #endif
 }
 
+static bool __get_eeprom_i2c_addr_ip_discovery(struct amdgpu_device *adev,
+                                      struct amdgpu_ras_eeprom_control *control)
+{
+       switch (adev->ip_versions[MP1_HWIP][0]) {
+       case IP_VERSION(13, 0, 0):
+       case IP_VERSION(13, 0, 10):
+               control->i2c_address = EEPROM_I2C_MADDR_54H;
+               return true;
+       default:
+               return false;
+       }
+}
+
 static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
                                  struct amdgpu_ras_eeprom_control *control)
 {
@@ -167,13 +180,16 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
                control->i2c_address = EEPROM_I2C_MADDR_ALDEBARAN;
                break;
 
+       case CHIP_IP_DISCOVERY:
+               return __get_eeprom_i2c_addr_ip_discovery(adev, control);
+
        default:
                return false;
        }
 
        switch (adev->ip_versions[MP1_HWIP][0]) {
        case IP_VERSION(13, 0, 0):
-               control->i2c_address = EEPROM_I2C_MADDR_SMU_13_0_0;
+               control->i2c_address = EEPROM_I2C_MADDR_54H;
                break;
 
        default: