mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/7] gpio: allow for arch-specific ARCH_NR_GPIOS > 256
@ 2019-07-10 20:11 Ahmad Fatoum
  2019-07-10 20:11 ` [PATCH 2/7] ARM: stm32mp: set CONFIG_ARCH_NR_GPIO = (26 * 16) Ahmad Fatoum
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-07-10 20:11 UTC (permalink / raw)
  To: barebox

Some architectures have non-contiguous GPIO ranges where some GPIOs can
have identifiers exceeding the hardcoded ARCH_NR_GPIOs of 256.

One such example is the STM32MP, whose gpioz controller has identifiers
that go up to ('Z' - 'A' + 1) * 0x10 - 1 = 415.
Instead of increasing the array size for all architectures or doing
some sort of packing, allow architecture to define their own overriding
CONFIG_ARCH_NR_GPIO like the kernel does.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/gpio.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/gpio.h b/include/gpio.h
index e822fd53475d..1926edeca757 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -45,7 +45,11 @@ static inline int gpio_direction_active(unsigned gpio, int value)
 }
 #endif
 
+#if defined(CONFIG_ARCH_NR_GPIO) && CONFIG_ARCH_NR_GPIO > 0
+#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
+#else
 #define ARCH_NR_GPIOS 256
+#endif
 
 static inline int gpio_is_valid(int gpio)
 {
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-07-15  6:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 20:11 [PATCH 1/7] gpio: allow for arch-specific ARCH_NR_GPIOS > 256 Ahmad Fatoum
2019-07-10 20:11 ` [PATCH 2/7] ARM: stm32mp: set CONFIG_ARCH_NR_GPIO = (26 * 16) Ahmad Fatoum
2019-07-10 20:11 ` [PATCH 3/7] ARM: dts: stm32mp157c: correct gpioz id Ahmad Fatoum
2019-07-10 20:11 ` [PATCH 4/7] reset: add reset controller driver for STM32 RCC Ahmad Fatoum
2019-07-10 21:28   ` [PATCH] fixup! " Ahmad Fatoum
2019-07-10 20:11 ` [PATCH 5/7] i2c: add stm32f7 I2C adapter driver Ahmad Fatoum
2019-07-12  5:09   ` Sascha Hauer
2019-07-10 20:11 ` [PATCH 6/7] mfd: add support for STPMIC1 Ahmad Fatoum
2019-07-10 20:11 ` [PATCH 7/7] watchdog: add support for STPMIC1 integrated watchdog Ahmad Fatoum
2019-07-15  6:42 ` [PATCH 1/7] gpio: allow for arch-specific ARCH_NR_GPIOS > 256 Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox