generic/4.0: update to 4.0.4
[openwrt.git] / target / linux / generic / patches-4.0 / 022-bcma-from-4.2.patch
1 --- a/drivers/bcma/driver_gpio.c
2 +++ b/drivers/bcma/driver_gpio.c
3 @@ -226,6 +226,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
4                 chip->of_node   = cc->core->dev.of_node;
5  #endif
6         switch (bus->chipinfo.id) {
7 +       case BCMA_CHIP_ID_BCM4707:
8         case BCMA_CHIP_ID_BCM5357:
9         case BCMA_CHIP_ID_BCM53572:
10                 chip->ngpio     = 32;
11 @@ -235,16 +236,17 @@ int bcma_gpio_init(struct bcma_drv_cc *c
12         }
13  
14         /*
15 -        * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO
16 -        * pin numbers. We don't have Device Tree there and we can't really use
17 -        * relative (per chip) numbers.
18 -        * So let's use predictable base for BCM47XX and "random" for all other.
19 +        * Register SoC GPIO devices with absolute GPIO pin base.
20 +        * On MIPS, we don't have Device Tree and we can't use relative (per chip)
21 +        * GPIO numbers.
22 +        * On some ARM devices, user space may want to access some system GPIO
23 +        * pins directly, which is easier to do with a predictable GPIO base.
24          */
25 -#if IS_BUILTIN(CONFIG_BCM47XX)
26 -       chip->base              = bus->num * BCMA_GPIO_MAX_PINS;
27 -#else
28 -       chip->base              = -1;
29 -#endif
30 +       if (IS_BUILTIN(CONFIG_BCM47XX) ||
31 +           cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
32 +               chip->base              = bus->num * BCMA_GPIO_MAX_PINS;
33 +       else
34 +               chip->base              = -1;
35  
36         err = bcma_gpio_irq_domain_init(cc);
37         if (err)