[PATCH 1/7] gpio: allow for arch-specific ARCH_NR_GPIOS > 256

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux