From: Likun Gao Date: Tue, 13 Jun 2023 11:28:47 +0000 (+0800) Subject: drm/amdgpu: use spirom update wait_for helper for psp v14 X-Git-Tag: v6.9-rc1~126^2~18^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f19cb916151d929db70e2ddc5929d713c1aff97e;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu: use spirom update wait_for helper for psp v14 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 Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c index fc4caf7526872..998758a1b2093 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c @@ -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); diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h index cb7ee54529b4f..dd18ba2cfad51 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h +++ b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.h @@ -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