All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Add Arcturus D342 page retire support
@ 2020-02-25  9:58 Clements, John
  2020-02-25 10:42 ` Zhang, Hawking
  0 siblings, 1 reply; 3+ messages in thread
From: Clements, John @ 2020-02-25  9:58 UTC (permalink / raw)
  To: amd-gfx, Zhang, Hawking


[-- Attachment #1.1: Type: text/plain, Size: 132 bytes --]

Add support for detecting Arcturus SKU to resolve the correct bad page retirement EEPROM I2C address.

Thank you,
John Clements

[-- Attachment #1.2: Type: text/html, Size: 1896 bytes --]

[-- Attachment #2: 0001-drm-amdgpu-Add-Arcturus-D342-page-retire-support.patch --]
[-- Type: application/octet-stream, Size: 3095 bytes --]

From 5b77cef31e0a5bab3ecdb0f282a58141ca01de89 Mon Sep 17 00:00:00 2001
From: John Clements <john.clements@amd.com>
Date: Tue, 25 Feb 2020 17:54:51 +0800
Subject: [PATCH] drm/amdgpu: Add Arcturus D342 page retire support

Check Arcturus SKU type to select I2C address of page retirement EEPROM

Signed-off-by: John Clements <john.clements@amd.com>
Change-Id: Iace477a3b6a13940341214d5d094c500ef9bd4f5
---
 .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c    | 57 +++++++++++++++++--
 1 file changed, 51 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
index 2a8e04895595..c30ce59b4857 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
@@ -26,9 +26,11 @@
 #include "amdgpu_ras.h"
 #include <linux/bits.h>
 #include "smu_v11_0_i2c.h"
+#include "atom.h"
 
-#define EEPROM_I2C_TARGET_ADDR_ARCTURUS  0xA8
-#define EEPROM_I2C_TARGET_ADDR_VEGA20    0xA0
+#define EEPROM_I2C_TARGET_ADDR_VEGA20    	0xA0
+#define EEPROM_I2C_TARGET_ADDR_ARCTURUS  	0xA8
+#define EEPROM_I2C_TARGET_ADDR_ARCTURUS_D342  	0xA0
 
 /*
  * The 2 macros bellow represent the actual size in bytes that
@@ -55,6 +57,50 @@
 
 #define to_amdgpu_device(x) (container_of(x, struct amdgpu_ras, eeprom_control))->adev
 
+static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
+				       uint16_t *i2c_addr)
+{
+	struct atom_context *atom_ctx = adev->mode_info.atom_context;
+
+	if (!i2c_addr || !atom_ctx)
+		return false;
+
+	if (strnstr(atom_ctx->vbios_version,
+	            "D342",
+		    sizeof(atom_ctx->vbios_version)))
+	{
+		*i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS_D342;
+	}
+	else
+	{
+		*i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS;
+	}
+
+	return true;
+}
+
+static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
+				  uint16_t *i2c_addr)
+{
+	if (!i2c_addr)
+		return false;
+
+	switch (adev->asic_type) {
+	case CHIP_VEGA20:
+		*i2c_addr = EEPROM_I2C_TARGET_ADDR_VEGA20;
+		break;
+
+	case CHIP_ARCTURUS:
+		return __get_eeprom_i2c_addr_arct(adev, i2c_addr);
+		break;
+
+	default:
+		return false;
+	}
+
+	return true;
+}
+
 static void __encode_table_header_to_buff(struct amdgpu_ras_eeprom_table_header *hdr,
 					  unsigned char *buff)
 {
@@ -103,8 +149,6 @@ static int __update_table_header(struct amdgpu_ras_eeprom_control *control,
 	return ret;
 }
 
-
-
 static uint32_t  __calc_hdr_byte_sum(struct amdgpu_ras_eeprom_control *control)
 {
 	int i;
@@ -212,16 +256,17 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
 			.buf	= buff,
 	};
 
+	if (!__get_eeprom_i2c_addr(adev, &control->i2c_address))
+		return -EINVAL;
+
 	mutex_init(&control->tbl_mutex);
 
 	switch (adev->asic_type) {
 	case CHIP_VEGA20:
-		control->i2c_address = EEPROM_I2C_TARGET_ADDR_VEGA20;
 		ret = smu_v11_0_i2c_eeprom_control_init(&control->eeprom_accessor);
 		break;
 
 	case CHIP_ARCTURUS:
-		control->i2c_address = EEPROM_I2C_TARGET_ADDR_ARCTURUS;
 		ret = smu_i2c_eeprom_init(&adev->smu, &control->eeprom_accessor);
 		break;
 
-- 
2.17.1


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: Add Arcturus D342 page retire support
  2020-02-25  9:58 [PATCH] drm/amdgpu: Add Arcturus D342 page retire support Clements, John
@ 2020-02-25 10:42 ` Zhang, Hawking
  2020-02-25 11:04   ` Chen, Guchun
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Hawking @ 2020-02-25 10:42 UTC (permalink / raw)
  To: Clements, John, amd-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1024 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Please fix your coding style in the follow if/else code segment by removing the unnecessary {}. Other than that, the patch is

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>

+             if (strnstr(atom_ctx->vbios_version,
+                         "D342",
+                                 sizeof(atom_ctx->vbios_version)))
+             {
+                             *i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS_D342;
+             }
+             else
+             {
+                             *i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS;
+             }

Regards,
Hawking
From: Clements, John <John.Clements@amd.com>
Sent: Tuesday, February 25, 2020 17:58
To: amd-gfx@lists.freedesktop.org; Zhang, Hawking <Hawking.Zhang@amd.com>
Subject: [PATCH] drm/amdgpu: Add Arcturus D342 page retire support

Add support for detecting Arcturus SKU to resolve the correct bad page retirement EEPROM I2C address.

Thank you,
John Clements

[-- Attachment #1.2: Type: text/html, Size: 4989 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: Add Arcturus D342 page retire support
  2020-02-25 10:42 ` Zhang, Hawking
