]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amdgpu: use spirom update wait_for helper for psp v14
authorLikun Gao <Likun.Gao@amd.com>
Tue, 13 Jun 2023 11:28:47 +0000 (19:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 14 Feb 2024 22:16:07 +0000 (17:16 -0500)
Spirom update typically requires extremely long
duration for command execution, and special helper
function to wait for it's completion.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
drivers/gpu/drm/amd/amdgpu/psp_v14_0.h

index fc4caf7526872916e51253779c3968bc8266c540..998758a1b20936e860ad5838ada0f6922c5fdd9e 100644 (file)
@@ -577,7 +577,11 @@ static int psp_v14_0_exec_spi_cmd(struct psp_context *psp, int cmd)
        WREG32_SOC15(MP0, 0, regMPASP_SMN_C2PMSG_73, 1);
 
        if (cmd == C2PMSG_CMD_SPI_UPDATE_FLASH_IMAGE)
-               return 0;
+               ret = psp_wait_for_spirom_update(psp, SOC15_REG_OFFSET(MP0, 0, regMPASP_SMN_C2PMSG_115),
+                                                MBOX_READY_FLAG, MBOX_READY_MASK, PSP_SPIROM_UPDATE_TIMEOUT);
+       else
+               ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMPASP_SMN_C2PMSG_115),
+                                  MBOX_READY_FLAG, MBOX_READY_MASK, false);
 
        ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMPASP_SMN_C2PMSG_115),
                                MBOX_READY_FLAG, MBOX_READY_MASK, false);
index cb7ee54529b4fe789f71e25baa89a0534ae27d9d..dd18ba2cfad51fb9f8228cac257158d738ac4cf2 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "amdgpu_psp.h"
 
+#define PSP_SPIROM_UPDATE_TIMEOUT   60000   /* 60s */
+
 void psp_v14_0_set_psp_funcs(struct psp_context *psp);
 
 #endif