Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcma: use absolute base for SoC GPIO pins

On some BCM5301x ARM devices, user space still needs to control some
system GPIO pins for which no driver exists. This is a lot easier to do
with a predictable GPIO base.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Felix Fietkau and committed by
Kalle Valo
2d57b712 c4365534

+10 -9
+10 -9
drivers/bcma/driver_gpio.c
··· 235 235 } 236 236 237 237 /* 238 - * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO 239 - * pin numbers. We don't have Device Tree there and we can't really use 240 - * relative (per chip) numbers. 241 - * So let's use predictable base for BCM47XX and "random" for all other. 238 + * Register SoC GPIO devices with absolute GPIO pin base. 239 + * On MIPS, we don't have Device Tree and we can't use relative (per chip) 240 + * GPIO numbers. 241 + * On some ARM devices, user space may want to access some system GPIO 242 + * pins directly, which is easier to do with a predictable GPIO base. 242 243 */ 243 - #if IS_BUILTIN(CONFIG_BCM47XX) 244 - chip->base = bus->num * BCMA_GPIO_MAX_PINS; 245 - #else 246 - chip->base = -1; 247 - #endif 244 + if (IS_BUILTIN(CONFIG_BCM47XX) || 245 + cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) 246 + chip->base = bus->num * BCMA_GPIO_MAX_PINS; 247 + else 248 + chip->base = -1; 248 249 249 250 err = bcma_gpio_irq_domain_init(cc); 250 251 if (err)