Skip to content

Commit 70b8e9e

Browse files
committed
Merge tag 'gpio-v4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "This is the bulk of the GPIO changes for the v4.14 cycle. Not so much changes this time, phew. David Daney and Bartosz Golaszewski did all the really interesting work in infrastructure improvement across GPIO and IRQ core, hats off for them and to tglx and Marc Z for general help with these patch sets. Core changes: - Allow the GPIO irqchip to allocate IRQs dynamically. This is an important change on systems where only a restricted number of IRQs, lesser than the number of GPIO lines, can be utilized. Now we can allocate these on a first-come-first-served basis instead of hogging up valuable IRQ lines. - Serious fix-up of the kerneldoc documentation and inclusion into the kerneldoc builds. - Pulled in the IRQ simulator from the IRQ core tree and use this in the GPIO mockup driver for exhaustive testing of interrupt abilities. New drivers: - New driver for ThunderX and OCTEON-TX. This is especially interesting as it picks up improvements from the IRQ core that allow us to handle fasteoi ACKs upwards in a hierarchy when there are IRQ flag latches on several levels in a hierarchy. Very interesting work here. - New subdriver for Renesas R-Car r8a7745 (RZ/G1E). Misc: - Several fixes and improvements for Xilinx Zynq GPIO. - Support an enablement GPIO for the 74x164 GPIO. - Switch a bunch of chips to use devres to allocate irq descriptors. - A bunch of constification fixes" * tag 'gpio-v4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (63 commits) gpio: mockup: remove unused variable gc gpio: pl061: constify amba_id Revert "gpiolib: request the gpio before querying its direction" gpio: twl6040: remove unneeded forward declaration gpio: zevio: make gpio_chip const gpio: add gpio_add_lookup_tables() to add several tables at once gpio: rcar: Add r8a7745 (RZ/G1E) support gpio: brcmstb: check return value of gpiochip_irqchip_add() MAINTAINERS: Add entry for THUNDERX GPIO Driver. gpio: Add gpio driver support for ThunderX and OCTEON-TX gpio: mockup: use irq_sim gpio: mxs: use devres for irq generic chip gpio: mxc: use devres for irq generic chip gpio: pch: use devres for irq generic chip gpio: ml-ioh: use devres for irq generic chip gpio: sta2x11: use devres for irq generic chip gpio: sta2x11: disallow unbinding the driver gpio: mxs: disallow unbinding the driver gpio: mxc: disallow unbinding the driver gpio: aspeed: Remove reference to clock name in debounce warning message ...
2 parents d16605c + 02b6bdd commit 70b8e9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1516
-326
lines changed

Documentation/devicetree/bindings/gpio/gpio-74x164.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Required properties:
1212
1 = active low
1313
- registers-number: Number of daisy-chained shift registers
1414

15+
Optional properties:
16+
- enable-gpios: GPIO connected to the OE (Output Enable) pin.
17+
1518
Example:
1619

