generic: 4.4: refresh patches
[openwrt.git] / target / linux / generic / patches-4.1 / 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)
38 --- a/drivers/bcma/Kconfig
39 +++ b/drivers/bcma/Kconfig
40 @@ -29,12 +29,6 @@ config BCMA_HOST_PCI
41         select BCMA_DRIVER_PCI
42         default y
43  
44 -config BCMA_DRIVER_PCI_HOSTMODE
45 -       bool "Driver for PCI core working in hostmode"
46 -       depends on BCMA && MIPS && BCMA_HOST_PCI
47 -       help
48 -         PCI core hostmode operation (external PCI bus).
49 -
50  config BCMA_HOST_SOC
51         bool "Support for BCMA in a SoC"
52         depends on BCMA
53 @@ -61,6 +55,12 @@ config BCMA_DRIVER_PCI
54           This driver is also prerequisite for a hostmode PCIe core
55           support.
56  
57 +config BCMA_DRIVER_PCI_HOSTMODE
58 +       bool "Driver for PCI core working in hostmode"
59 +       depends on BCMA && MIPS && BCMA_DRIVER_PCI
60 +       help
61 +         PCI core hostmode operation (external PCI bus).
62 +
63  config BCMA_DRIVER_MIPS
64         bool "BCMA Broadcom MIPS core driver"
65         depends on BCMA && MIPS
66 --- a/include/linux/bcma/bcma_driver_pci.h
67 +++ b/include/linux/bcma/bcma_driver_pci.h
68 @@ -246,7 +246,18 @@ static inline void bcma_core_pci_power_s
69  }
70  #endif
71  
72 +#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
73  extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
74  extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
75 +#else
76 +static inline int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev)
77 +{
78 +       return -ENOTSUPP;
79 +}
80 +static inline int bcma_core_pci_plat_dev_init(struct pci_dev *dev)
81 +{
82 +       return -ENOTSUPP;
83 +}
84 +#endif
85  
86  #endif /* LINUX_BCMA_DRIVER_PCI_H_ */