From e5f654f4ca558af483baabd1f710afd489b1e69d Mon Sep 17 00:00:00 2001 From: Michal Lenc Date: Wed, 4 Mar 2026 17:08:25 +0100 Subject: [PATCH] arch/arm/src/samX/sam_gpioirq.c: fix pin base address calculation GPIO PIN base address calculation had double right shift, thus call to SAM_PION_BASE was always with port = 0 instead of correct port number. As a result, function sam_gpioirq didn't correctly configure additional interrupt modes (only rising or falling edge and level interrupts). The issue occured on SAMv7 and SAM34 platforms (likely copy-pasted from one to another). Signed-off-by: Michal Lenc --- arch/arm/src/sam34/sam_gpioirq.c | 2 +- arch/arm/src/samv7/sam_gpioirq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/sam34/sam_gpioirq.c b/arch/arm/src/sam34/sam_gpioirq.c index b5e303af093..42ee4c2c85e 100644 --- a/arch/arm/src/sam34/sam_gpioirq.c +++ b/arch/arm/src/sam34/sam_gpioirq.c @@ -82,7 +82,7 @@ static inline uint32_t sam_gpiobase(gpio_pinset_t pinset) { int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; - return SAM_PION_BASE(port >> GPIO_PORT_SHIFT); + return SAM_PION_BASE(port); } /**************************************************************************** diff --git a/arch/arm/src/samv7/sam_gpioirq.c b/arch/arm/src/samv7/sam_gpioirq.c index efbda6ab6bf..1cfd11ed630 100644 --- a/arch/arm/src/samv7/sam_gpioirq.c +++ b/arch/arm/src/samv7/sam_gpioirq.c @@ -71,7 +71,7 @@ static inline uint32_t sam_gpiobase(gpio_pinset_t pinset) { int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; - return SAM_PION_BASE(port >> GPIO_PORT_SHIFT); + return SAM_PION_BASE(port); } /****************************************************************************