pinctrl: bcm283x: Fix GPIO pull state register values for BCM2711

BCM2711 has different pull-up/down register values compared to BCM2835

- BCM2835: NONE=0, DOWN=1, UP=2
- BCM2711: NONE=0, UP=1, DOWN=2

This patch fixes the pull state register values for BCM2711.

Fixes: 2c39d975f87c ("pinctrl: bcm283x: Add GPIO pull-up/down control for BCM2835 and BCM2711")
Signed-off-by: Cibil Pankiras <cibil.pankiras@egym.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
This commit is contained in:
Cibil Pankiras 2026-02-06 11:47:00 +01:00 committed by Peter Robinson
parent ba7bf918da
commit 5fa0237c83

View File

@ -30,6 +30,11 @@ struct bcm283x_pinctrl_priv {
#define MAX_PINS_PER_BANK 16
/* pull states for BCM2711 */
#define BCM2711_PULL_NONE 0
#define BCM2711_PULL_UP 1
#define BCM2711_PULL_DOWN 2
static void bcm2835_gpio_set_func_id(struct udevice *dev, unsigned int gpio,
int func)
{
@ -93,6 +98,17 @@ static void bcm2711_gpio_set_pull(struct udevice *dev, unsigned int gpio, int pu
u32 bit_shift;
u32 pull_bits;
if (!device_is_compatible(dev, "brcm,bcm2711-gpio"))
return;
/* BCM2711's pull values differ from BCM2835 */
if (pull == BCM2835_PUD_UP)
pull = BCM2711_PULL_UP;
else if (pull == BCM2835_PUD_DOWN)
pull = BCM2711_PULL_DOWN;
else
pull = BCM2711_PULL_NONE;
/* Findout which GPIO_PUP_PDN_CNTRL register to use */
reg_offset = BCM2711_GPPUD_CNTRL_REG0 + BCM2711_PUD_REG_OFFSET(gpio);