]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
pinctrl: bcm283x: Fix GPIO pull state register values for BCM2711
authorCibil Pankiras <cibil.pankiras@egym.com>
Fri, 6 Feb 2026 10:47:00 +0000 (11:47 +0100)
committerPeter Robinson <pbrobinson@gmail.com>
Thu, 12 Mar 2026 12:02:21 +0000 (12:02 +0000)
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>
drivers/pinctrl/broadcom/pinctrl-bcm283x.c

index 4ecc8bac645a5ba9f47775e92cc3044787c6e214..90eee88eb1372d4c178e301acd2f702c12551f8e 100644 (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);