CONFIG_ARCH_NR_GPIOS support.

This commit is contained in:
Jeffrey Townsend
2017-01-07 00:56:12 +00:00
parent 993c4fc7ec
commit a2c0ab156b
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
diff -urpN a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
--- a/drivers/gpio/Kconfig 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/gpio/Kconfig 2017-01-06 18:06:11.520439745 +0000
@@ -30,6 +30,23 @@ config ARCH_REQUIRE_GPIOLIB
Selecting this from the architecture code will cause the gpiolib
code to always get built in.
+config ARCH_NR_GPIOS
+ int "Max number gpios"
+ default 256
+ range 256 2048
+ help
+ Platforms may implement their GPIO interface with library code,
+ at a small performance cost for non-inlined operations and some
+ extra memory (for code and for per-GPIO table entries).
+
+ While the GPIO programming interface defines valid GPIO numbers
+ to be in the range 0..MAX_INT, this library restricts them to the
+ smaller range 0..ARCH_NR_GPIOS-1.
+
+ ARCH_NR_GPIOS is somewhat arbitrary; it usually reflects the sum of
+ builtin/SoC GPIOs plus a number of GPIOs on expanders; the latter is
+ actually an estimate of a board-specific value.
+
menuconfig GPIOLIB
bool "GPIO Support"
diff -urpN a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
--- a/include/asm-generic/gpio.h 2016-11-20 01:17:41.000000000 +0000
+++ b/include/asm-generic/gpio.h 2017-01-06 18:02:56.124435505 +0000
@@ -26,6 +26,10 @@
* actually an estimate of a board-specific value.
*/
+#ifdef CONFIG_ARCH_NR_GPIOS
+#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIOS
+#endif
+
#ifndef ARCH_NR_GPIOS
#define ARCH_NR_GPIOS 256
#endif

View File

@@ -18,3 +18,4 @@ drivers-i2c-busses-i2c-isch-probe-param.patch
drivers-i2c-muxes-pca954x-deselect-on-exit.patch
driver-early-dma-allocator.patch
driver-esdhc-p2020-broken-timeout.patch
drivers-gpio-config-arch-nr-gpios.patch