Skip to contentSkip to conversation

drm/amdgpu: fix xclk freq on CHIP_STONEY

PATCH Applied Chia-I Wu 2 participants 5 messages Jun 1, 2023 – Jun 5, 2023

Subsystems (2)
lore
Share & tools
lore

Chia-I Wu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix xclk freq on CHIP_STONEY

According to Alex, most APUs from that time seem to have the same issue (vbios says 48Mhz, actual is 100Mhz). I only have a CHIP_STONEY so I limit the fixup to CHIP_STONEY

---
 drivers/gpu/drm/amd/amdgpu/vi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vi.c +9 -2
index 770f2d7a371fc..6a8494f98d3ef 100644
@@ -542,8 +542,15 @@ static u32 vi_get_xclk(struct amdgpu_device *adev)
 	u32 reference_clock = adev->clock.spll.reference_freq;
 	u32 tmp;
 
-	if (adev->flags & AMD_IS_APU)
-		return reference_clock;
+	if (adev->flags & AMD_IS_APU) {
+		switch (adev->asic_type) {
+		case CHIP_STONEY:
+			/* vbios says 48Mhz, but the actual freq is 100Mhz */
+			return 10000;
+		default:
+			return reference_clock;
+		}
+	}
 
 	tmp = RREG32_SMC(ixCG_CLKPIN_CNTL_2);
 	if (REG_GET_FIELD(tmp, CG_CLKPIN_CNTL_2, MUX_TCLK_TO_XCLK))
Signature · 1 line
2.41.0.rc0.172.g3f132b7071-goog
Applied
#1 lore raw

Applied. Thanks!

Alex

Quoted 33 lines · Chia-I Wu

According to Alex, most APUs from that time seem to have the same issue (vbios says 48Mhz, actual is 100Mhz). I only have a CHIP_STONEY so I limit the fixup to CHIP_STONEY

---
 drivers/gpu/drm/amd/amdgpu/vi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vi.c +9 -3
index 770f2d7a371fc..6a8494f98d3ef 100644
@@ -542,8 +542,15 @@ static u32 vi_get_xclk(struct amdgpu_device *adev)
        u32 reference_clock = adev->clock.spll.reference_freq;
        u32 tmp;
 
-       if (adev->flags & AMD_IS_APU)
-               return reference_clock;
+       if (adev->flags & AMD_IS_APU) {
+               switch (adev->asic_type) {
+               case CHIP_STONEY:
+                       /* vbios says 48Mhz, but the actual freq is 100Mhz */
+                       return 10000;
+               default:
+                       return reference_clock;
+               }
+       }
 
        tmp = RREG32_SMC(ixCG_CLKPIN_CNTL_2);
        if (REG_GET_FIELD(tmp, CG_CLKPIN_CNTL_2, MUX_TCLK_TO_XCLK))
--

2.41.0.rc0.172.g3f132b7071-goog

#2 lore raw

Nevermind, missing your Signed-off-by. Please add and I'll apply.

Alex

Quoted 39 lines · Alex Deucher

Applied. Thanks!

Alex

Quoted 33 lines · Chia-I Wu

According to Alex, most APUs from that time seem to have the same issue (vbios says 48Mhz, actual is 100Mhz). I only have a CHIP_STONEY so I limit the fixup to CHIP_STONEY

---
 drivers/gpu/drm/amd/amdgpu/vi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vi.c +9 -3
index 770f2d7a371fc..6a8494f98d3ef 100644
@@ -542,8 +542,15 @@ static u32 vi_get_xclk(struct amdgpu_device *adev)
        u32 reference_clock = adev->clock.spll.reference_freq;
        u32 tmp;
 
-       if (adev->flags & AMD_IS_APU)
-               return reference_clock;
+       if (adev->flags & AMD_IS_APU) {
+               switch (adev->asic_type) {
+               case CHIP_STONEY:
+                       /* vbios says 48Mhz, but the actual freq is 100Mhz */
+                       return 10000;
+               default:
+                       return reference_clock;
+               }
+       }
 
        tmp = RREG32_SMC(ixCG_CLKPIN_CNTL_2);
        if (REG_GET_FIELD(tmp, CG_CLKPIN_CNTL_2, MUX_TCLK_TO_XCLK))
--

2.41.0.rc0.172.g3f132b7071-goog

author
#3 lore raw
Quoted 2 lines · Alex Deucher

Nevermind, missing your Signed-off-by. Please add and I'll apply.

Sorry that I keep forgetting... This patch is

I can send v2 if necessary.

Quoted 3 lines

Alex

Applied
#4 lore raw

Applied. Thanks!

Quoted 12 lines · Chia-I Wu
Quoted 2 lines · Alex Deucher

Nevermind, missing your Signed-off-by. Please add and I'll apply.

Sorry that I keep forgetting... This patch is

I can send v2 if necessary.

Quoted 3 lines

Alex