@ 2020-02-25 11:04   ` Chen, Guchun
  0 siblings, 0 replies; 3+ messages in thread
From: Chen, Guchun @ 2020-02-25 11:04 UTC (permalink / raw)
  To: Zhang, Hawking, Clements, John, amd-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1656 bytes --]

[AMD Public Use]

case CHIP_ARCTURUS:
+                           return __get_eeprom_i2c_addr_arct(adev, i2c_addr);
+                           break;

This 'break' is not needed. Please remove it.

Regards,
Guchun

From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Zhang, Hawking
Sent: Tuesday, February 25, 2020 6:42 PM
To: Clements, John <John.Clements@amd.com>; amd-gfx@lists.freedesktop.org
Subject: RE: [PATCH] drm/amdgpu: Add Arcturus D342 page retire support


[AMD Official Use Only - Internal Distribution Only]

Please fix your coding style in the follow if/else code segment by removing the unnecessary {}. Other than that, the patch is

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com<mailto:Hawking.Zhang@amd.com>>

+             if (strnstr(atom_ctx->vbios_version,
+                         "D342",
+                                 sizeof(atom_ctx->vbios_version)))
+             {
+                             *i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS_D342;
+             }
+             else
+             {
+                             *i2c_addr = EEPROM_I2C_TARGET_ADDR_ARCTURUS;
+             }

Regards,
Hawking
From: Clements, John <John.Clements@amd.com<mailto:John.Clements@amd.com>>
Sent: Tuesday, February 25, 2020 17:58
To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>; Zhang, Hawking <Hawking.Zhang@amd.com<mailto:Hawking.Zhang@amd.com>>
Subject: [PATCH] drm/amdgpu: Add Arcturus D342 page retire support

Add support for detecting Arcturus SKU to resolve the correct bad page retirement EEPROM I2C address.

Thank you,
John Clements

[-- Attachment #1.2: Type: text/html, Size: 7138 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-25 11:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25  9:58 [PATCH] drm/amdgpu: Add Arcturus D342 page retire support Clements, John
2020-02-25 10:42 ` Zhang, Hawking
2020-02-25 11:04   ` Chen, Guchun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.