1720
gpio5: gpio5@0 {

Documentation/devicetree/bindings/gpio/gpio-aspeed.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Required properties:
1818
Optional properties:
1919

2020
- interrupt-parent : The parent interrupt controller, optional if inherited
21-
- clocks : A phandle to the HPLL clock node for debounce timings
21+
- clocks : A phandle to the clock to use for debounce timings
2222

2323
The gpio and interrupt properties are further described in their respective
2424
bindings documentation:

Documentation/devicetree/bindings/gpio/gpio-davinci.txt

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
Davinci/Keystone GPIO controller bindings
22

33
Required Properties:
4-
- compatible: should be "ti,dm6441-gpio", "ti,keystone-gpio"
4+
- compatible: should be "ti,dm6441-gpio": for Davinci da850 SoCs
5+
"ti,keystone-gpio": for Keystone 2 66AK2H/K, 66AK2L,
6+
66AK2E SoCs
7+
"ti,k2g-gpio", "ti,keystone-gpio": for 66AK2G
58

69
- reg: Physical base address of the controller and the size of memory mapped
710
registers.
@@ -20,7 +23,21 @@ Required Properties:
2023
- ti,ngpio: The number of GPIO pins supported.
2124

2225
- ti,davinci-gpio-unbanked: The number of GPIOs that have an individual interrupt
23-
line to processor.
26+
line to processor.
27+
28+
- clocks: Should contain the device's input clock, and should be defined as per
29+
the appropriate clock bindings consumer usage in,
30+
31+
Documentation/devicetree/bindings/clock/keystone-gate.txt
32+
for 66AK2HK/66AK2L/66AK2E SoCs or,
33+
34+
Documentation/devicetree/bindings/clock/ti,sci-clk.txt
35+
for 66AK2G SoCs
36+
37+
- clock-names: Name should be "gpio";
38+
39+
Currently clock-names and clocks are needed for all keystone 2 platforms
40+
Davinci platforms do not have DT clocks as of now.
2441

2542
The GPIO controller also acts as an interrupt controller. It uses the default
2643
two cells specifier as described in Documentation/devicetree/bindings/
@@ -60,3 +77,73 @@ leds {
6077
...
6178
};
6279
};
80+
81+
Example for 66AK2G:
82+
83+
gpio0: gpio@2603000 {
84+
compatible = "ti,k2g-gpio", "ti,keystone-gpio";
85+
reg = <0x02603000 0x100>;
86+
gpio-controller;
87+
#gpio-cells = <2>;
88+
interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
89+
<GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
90+
<GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
91+
<GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
92+
<GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
93+
<GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
94+
<GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
95+
<GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
96+
<GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
97+
interrupt-controller;
98+
#interrupt-cells = <2>;
99+
ti,ngpio = <144>;
100+
ti,davinci-gpio-unbanked = <0>;
101+
clocks = <&k2g_clks 0x001b 0x0>;
102+
clock-names = "gpio";
103+
};
104+
105+
Example for 66AK2HK/66AK2L/66AK2E:
106+
107+
gpio0: gpio@260bf00 {
108+
compatible = "ti,keystone-gpio";
109+
reg = <0x0260bf00 0x100>;
110+
gpio-controller;
111+
#gpio-cells = <2>;
112+
/* HW Interrupts mapped to GPIO pins */
113+
interrupts = <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>,
114+
<GIC_SPI 121 IRQ_TYPE_EDGE_RISING>,
115+
<GIC_SPI 122 IRQ_TYPE_EDGE_RISING>,
116+
<GIC_SPI 123 IRQ_TYPE_EDGE_RISING>,
117+
<GIC_SPI 124 IRQ_TYPE_EDGE_RISING>,
118+
<GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
119+
<GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
120+
<GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
121+
<GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
122+
<GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
123+
<GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
124+
<GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
125+
<GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
126+
<GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
127+
<GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
128+
<GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
129+
<GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
130+
<GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
131+
<GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
132+
<GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
133+
<GIC_SPI 140 IRQ_TYPE_EDGE_RISING>,
134+
<GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
135+
<GIC_SPI 142 IRQ_TYPE_EDGE_RISING>,
136+
<GIC_SPI 143 IRQ_TYPE_EDGE_RISING>,
137+
<GIC_SPI 144 IRQ_TYPE_EDGE_RISING>,
138+
<GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
139+
<GIC_SPI 146 IRQ_TYPE_EDGE_RISING>,
140+
<GIC_SPI 147 IRQ_TYPE_EDGE_RISING>,
141+
<GIC_SPI 148 IRQ_TYPE_EDGE_RISING>,
142+
<GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
143+
<GIC_SPI 150 IRQ_TYPE_EDGE_RISING>,
144+
<GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
145+
clocks = <&clkgpio>;
146+
clock-names = "gpio";
147+
ti,ngpio = <32>;
148+
ti,davinci-gpio-unbanked = <32>;
149+
};

Documentation/devicetree/bindings/gpio/gpio-vf610.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ functionality. Each pair serves 32 GPIOs. The VF610 has 5 instances of
55
each, and each PORT module has its own interrupt.
66

