bcma: gpio: use predictable base for all BCM47XX buses
Some BCM47XX SoC routers have LEDs connected to extra PCIe bcma buses. Handling them in arch code requires predictable GPIO numbers. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
080465f27a
commit
057fcd426e
1 changed files with 15 additions and 8 deletions
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "bcma_private.h"
|
#include "bcma_private.h"
|
||||||
|
|
||||||
|
#define BCMA_GPIO_MAX_PINS 32
|
||||||
|
|
||||||
static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip)
|
static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip)
|
||||||
{
|
{
|
||||||
return container_of(chip, struct bcma_drv_cc, gpio);
|
return container_of(chip, struct bcma_drv_cc, gpio);
|
||||||
|
@ -204,6 +206,7 @@ static void bcma_gpio_irq_domain_exit(struct bcma_drv_cc *cc)
|
||||||
|
|
||||||
int bcma_gpio_init(struct bcma_drv_cc *cc)
|
int bcma_gpio_init(struct bcma_drv_cc *cc)
|
||||||
{
|
{
|
||||||
|
struct bcma_bus *bus = cc->core->bus;
|
||||||
struct gpio_chip *chip = &cc->gpio;
|
struct gpio_chip *chip = &cc->gpio;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -222,7 +225,7 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
|
||||||
if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
|
if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
|
||||||
chip->of_node = cc->core->dev.of_node;
|
chip->of_node = cc->core->dev.of_node;
|
||||||
#endif
|
#endif
|
||||||
switch (cc->core->bus->chipinfo.id) {
|
switch (bus->chipinfo.id) {
|
||||||
case BCMA_CHIP_ID_BCM5357:
|
case BCMA_CHIP_ID_BCM5357:
|
||||||
case BCMA_CHIP_ID_BCM53572:
|
case BCMA_CHIP_ID_BCM53572:
|
||||||
chip->ngpio = 32;
|
chip->ngpio = 32;
|
||||||
|
@ -231,13 +234,17 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
|
||||||
chip->ngpio = 16;
|
chip->ngpio = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There is just one SoC in one device and its GPIO addresses should be
|
/*
|
||||||
* deterministic to address them more easily. The other buses could get
|
* On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO
|
||||||
* a random base number. */
|
* pin numbers. We don't have Device Tree there and we can't really use
|
||||||
if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
|
* relative (per chip) numbers.
|
||||||
chip->base = 0;
|
* So let's use predictable base for BCM47XX and "random" for all other.
|
||||||
else
|
*/
|
||||||
chip->base = -1;
|
#if IS_BUILTIN(CONFIG_BCM47XX)
|
||||||
|
chip->base = bus->num * BCMA_GPIO_MAX_PINS;
|
||||||
|
#else
|
||||||
|
chip->base = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
err = bcma_gpio_irq_domain_init(cc);
|
err = bcma_gpio_irq_domain_init(cc);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue