[PATCH 4/4] leon, grspw_router: Clear only error bits defined by clear mask

Daniel Hellstrom daniel at gaisler.com
Mon Nov 13 10:02:12 UTC 2017


From: Javier Jalle <javier.jalle at gaisler.com>

---
 c/src/lib/libbsp/sparc/shared/include/grspw_router.h | 2 +-
 c/src/lib/libbsp/sparc/shared/spw/grspw_router.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/shared/include/grspw_router.h b/c/src/lib/libbsp/sparc/shared/include/grspw_router.h
index 94e13b1..2fab8d5 100644
--- a/c/src/lib/libbsp/sparc/shared/include/grspw_router.h
+++ b/c/src/lib/libbsp/sparc/shared/include/grspw_router.h
@@ -328,7 +328,7 @@ extern int router_port_maxplen_set(void *d, int port, uint32_t length);
 #define PSTS_PE_BIT 0
 
 /* Check Port Status register and clear errors if there are */
-extern int router_port_status(void *d, int port, uint32_t *sts);
+extern int router_port_status(void *d, int port, uint32_t *sts, uint32_t clrmsk);
 
 #define ROUTER_LINK_STATUS_ERROR_RESET 0
 #define ROUTER_LINK_STATUS_ERROR_WAIT 1
diff --git a/c/src/lib/libbsp/sparc/shared/spw/grspw_router.c b/c/src/lib/libbsp/sparc/shared/spw/grspw_router.c
index c65a2fb..d95c351 100644
--- a/c/src/lib/libbsp/sparc/shared/spw/grspw_router.c
+++ b/c/src/lib/libbsp/sparc/shared/spw/grspw_router.c
@@ -1331,7 +1331,7 @@ int router_port_ctrl_get(void *d, int port, uint32_t *ctrl)
 }
 
 /* Read Port Status register and clear errors if there are */
-int router_port_status(void *d, int port, uint32_t *sts, uint32_t clrmsk) /* review clrmsks */
+int router_port_status(void *d, int port, uint32_t *sts, uint32_t clrmsk)
 {
 	struct router_priv *priv = d;
 	int error = router_check_port(d, port);
@@ -1350,7 +1350,7 @@ int router_port_status(void *d, int port, uint32_t *sts, uint32_t clrmsk) /* rev
 	if (port == 0) {
 		REG_WRITE(&priv->regs->psts[port], ((*sts) & (PSTSCFG_WCLEAR & clrmsk)) | (PSTSCFG_WCLEAR2 & clrmsk));
 	}else{
-		REG_WRITE(&priv->regs->psts[port], (*sts) & PSTS_WCLEAR);
+		REG_WRITE(&priv->regs->psts[port], (*sts) & (PSTS_WCLEAR & clrmsk));
 	}
 	SPIN_UNLOCK_IRQ(&priv->plock[port], irqflags);
 	return ROUTER_ERR_OK;
-- 
2.7.4




More information about the devel mailing list