diff options
| author | Linus Walleij <linus.walleij@linaro.org> | 2019-04-08 09:48:11 -0400 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2019-04-08 09:48:11 -0400 |
| commit | 4779a066e71dee0784e09eeebb57dcd56cb7c7f6 (patch) | |
| tree | 2d45d7823ebeb4cfe069c30aeac2661352c69267 | |
| parent | 12f2639038ef420fe796171ffb810b30d1ac0619 (diff) | |
| parent | b0d2569d8276439eb3d6f7d221f47bfc503ae00e (diff) | |
Merge tag 'gpio-v5.2-updates-for-linus-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel
gpio: updates for v5.2 (part 1)
- batch of improvements for the vf610 driver which shrink the code and
make use of resource managed helpers
- support for a new variant of pca953x
- make gpio-mockup buildable on systems without IOMEM
- make gpio-74x164 more flexible by using generic device properties
plus minor improvements
- new driver for Mellanox BlueField
- fixes for wakeup GPIOs in gpio-omap
- use devm_platform_ioremap_resource() in gpio-mxc
- a couple improvements of kernel docs for ACPI code
- don't WARN() in gpiod_put() on optional GPIOs
| -rw-r--r-- | Documentation/devicetree/bindings/gpio/gpio-pca953x.txt | 1 | ||||
| -rw-r--r-- | drivers/gpio/Kconfig | 33 | ||||
| -rw-r--r-- | drivers/gpio/Makefile | 1 | ||||
| -rw-r--r-- | drivers/gpio/gpio-74x164.c | 22 | ||||
| -rw-r--r-- | drivers/gpio/gpio-mlxbf.c | 152 | ||||
| -rw-r--r-- | drivers/gpio/gpio-omap.c | 61 | ||||
| -rw-r--r-- | drivers/gpio/gpio-pca953x.c | 1 | ||||
| -rw-r--r-- | drivers/gpio/gpio-vf610.c | 85 | ||||
| -rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 45 | ||||
| -rw-r--r-- | drivers/gpio/gpiolib.c | 3 |
10 files changed, 279 insertions, 125 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt index fb144e2b6522..8678df2a5713 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt | |||
| @@ -30,6 +30,7 @@ Required properties: | |||
| 30 | ti,tca6424 | 30 | ti,tca6424 |
| 31 | ti,tca9539 | 31 | ti,tca9539 |
| 32 | ti,tca9554 | 32 | ti,tca9554 |
| 33 | onnn,cat9554 | ||
| 33 | onnn,pca9654 | 34 | onnn,pca9654 |
| 34 | exar,xra1202 | 35 | exar,xra1202 |
| 35 | - gpio-controller: if used as gpio expander. | 36 | - gpio-controller: if used as gpio expander. |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index c5420e6c9e4d..50020cacf1b4 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
| @@ -330,20 +330,6 @@ config GPIO_MM_LANTIQ | |||
| 330 | (EBU) found on Lantiq SoCs. The gpios are output only as they are | 330 | (EBU) found on Lantiq SoCs. The gpios are output only as they are |
| 331 | created by attaching a 16bit latch to the bus. | 331 | created by attaching a 16bit latch to the bus. |
| 332 | 332 | ||
| 333 | config GPIO_MOCKUP | ||
| 334 | tristate "GPIO Testing Driver" | ||
| 335 | depends on GPIOLIB && SYSFS | ||
| 336 | select GPIO_SYSFS | ||
| 337 | select GPIOLIB_IRQCHIP | ||
| 338 | select IRQ_SIM | ||
| 339 | help | ||
| 340 | This enables GPIO Testing driver, which provides a way to test GPIO | ||
| 341 | subsystem through sysfs(or char device) and debugfs. GPIO_SYSFS | ||
| 342 | must be selected for this test. | ||
| 343 | User could use it through the script in | ||
| 344 | tools/testing/selftests/gpio/gpio-mockup.sh. Reference the usage in | ||
| 345 | it. | ||
| 346 | |||
| 347 | config GPIO_MPC5200 | 333 | config GPIO_MPC5200 |
| 348 | def_bool y | 334 | def_bool y |
| 349 | depends on PPC_MPC52xx | 335 | depends on PPC_MPC52xx |
| @@ -1316,6 +1302,13 @@ config GPIO_MERRIFIELD | |||
| 1316 | help | 1302 | help |
| 1317 | Say Y here to support Intel Merrifield GPIO. | 1303 | Say Y here to support Intel Merrifield GPIO. |
| 1318 | 1304 | ||
| 1305 | config GPIO_MLXBF | ||
| 1306 | tristate "Mellanox BlueField SoC GPIO" | ||
| 1307 | depends on (MELLANOX_PLATFORM && ARM64 && ACPI) || (64BIT && COMPILE_TEST) | ||
| 1308 | select GPIO_GENERIC | ||
| 1309 | help | ||
| 1310 | Say Y here if you want GPIO support on Mellanox BlueField SoC. | ||
| 1311 | |||
| 1319 | config GPIO_ML_IOH | 1312 | config GPIO_ML_IOH |
| 1320 | tristate "OKI SEMICONDUCTOR ML7213 IOH GPIO support" | 1313 | tristate "OKI SEMICONDUCTOR ML7213 IOH GPIO support" |
| 1321 | depends on X86 || COMPILE_TEST | 1314 | depends on X86 || COMPILE_TEST |
| @@ -1442,4 +1435,16 @@ config GPIO_VIPERBOARD | |||
| 1442 | 1435 | ||
| 1443 | endmenu | 1436 | endmenu |
| 1444 | 1437 | ||
| 1438 | config GPIO_MOCKUP | ||
| 1439 | tristate "GPIO Testing Driver" | ||
| 1440 | depends on GPIOLIB | ||
| 1441 | select IRQ_SIM | ||
| 1442 | help | ||
| 1443 | This enables GPIO Testing driver, which provides a way to test GPIO | ||
| 1444 | subsystem through sysfs(or char device) and debugfs. GPIO_SYSFS | ||
| 1445 | must be selected for this test. | ||
| 1446 | User could use it through the script in | ||
| 1447 | tools/testing/selftests/gpio/gpio-mockup.sh. Reference the usage in | ||
| 1448 | it. | ||
| 1449 | |||
| 1445 | endif | 1450 | endif |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 54d55274b93a..db8d854f9aea 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
| @@ -85,6 +85,7 @@ obj-$(CONFIG_GPIO_MENZ127) += gpio-menz127.o | |||
| 85 | obj-$(CONFIG_GPIO_MERRIFIELD) += gpio-merrifield.o | 85 | obj-$(CONFIG_GPIO_MERRIFIELD) += gpio-merrifield.o |
| 86 | obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o | 86 | obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o |
| 87 | obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o | 87 | obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o |
| 88 | obj-$(CONFIG_GPIO_MLXBF) += gpio-mlxbf.o | ||
| 88 | obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o | 89 | obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o |
| 89 | obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o | 90 | obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o |
| 90 | obj-$(CONFIG_GPIO_MOCKUP) += gpio-mockup.o | 91 | obj-$(CONFIG_GPIO_MOCKUP) += gpio-mockup.o |
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index fb7b620763a2..e81307f9754e 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c | |||
| @@ -1,21 +1,18 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * 74Hx164 - Generic serial-in/parallel-out 8-bits shift register GPIO driver | 3 | * 74Hx164 - Generic serial-in/parallel-out 8-bits shift register GPIO driver |
| 3 | * | 4 | * |
| 4 | * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org> | 5 | * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org> |
| 5 | * Copyright (C) 2010 Miguel Gaio <miguel.gaio@efixo.com> | 6 | * Copyright (C) 2010 Miguel Gaio <miguel.gaio@efixo.com> |
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | 7 | */ |
| 11 | 8 | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/mutex.h> | ||
| 14 | #include <linux/spi/spi.h> | ||
| 15 | #include <linux/gpio/driver.h> | ||
| 16 | #include <linux/gpio/consumer.h> | 9 | #include <linux/gpio/consumer.h> |
| 17 | #include <linux/slab.h> | 10 | #include <linux/gpio/driver.h> |
| 18 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| 12 | #include <linux/mutex.h> | ||
| 13 | #include <linux/property.h> | ||
| 14 | #include <linux/slab.h> | ||
| 15 | #include <linux/spi/spi.h> | ||
| 19 | 16 | ||
| 20 | #define GEN_74X164_NUMBER_GPIOS 8 | 17 | #define GEN_74X164_NUMBER_GPIOS 8 |
| 21 | 18 | ||
| @@ -116,10 +113,9 @@ static int gen_74x164_probe(struct spi_device *spi) | |||
| 116 | if (ret < 0) | 113 | if (ret < 0) |
| 117 | return ret; | 114 | return ret; |
| 118 | 115 | ||
| 119 | if (of_property_read_u32(spi->dev.of_node, "registers-number", | 116 | ret = device_property_read_u32(&spi->dev, "registers-number", &nregs); |
| 120 | &nregs)) { | 117 | if (ret) { |
| 121 | dev_err(&spi->dev, | 118 | dev_err(&spi->dev, "Missing 'registers-number' property.\n"); |
| 122 | "Missing registers-number property in the DT.\n"); | ||
| 123 | return -EINVAL; | 119 | return -EINVAL; |
| 124 | } | 120 | } |
| 125 | 121 | ||
diff --git a/drivers/gpio/gpio-mlxbf.c b/drivers/gpio/gpio-mlxbf.c new file mode 100644 index 000000000000..894aaf55fc96 --- /dev/null +++ b/drivers/gpio/gpio-mlxbf.c | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | #include <linux/acpi.h> | ||
| 4 | #include <linux/bitops.h> | ||
| 5 | #include <linux/device.h> | ||
| 6 | #include <linux/gpio/driver.h> | ||
| 7 | #include <linux/io.h> | ||
| 8 | #include <linux/kernel.h> | ||
| 9 | #include <linux/module.h> | ||
| 10 | #include <linux/platform_device.h> | ||
| 11 | #include <linux/pm.h> | ||
| 12 | #include <linux/resource.h> | ||
| 13 | #include <linux/types.h> | ||
| 14 | |||
| 15 | /* Number of pins on BlueField */ | ||
| 16 | #define MLXBF_GPIO_NR 54 | ||
| 17 | |||
| 18 | /* Pad Electrical Controls. */ | ||
| 19 | #define MLXBF_GPIO_PAD_CONTROL_FIRST_WORD 0x0700 | ||
| 20 | #define MLXBF_GPIO_PAD_CONTROL_1_FIRST_WORD 0x0708 | ||
| 21 | #define MLXBF_GPIO_PAD_CONTROL_2_FIRST_WORD 0x0710 | ||
| 22 | #define MLXBF_GPIO_PAD_CONTROL_3_FIRST_WORD 0x0718 | ||
| 23 | |||
| 24 | #define MLXBF_GPIO_PIN_DIR_I 0x1040 | ||
| 25 | #define MLXBF_GPIO_PIN_DIR_O 0x1048 | ||
| 26 | #define MLXBF_GPIO_PIN_STATE 0x1000 | ||
| 27 | #define MLXBF_GPIO_SCRATCHPAD 0x20 | ||
| 28 | |||
| 29 | #ifdef CONFIG_PM | ||
| 30 | struct mlxbf_gpio_context_save_regs { | ||
| 31 | u64 scratchpad; | ||
| 32 | u64 pad_control[MLXBF_GPIO_NR]; | ||
| 33 | u64 pin_dir_i; | ||
| 34 | u64 pin_dir_o; | ||
| 35 | }; | ||
| 36 | #endif | ||
| 37 | |||
| 38 | /* Device state structure. */ | ||
| 39 | struct mlxbf_gpio_state { | ||
| 40 | struct gpio_chip gc; | ||
| 41 | |||
| 42 | /* Memory Address */ | ||
| 43 | void __iomem *base; | ||
| 44 | |||
| 45 | #ifdef CONFIG_PM | ||
| 46 | struct mlxbf_gpio_context_save_regs csave_regs; | ||
| 47 | #endif | ||
| 48 | }; | ||
| 49 | |||
| 50 | static int mlxbf_gpio_probe(struct platform_device *pdev) | ||
| 51 | { | ||
| 52 | struct mlxbf_gpio_state *gs; | ||
| 53 | struct device *dev = &pdev->dev; | ||
| 54 | struct gpio_chip *gc; | ||
| 55 | int ret; | ||
| 56 | |||
| 57 | gs = devm_kzalloc(&pdev->dev, sizeof(*gs), GFP_KERNEL); | ||