77
Required properties for GPIO node:
8-
- compatible : Should be "fsl,<soc>-gpio", currently "fsl,vf610-gpio"
8+
- compatible : Should be "fsl,<soc>-gpio", below is supported list:
9+
"fsl,vf610-gpio"
10+
"fsl,imx7ulp-gpio"
911
- reg : The first reg tuple represents the PORT module, the second tuple
1012
the GPIO module.
1113
- interrupts : Should be the port interrupt shared by all 32 pins.

Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
Required Properties:
44

5-
- compatible: should contain one of the following.
5+
- compatible: should contain one or more of the following:
66
- "renesas,gpio-r8a7743": for R8A7743 (RZ/G1M) compatible GPIO controller.
7+
- "renesas,gpio-r8a7745": for R8A7745 (RZ/G1E) compatible GPIO controller.
78
- "renesas,gpio-r8a7778": for R8A7778 (R-Mobile M1) compatible GPIO controller.
89
- "renesas,gpio-r8a7779": for R8A7779 (R-Car H1) compatible GPIO controller.
910
- "renesas,gpio-r8a7790": for R8A7790 (R-Car H2) compatible GPIO controller.
@@ -13,7 +14,14 @@ Required Properties:
1314
- "renesas,gpio-r8a7794": for R8A7794 (R-Car E2) compatible GPIO controller.
1415
- "renesas,gpio-r8a7795": for R8A7795 (R-Car H3) compatible GPIO controller.
1516
- "renesas,gpio-r8a7796": for R8A7796 (R-Car M3-W) compatible GPIO controller.
16-
- "renesas,gpio-rcar": for generic R-Car GPIO controller.
17+
- "renesas,rcar-gen1-gpio": for a generic R-Car Gen1 GPIO controller.
18+
- "renesas,rcar-gen2-gpio": for a generic R-Car Gen2 or RZ/G1 GPIO controller.
19+
- "renesas,rcar-gen3-gpio": for a generic R-Car Gen3 GPIO controller.
20+
- "renesas,gpio-rcar": deprecated.
21+
22+
When compatible with the generic version nodes must list the
23+
SoC-specific version corresponding to the platform first followed by
24+
the generic version.
1725

1826
- reg: Base address and length of each memory resource used by the GPIO
1927
controller hardware module.
@@ -43,7 +51,7 @@ interrupt-controller/interrupts.txt.
4351
Example: R8A7779 (R-Car H1) GPIO controller nodes
4452

