[PATCH v3 1/2] fpga: altera-cvp: Add helper to disable CvP mode
From: muhammad . nazim . amirul . nazle . asmade
Date: Wed Sep 23 2026 - 01:32:49 EST
From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@xxxxxxxxxx>
Factor out the clearing of CVP_MODE and HIP_CLK_SEL in
VSE_CVP_MODE_CTRL into altera_cvp_disable_cvp_mode() and use it for
STEP 17 in altera_cvp_write_complete().
No functional change. This prepares for reusing the helper in the
teardown recovery path.
Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@xxxxxxxxxx>
---
drivers/fpga/altera-cvp.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index 44badfd11e1b..559191180825 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -278,6 +278,16 @@ static int altera_cvp_send_block(struct altera_cvp_conf *conf,
return 0;
}
+static void altera_cvp_disable_cvp_mode(struct altera_cvp_conf *conf)
+{
+ u32 val;
+
+ altera_read_config_dword(conf, VSE_CVP_MODE_CTRL, &val);
+ val &= ~VSE_CVP_MODE_CTRL_HIP_CLK_SEL;
+ val &= ~VSE_CVP_MODE_CTRL_CVP_MODE;
+ altera_write_config_dword(conf, VSE_CVP_MODE_CTRL, val);
+}
+
static int altera_cvp_teardown(struct fpga_manager *mgr,
struct fpga_image_info *info)
{
@@ -496,10 +506,7 @@ static int altera_cvp_write_complete(struct fpga_manager *mgr,
}
/* STEP 17 - reset CVP_MODE and HIP_CLK_SEL bit */
- altera_read_config_dword(conf, VSE_CVP_MODE_CTRL, &val);
- val &= ~VSE_CVP_MODE_CTRL_HIP_CLK_SEL;
- val &= ~VSE_CVP_MODE_CTRL_CVP_MODE;
- altera_write_config_dword(conf, VSE_CVP_MODE_CTRL, val);
+ altera_cvp_disable_cvp_mode(conf);
/* STEP 18 - poll PLD_CLK_IN_USE and USER_MODE bits */
mask = VSE_CVP_STATUS_PLD_CLK_IN_USE | VSE_CVP_STATUS_USERMODE;
--
2.43.7