From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Meng Wei Date: Mon, 11 Feb 2019 10:04:24 +0800 Subject: [PATCH] media: intel-ipu4: Fix IPC timeout in ipu buttress authentication IRQ for boot_load was not waited as require_resp is not set, causing the next command failed to be received. This patch add the response setting to make sure IPC procedure is completed before sending new command. Change-Id: I7bcac0ae2d984fc3a1609a5b64ea7eec3081cbf9 Tracked-On: PKT-1760 Tracked-On: OAM-73567 Signed-off-by: khaiwenn Signed-off-by: jinchung Signed-off-by: Meng Wei --- drivers/media/pci/intel/ipu-buttress.c | 14 ++++++++++---- .../pci/intel/ipu4/ipu-platform-buttress-regs.h | 9 +++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/intel/ipu-buttress.c b/drivers/media/pci/intel/ipu-buttress.c index d19e965..33a6449 100644 --- a/drivers/media/pci/intel/ipu-buttress.c +++ b/drivers/media/pci/intel/ipu-buttress.c @@ -368,11 +368,14 @@ EXPORT_SYMBOL_GPL(ipu_buttress_ipc_send_bulk); static int ipu_buttress_ipc_send(struct ipu_device *isp, enum ipu_buttress_ipc_domain ipc_domain, - u32 ipc_msg, u32 size) + u32 ipc_msg, u32 size, bool require_resp, + u32 expected_resp) { struct ipu_ipc_buttress_bulk_msg msg = { .cmd = ipc_msg, .cmd_size = size, + .require_resp = require_resp, + .expected_resp = expected_resp, }; return ipu_buttress_ipc_send_bulk(isp, ipc_domain, &msg, 1); @@ -875,7 +878,9 @@ int ipu_buttress_authenticate(struct ipu_device *isp) */ dev_info(&isp->pdev->dev, "Sending BOOT_LOAD to CSE\n"); rval = ipu_buttress_ipc_send(isp, IPU_BUTTRESS_IPC_CSE, - BUTTRESS_IU2CSEDATA0_IPC_BOOT_LOAD, 1); + BUTTRESS_IU2CSEDATA0_IPC_BOOT_LOAD, + 1, 1, + BUTTRESS_CSE2IUDATA0_IPC_BOOT_LOAD_DONE); if (rval) { dev_err(&isp->pdev->dev, "CSE boot_load failed\n"); goto iunit_power_off; @@ -930,8 +935,9 @@ int ipu_buttress_authenticate(struct ipu_device *isp) */ dev_info(&isp->pdev->dev, "Sending AUTHENTICATE_RUN to CSE\n"); rval = ipu_buttress_ipc_send(isp, IPU_BUTTRESS_IPC_CSE, - BUTTRESS_IU2CSEDATA0_IPC_AUTHENTICATE_RUN, - 1); + BUTTRESS_IU2CSEDATA0_IPC_AUTH_RUN, + 1, 1, + BUTTRESS_CSE2IUDATA0_IPC_AUTH_RUN_DONE); if (rval) { dev_err(&isp->pdev->dev, "CSE authenticate_run failed\n"); goto iunit_power_off; diff --git a/drivers/media/pci/intel/ipu4/ipu-platform-buttress-regs.h b/drivers/media/pci/intel/ipu4/ipu-platform-buttress-regs.h index ffd770c..34f2f78 100644 --- a/drivers/media/pci/intel/ipu4/ipu-platform-buttress-regs.h +++ b/drivers/media/pci/intel/ipu4/ipu-platform-buttress-regs.h @@ -212,10 +212,15 @@ enum { #define BUTTRESS_REG_IU2CSEDATA0 0x104 #define BUTTRESS_IU2CSEDATA0_IPC_BOOT_LOAD 1 -#define BUTTRESS_IU2CSEDATA0_IPC_AUTHENTICATE_RUN 2 -#define BUTTRESS_IU2CSEDATA0_IPC_AUTHENTICATE_REPLACE 3 +#define BUTTRESS_IU2CSEDATA0_IPC_AUTH_RUN 2 +#define BUTTRESS_IU2CSEDATA0_IPC_AUTH_REPLACE 3 #define BUTTRESS_IU2CSEDATA0_IPC_UPDATE_SECURE_TOUCH 16 +#define BUTTRESS_CSE2IUDATA0_IPC_BOOT_LOAD_DONE 1 +#define BUTTRESS_CSE2IUDATA0_IPC_AUTH_RUN_DONE 2 +#define BUTTRESS_CSE2IUDATA0_IPC_AUTH_REPLACE_DONE 4 +#define BUTTRESS_CSE2IUDATA0_IPC_UPDATE_SECURE_TOUCH_DONE 16 + #define BUTTRESS_REG_IU2CSECSR 0x108 #define BUTTRESS_IU2CSECSR_IPC_PEER_COMP_ACTIONS_RST_PHASE1 BIT(0) -- https://clearlinux.org