From d2f297d082d7f5ed01d733f03c82d943f0f328b2 Mon Sep 17 00:00:00 2001 From: Appana Durga Kedareswara rao Date: Wed, 23 Mar 2022 22:30:45 +0530 Subject: [PATCH] drivers: misc: xilinx_tmr_manager.c: Add api for reset handler When recovery is performed need to clear the TMR Manager FFR register contents, This commit adds new API xmb_manager_reset_handler() which clears the ffr register contents. Signed-off-by: Appana Durga Kedareswara rao --- arch/microblaze/include/asm/xilinx_mb_manager.h | 3 ++- drivers/misc/xilinx_tmr_manager.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/microblaze/include/asm/xilinx_mb_manager.h b/arch/microblaze/include/asm/xilinx_mb_manager.h index b7b5013608595f..a82df63be734a7 100644 --- a/arch/microblaze/include/asm/xilinx_mb_manager.h +++ b/arch/microblaze/include/asm/xilinx_mb_manager.h @@ -18,7 +18,8 @@ * break and call the callback function. */ void xmb_manager_register(uintptr_t phys_baseaddr, u32 cr_val, - void (*callback)(void *data), void *priv); + void (*callback)(void *data), + void *priv, void (*reset_callback)(void *data)); asmlinkage void xmb_inject_err(void); # endif /* __ASSEMBLY__ */ diff --git a/drivers/misc/xilinx_tmr_manager.c b/drivers/misc/xilinx_tmr_manager.c index b2e6b979ac52cf..2fdda19dd7f134 100644 --- a/drivers/misc/xilinx_tmr_manager.c +++ b/drivers/misc/xilinx_tmr_manager.c @@ -79,6 +79,19 @@ static void xtmr_manager_unblock_break(struct xtmr_manager_dev *xtmr_manager) xtmr_manager_write(xtmr_manager, XTMR_MANAGER_CR_OFFSET, xtmr_manager->cr_val); } +/** + * xmb_manager_reset_handler - clears the ffr register contents + * @priv: Private pointer + */ +static void xmb_manager_reset_handler(void *priv) +{ + struct xtmr_manager_dev *xtmr_manager = (struct xtmr_manager_dev *)priv; + /* + * Clear the FFR Register contents as a part of recovery process. + */ + xtmr_manager_write(xtmr_manager, XTMR_MANAGER_FFR_OFFSET, 0); +} + /** * xmb_manager_update_errcnt - update the error inject count * @priv: Private pointer @@ -185,7 +198,8 @@ static void xtmr_manager_init(struct xtmr_manager_dev *xtmr_manager) * break and call the callback function. */ xmb_manager_register(xtmr_manager->phys_baseaddr, xtmr_manager->cr_val, - xmb_manager_update_errcnt, xtmr_manager); + xmb_manager_update_errcnt, + xtmr_manager, xmb_manager_reset_handler); } /**