4553
gpio0: gpio@ffc40000 {
46-
compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
54+
compatible = "renesas,gpio-r8a7779", "renesas,rcar-gen1-gpio";
4755
reg = <0xffc40000 0x2c>;
4856
interrupt-parent = <&gic>;
4957
interrupts = <0 141 0x4>;
@@ -55,7 +63,7 @@ Example: R8A7779 (R-Car H1) GPIO controller nodes
5563
};
5664
...
5765
gpio6: gpio@ffc46000 {
58-
compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
66+
compatible = "renesas,gpio-r8a7779", "renesas,rcar-gen1-gpio";
5967
reg = <0xffc46000 0x2c>;
6068
interrupt-parent = <&gic>;
6169
interrupts = <0 147 0x4>;

Documentation/driver-api/gpio.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
===================================
2+
General Purpose Input/Output (GPIO)
3+
===================================
4+
5+
Core
6+
====
7+
8+
.. kernel-doc:: include/linux/gpio/driver.h
9+
:internal:
10+
11+
.. kernel-doc:: drivers/gpio/gpiolib.c
12+
:export:
13+
14+
Legacy API
15+
==========
16+
17+
The functions listed in this section are deprecated. The GPIO descriptor based
18+
API described above should be used in new code.
19+
20+
.. kernel-doc:: drivers/gpio/gpiolib-legacy.c
21+
:export:
22+
23+
ACPI support
24+
============
25+
26+
.. kernel-doc:: drivers/gpio/gpiolib-acpi.c
27+
:export:
28+
29+
Device tree support
30+
===================
31+
32+
.. kernel-doc:: drivers/gpio/gpiolib-of.c
33+
:export:
34+
35+
Device-managed API
36+
==================
37+
38+
.. kernel-doc:: drivers/gpio/devres.c
39+
:export:
40+
41+
sysfs helpers
42+
=============
43+
44+
.. kernel-doc:: drivers/gpio/gpiolib-sysfs.c
45+
:export:

Documentation/driver-api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ available subsections can be seen below.
4444
uio-howto
4545
firmware/index
4646
pinctl
47+
gpio
4748
misc_devices
4849

4950
.. only:: subproject and html

MAINTAINERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13018,6 +13018,11 @@ M: Yehezkel Bernat <[email protected]>
1301813018
S: Maintained
1301913019
F: drivers/thunderbolt/
1302013020

13021+
THUNDERX GPIO DRIVER
13022+
M: David Daney <[email protected]>
13023+
S: Maintained
13024+
F: drivers/gpio/gpio-thunderx.c
13025+
1302113026
TI AM437X VPFE DRIVER
1302213027
M: "Lad, Prabhakar" <[email protected]>
1302313028

drivers/gpio/Kconfig

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ config GPIO_MOCKUP
311311
depends on GPIOLIB && SYSFS
312312
select GPIO_SYSFS
313313
select GPIOLIB_IRQCHIP
314-
select IRQ_WORK
314+
select IRQ_SIM
315315
help
316316
This enables GPIO Testing driver, which provides a way to test GPIO
317317
subsystem through sysfs(or char device) and debugfs. GPIO_SYSFS
@@ -450,6 +450,15 @@ config GPIO_TS4800
450450
help
451451
This driver support TS-4800 FPGA GPIO controllers.
452452

453+
config GPIO_THUNDERX
454+
tristate "Cavium ThunderX/OCTEON-TX GPIO"
455+
depends on ARCH_THUNDER || (64BIT && COMPILE_TEST)
456+
depends on PCI_MSI && IRQ_DOMAIN_HIERARCHY
457+
select IRQ_FASTEOI_HIERARCHY_HANDLERS
458+
help
459+
Say yes here to support the on-chip GPIO lines on the ThunderX
460+
and OCTEON-TX families of SoCs.
461+
453462
config GPIO_TZ1090
454463
bool "Toumaz Xenif TZ1090 GPIO support"
455464
depends on SOC_TZ1090
@@ -1065,6 +1074,21 @@ config GPIO_TPS65912
10651074
help
10661075
This driver supports TPS65912 gpio chip
10671076

1077+
config GPIO_TPS68470
1078+
bool "TPS68470 GPIO"
1079+
depends on MFD_TPS68470
1080+
help
1081+
Select this option to enable GPIO driver for the TPS68470
1082+
chip family.
1083+
There are 7 GPIOs and few sensor related GPIOs supported
1084+
by the TPS68470. While the 7 GPIOs can be configured as
1085+
input or output as appropriate, the sensor related GPIOs
1086+
are "output only" GPIOs.
1087+
1088+
This driver config is bool, as the GPIO functionality
1089+
of the TPS68470 must be available before dependent
1090+
drivers are loaded.
1091+
10681092
config GPIO_TWL4030
10691093
tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
10701094
depends on TWL4030_CORE

drivers/gpio/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ obj-$(CONFIG_GPIO_SYSCON) += gpio-syscon.o
113113
obj-$(CONFIG_GPIO_TB10X) += gpio-tb10x.o
114114
obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o
115115
obj-$(CONFIG_GPIO_TEGRA) += gpio-tegra.o
116+
obj-$(CONFIG_GPIO_THUNDERX) += gpio-thunderx.o
116117
obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o
117118
obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o
118119
obj-$(CONFIG_GPIO_TPIC2810) += gpio-tpic2810.o
@@ -121,6 +122,7 @@ obj-$(CONFIG_GPIO_TPS65218) += gpio-tps65218.o
121122
obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o
122123
obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o
123124
obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o
125+
obj-$(CONFIG_GPIO_TPS68470) += gpio-tps68470.o
124126
obj-$(CONFIG_GPIO_TS4800) += gpio-ts4800.o
125127
obj-$(CONFIG_GPIO_TS4900) += gpio-ts4900.o
126128
obj-$(CONFIG_GPIO_TS5500) += gpio-ts5500.o

drivers/gpio/devres.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ EXPORT_SYMBOL(devm_gpiod_get_index);
132132
* @index: index of the GPIO to obtain in the consumer
133133
* @child: firmware node (child of @dev)
134134
* @flags: GPIO initialization flags
135+
* @label: label to attach to the requested GPIO
135136
*
136137
* GPIO descriptors returned from this function are automatically disposed on
137138
* driver detach.
@@ -271,6 +272,7 @@ EXPORT_SYMBOL(devm_gpiod_get_array_optional);
271272

272273
/**
273274
* devm_gpiod_put - Resource-managed gpiod_put()
275+
* @dev: GPIO consumer
274276
* @desc: GPIO descriptor to dispose of
275277
*
276278
* Dispose of a GPIO descriptor obtained with devm_gpiod_get() or
@@ -286,6 +288,7 @@ EXPORT_SYMBOL(devm_gpiod_put);
286288

287289
/**
288290
* devm_gpiod_put_array - Resource-managed gpiod_put_array()
291+
* @dev: GPIO consumer
289292
* @descs: GPIO descriptor array to dispose of
290293
*
291294
* Dispose of an array of GPIO descriptors obtained with devm_gpiod_get_array().

drivers/gpio/gpio-74x164.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* published by the Free Software Foundation.
1010
*/
1111

12+
#include <linux/gpio/consumer.h>
1213
#include <linux/init.h>
1314
#include <linux/mutex.h>
1415
#include <linux/spi/spi.h>
@@ -31,6 +32,7 @@ struct gen_74x164_chip {
3132
* numbering, store the bytes in reverse order.
3233
*/
3334
u8 buffer[0];
35+
struct gpio_desc *gpiod_oe;
3436
};
3537

3638
static int __gen_74x164_write_config(struct gen_74x164_chip *chip)
@@ -126,6 +128,13 @@ static int gen_74x164_probe(struct spi_device *spi)
126128
if (!chip)
127129
return -ENOMEM;
128130

131+
chip->gpiod_oe = devm_gpiod_get_optional(&spi->dev, "enable",
132+
GPIOD_OUT_LOW);
133+
if (IS_ERR(chip->gpiod_oe))
134+
return PTR_ERR(chip->gpiod_oe);
135+
136+
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
137+
129138
spi_set_drvdata(spi, chip);
130139

131140
chip->gpio_chip.label = spi->modalias;
@@ -164,6 +173,7 @@ static int gen_74x164_remove(struct spi_device *spi)
164173
{
165174
struct gen_74x164_chip *chip = spi_get_drvdata(spi);
166175

176+
gpiod_set_value_cansleep(chip->gpiod_oe, 0);
167177
gpiochip_remove(&chip->gpio_chip);
168178
mutex_destroy(&chip->lock);
169179

drivers/gpio/gpio-altera-a10sr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc,
7171
return -EINVAL;
7272
}
7373

74-
static struct gpio_chip altr_a10sr_gc = {
74+
static const struct gpio_chip altr_a10sr_gc = {
7575
.label = "altr_a10sr_gpio",
7676
.owner = THIS_MODULE,
7777
.get = altr_a10sr_gpio_get,

drivers/gpio/gpio-altera.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ static int altera_gpio_probe(struct platform_device *pdev)
324324
return 0;
325325
teardown:
326326
of_mm_gpiochip_remove(&altera_gc->mmchip);
327-
pr_err("%s: registration failed with status %d\n",
328-
node->full_name, ret);
327+
pr_err("%pOF: registration failed with status %d\n",
328+
node, ret);
329329

330330
return ret;
331331
}

0 commit comments

Comments
 (0)