openwrt/staging/blogic.git
5 years agoRevert "gpio: tegra: Clean-up debugfs initialisation"
Linus Walleij [Sat, 6 Jul 2019 18:15:54 +0000 (20:15 +0200)]
Revert "gpio: tegra: Clean-up debugfs initialisation"

This reverts commit a4de43049a1d0e2ed2a1d95e18e74b82cd9ca058.

The commit creates build errors.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Use spinlock_t instead of struct spinlock
Sebastian Andrzej Siewior [Thu, 4 Jul 2019 15:38:03 +0000 (17:38 +0200)]
gpiolib: Use spinlock_t instead of struct spinlock

For spinlocks the type spinlock_t should be used instead of "struct
spinlock".

Use spinlock_t for spinlock's definition.

Cc: linux-gpio@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20190704153803.12739-8-bigeasy@linutronix.de
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: stp-xway: allow compile-testing
Martin Blumenstingl [Tue, 2 Jul 2019 22:32:48 +0000 (00:32 +0200)]
gpio: stp-xway: allow compile-testing

Enable compile-testing of the stp-xway GPIO driver now that it does not
depend on any architecture specific includes anymore.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20190702223248.31934-5-martin.blumenstingl@googlemail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: stp-xway: get rid of the #include <lantiq_soc.h> dependency
Martin Blumenstingl [Tue, 2 Jul 2019 22:32:47 +0000 (00:32 +0200)]
gpio: stp-xway: get rid of the #include <lantiq_soc.h> dependency

Use the xway_stp_{r,w}32 helpers in xway_stp_w32_mask instead of relying
on ltq_{r,w}32 from the architecture specific <lantiq_soc.h>.
This will allow the driver to be compile-tested on all architectures
that support MMIO.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20190702223248.31934-4-martin.blumenstingl@googlemail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: stp-xway: improve module clock error handling
Martin Blumenstingl [Tue, 2 Jul 2019 22:32:46 +0000 (00:32 +0200)]
gpio: stp-xway: improve module clock error handling

Three module clock error handling improvements:
- use devm_clk_get() so the clock instance can be freed if
  devm_gpiochip_add_data() fails later on
- switch to clk_prepare_enable() so the driver is ready whenever the
  lantiq target switches to the common clock framework
- disable the clock again (using clk_disable_unprepare()) if
  devm_gpiochip_add_data()

All of these are virtually no-ops with the current lantiq target.
However, these will be relevant if we switch to the common clock
framework.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20190702223248.31934-3-martin.blumenstingl@googlemail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: stp-xway: simplify error handling in xway_stp_probe()
Martin Blumenstingl [Tue, 2 Jul 2019 22:32:45 +0000 (00:32 +0200)]
gpio: stp-xway: simplify error handling in xway_stp_probe()

Return early if devm_gpiochip_add_data() returns an error instead of
having two consecutive "if (!ret) ..." statements.

Also make xway_stp_hw_init() return void because it unconditionally
returns 0. While here also update the kerneldoc comment for
xway_stp_hw_init().

These changes makes the error handling within the driver consistent.
No functional changes intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20190702223248.31934-2-martin.blumenstingl@googlemail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Clarify use of non-sleeping functions
Geert Uytterhoeven [Mon, 1 Jul 2019 14:28:09 +0000 (16:28 +0200)]
gpiolib: Clarify use of non-sleeping functions

Obviously functions that are safe to be called from atomic contexts, can
be called from non-atomic contexts, too.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20190701142809.25308-1-geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Fix references to gpiod_[gs]et_*value_cansleep() variants
Geert Uytterhoeven [Mon, 1 Jul 2019 14:27:38 +0000 (16:27 +0200)]
gpiolib: Fix references to gpiod_[gs]et_*value_cansleep() variants

Commit 372e722ea4dd4ca1 ("gpiolib: use descriptors internally") renamed
the functions to use a "gpiod" prefix, and commit 79a9becda8940deb
("gpiolib: export descriptor-based GPIO interface") introduced the "raw"
variants, but both changes forgot to update the comments.

Readd a similar reference to gpiod_set_value(), which was accidentally
removed by commit 1e77fc82110ac36f ("gpio: Add missing open drain/source
handling to gpiod_set_value_cansleep()").

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20190701142738.25219-1-geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Document new gpio_chip.init_valid_mask field
Geert Uytterhoeven [Mon, 1 Jul 2019 14:26:50 +0000 (16:26 +0200)]
gpiolib: Document new gpio_chip.init_valid_mask field

A new field init_valid_mask was added to struct gpio_chip, but it was
not documented.

Fixes: f8ec92a9f63b3b11 ("gpiolib: Add init_valid_mask exported function")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20190701142650.25122-1-geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoDocumentation: gpio: Fix reference to gpiod_get_array()
Geert Uytterhoeven [Mon, 1 Jul 2019 14:10:05 +0000 (16:10 +0200)]
Documentation: gpio: Fix reference to gpiod_get_array()

The function is called gpiod_get_array(), not gpiod_array_get().

Fixes: 77588c14ac868cae ("gpiolib: Pass array info to get/set array functions")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20190701141005.24631-1-geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pl061: drop duplicate printing of device name
Enrico Weigelt [Wed, 3 Jul 2019 09:42:24 +0000 (11:42 +0200)]
gpio: pl061: drop duplicate printing of device name

The dev_info() call already prints the device name, so there's
no need to explicitly include it in the message for second time.

Signed-off-by: Enrico Weigelt <info@metux.net>
Link: https://lore.kernel.org/r/1562146944-4162-1-git-send-email-info@metux.net
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: altera: Pass irqchip when adding gpiochip
Linus Walleij [Tue, 25 Jun 2019 11:35:32 +0000 (13:35 +0200)]
gpio: altera: Pass irqchip when adding gpiochip

We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip.

For chained irqchips this is a pretty straight-forward
conversion.

Cc: Ley Foon Tan <lftan@altera.com>
Cc: Tien Hock Loh <thloh@altera.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: siox: Use devm_ managed gpiochip
Linus Walleij [Wed, 26 Jun 2019 08:23:28 +0000 (10:23 +0200)]
gpio: siox: Use devm_ managed gpiochip

By using devm_gpiochip_add_data() we can get rid of the
remove() callback. As this driver doesn't use the
gpiochip data pointer we simply pass in NULL.

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: siox: Add struct device *dev helper variable
Linus Walleij [Wed, 26 Jun 2019 08:21:27 +0000 (10:21 +0200)]
gpio: siox: Add struct device *dev helper variable

This makes the code easier to read.

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: siox: Pass irqchip when adding gpiochip
Linus Walleij [Tue, 25 Jun 2019 10:36:12 +0000 (12:36 +0200)]
gpio: siox: Pass irqchip when adding gpiochip

We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip.

For chained irqchips this is a pretty straight-forward
conversion.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodrivers: gpio: amd-fch: make resource struct const
Enrico Weigelt [Mon, 17 Jun 2019 16:00:10 +0000 (18:00 +0200)]
drivers: gpio: amd-fch: make resource struct const

The struct resource field is statically initialized
and may never change. Therefore make it const.

Signed-off-by: Enrico Weigelt <info@metux.net>
Link: https://lore.kernel.org/r/1560787211-15443-1-git-send-email-info@metux.net
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodevres: allow const resource arguments
Arnd Bergmann [Fri, 28 Jun 2019 14:59:45 +0000 (16:59 +0200)]
devres: allow const resource arguments

devm_ioremap_resource() does not currently take 'const' arguments,
which results in a warning from the first driver trying to do it
anyway:

drivers/gpio/gpio-amd-fch.c: In function 'amd_fch_gpio_probe':
drivers/gpio/gpio-amd-fch.c:171:49: error: passing argument 2 of 'devm_ioremap_resource' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  priv->base = devm_ioremap_resource(&pdev->dev, &amd_fch_gpio_iores);
                                                 ^~~~~~~~~~~~~~~~~~~

Change the prototype to allow it, as there is no real reason not to.

Fixes: 9bb2e0452508 ("gpio: amd: Make resource struct const")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20190628150049.1108048-1-arnd@arndb.de
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviwed-By: Enrico Weigelt <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ath79: Pass irqchip when adding gpiochip
Linus Walleij [Tue, 25 Jun 2019 11:57:33 +0000 (13:57 +0200)]
gpio: ath79: Pass irqchip when adding gpiochip

We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip.

For chained irqchips this is a pretty straight-forward
conversion.

Take this opportunity to add a local dev pointer and
use devm_gpiochip_add() so we can get rid of the remove()
callback altogether.

Cc: linux-mips@linux-mips.org
Acked-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: tegra: Clean-up debugfs initialisation
Jon Hunter [Wed, 26 Jun 2019 13:42:58 +0000 (14:42 +0100)]
gpio: tegra: Clean-up debugfs initialisation

The function tegra_gpio_debuginit() just calls debugfs_create_file()
and given that there is already a stub function implemented for
debugfs_create_file() when CONFIG_DEBUG_FS is not enabled, there is
no need for the function tegra_gpio_debuginit() and so remove it.

Finally, use a space and not a tab between the #ifdef and
CONFIG_DEBUG_FS.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMerge tag 'gpio-v5.3-updates-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Walleij [Thu, 27 Jun 2019 14:59:16 +0000 (15:59 +0100)]
Merge tag 'gpio-v5.3-updates-for-linus' of git://git./linux/kernel/git/brgl/linux into devel

gpio: updates for v5.3

- add include/linux/gpio.h to .gitignore in /tools
- improve and simplify code in the em driver
- simplify code in max732x by using devm helpers (including the new
  devm_i2c_new_dummy_device())
- fix SPDX header for madera
- remove checking of return values of debugfs routines in gpio-mockup

5 years agogpio: siox: Switch to IRQ_TYPE_NONE
Linus Walleij [Wed, 26 Jun 2019 08:11:17 +0000 (10:11 +0200)]
gpio: siox: Switch to IRQ_TYPE_NONE

The siox driver is hardcoding a default type of
IRQ_TYPE_EDGE_RISING to the irq helper, but this should only
be applicable to old boardfiles and odd device tree irqchips
with just onecell irq (no flags). I doubt this is the case
with the siox, I think all consumers specify the flags they
use in the device tree.

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: siox: Do not call gpiochip_remove() on errorpath
Linus Walleij [Wed, 26 Jun 2019 08:09:00 +0000 (10:09 +0200)]
gpio: siox: Do not call gpiochip_remove() on errorpath

gpiochip_remove() was called on the errorpath if
gpiochip_add() failed: this is wrong, if the chip failed
to add it is not there so it should not be removed.

Fixes: be8c8facc707 ("gpio: new driver to work with a 8x12 siox")
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pl061: Pass irqchip when adding gpiochip
Linus Walleij [Tue, 25 Jun 2019 11:15:02 +0000 (13:15 +0200)]
gpio: pl061: Pass irqchip when adding gpiochip

We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip.

For chained irqchips this is a pretty straight-forward
conversion.

Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: tegra: No need to cast away return value of debugfs_create_file()
Greg Kroah-Hartman [Tue, 18 Jun 2019 15:50:46 +0000 (17:50 +0200)]
gpio: tegra: No need to cast away return value of debugfs_create_file()

It is fine to ignore the return value (and encouraged),
so no need to cast away the return value, you will not get
a build warning at all.

Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: No need to cast away return value of debugfs_create_file()
Greg Kroah-Hartman [Tue, 18 Jun 2019 15:50:45 +0000 (17:50 +0200)]
gpio: No need to cast away return value of debugfs_create_file()

It is fine to ignore the return value (and encouraged), so need to cast
away the return value, you will not get a build warning at all.

Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Sort GPIO drivers in Makefile
Geert Uytterhoeven [Mon, 24 Jun 2019 14:49:56 +0000 (16:49 +0200)]
gpio: Sort GPIO drivers in Makefile

Sort the definitions for the individual GPIO drivers
in the Makefile by object file name. Align all entries
while we're at it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: siox: Use module_siox_driver()
Enrico Weigelt [Mon, 24 Jun 2019 05:40:34 +0000 (07:40 +0200)]
gpio: siox: Use module_siox_driver()

Reduce driver init boilerplate by using the new
module_siox_driver() macro.

Signed-off-by: Enrico Weigelt <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agosiox: Add helper macro to simplify driver registration
Enrico Weigelt [Mon, 24 Jun 2019 05:40:33 +0000 (07:40 +0200)]
siox: Add helper macro to simplify driver registration

Add more helper macros for trivial driver init cases, similar to the
already existing module_platform_driver() or module_i2c_driver().

This helps to reduce driver init boilerplate.

Signed-off-by: Enrico Weigelt <info@metux.net>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: eic-sprd: Use devm_platform_ioremap_resource()
Enrico Weigelt, metux IT consult [Mon, 17 Jun 2019 16:49:16 +0000 (18:49 +0200)]
gpio: eic-sprd: Use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vr41xx: Use devm_platform_ioremap_resource()
Enrico Weigelt, metux IT consult [Mon, 17 Jun 2019 16:49:20 +0000 (18:49 +0200)]
gpio: vr41xx: Use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together.

this driver deserves a bit more cleanup, to get rid of the global
variable giu_base, which makes it single-instance-only.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: janz-ttl: Drop unneccessary temp variable dev
Enrico Weigelt, metux IT consult [Mon, 17 Jun 2019 16:49:19 +0000 (18:49 +0200)]
gpio: janz-ttl: Drop unneccessary temp variable dev

don't need the temporary variable "dev", directly use &pdev->dev

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: grgpio: Use devm_platform_ioremap_resource()
Enrico Weigelt, metux IT consult [Mon, 17 Jun 2019 16:49:18 +0000 (18:49 +0200)]
gpio: grgpio: Use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Use devm_platform_ioremap_resource()
Enrico Weigelt, metux IT consult [Mon, 17 Jun 2019 16:49:17 +0000 (18:49 +0200)]
gpio: ep93xx: Use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: amdpt: Drop unneeded deref of &pdev->dev
Enrico Weigelt, metux IT consult [Mon, 17 Jun 2019 16:49:15 +0000 (18:49 +0200)]
gpio: amdpt: Drop unneeded deref of &pdev->dev

We already have the struct device* pointer in a local variable,
so we can write this a bit shorter.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: rcar: Pedantic formatting
Enrico Weigelt, metux IT consult [Mon, 17 Jun 2019 16:49:14 +0000 (18:49 +0200)]
gpio: rcar: Pedantic formatting

A tab sneaked in, where it shouldn't be.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Add comments on #if/#else/#endif
Enrico Weigelt [Mon, 17 Jun 2019 16:45:05 +0000 (18:45 +0200)]
gpio: Add comments on #if/#else/#endif

Improve readability a bit by commenting #if/#else/#endif statements
with the checked preprocessor symbols.

Signed-off-by: Enrico Weigelt <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: amd: Drop unused pdev pointer in privata data
Enrico Weigelt [Mon, 17 Jun 2019 16:00:11 +0000 (18:00 +0200)]
gpio: amd: Drop unused pdev pointer in privata data

The pointer to the struct platform_device in the driver's private
data struct is never used and therefore can be dropped.

Signed-off-by: Enrico Weigelt <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: mockup: no need to check return value of debugfs_create functions
Greg Kroah-Hartman [Wed, 26 Jun 2019 08:45:57 +0000 (10:45 +0200)]
gpio: mockup: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Bamvor Jian Zhang <bamv2005@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[Bartosz: removed one more check for debugfs return value]
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: madera: Fixup SPDX headers
Charles Keepax [Tue, 25 Jun 2019 15:39:15 +0000 (16:39 +0100)]
gpio: madera: Fixup SPDX headers

GPL-2.0-only is the preferred way of expressing v2 of the GPL, so switch
to that and remove some redundant copyright notices.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agogpio: Drop the parent_irq from gpio_irq_chip
Linus Walleij [Fri, 14 Jun 2019 08:12:26 +0000 (10:12 +0200)]
gpio: Drop the parent_irq from gpio_irq_chip

We already have an array named "parents" so instead
of letting one point to the other, simply allocate a
dynamic array to hold the parents, just one if desired
and drop the number of members in gpio_irq_chip by
1. Rename gpiochip to gc in the process.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Add GPIOLIB_IRQCHIP cleanup to TODO
Linus Walleij [Fri, 14 Jun 2019 07:34:11 +0000 (09:34 +0200)]
gpio: Add GPIOLIB_IRQCHIP cleanup to TODO

We now have two APIs for registering GPIOLIB_IRQCHIP, this is not
working and creating confusion. Add a TODO item to fix it up.

Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ftgpio: Pass irqchip when adding gpiochip
Linus Walleij [Thu, 13 Jun 2019 14:11:42 +0000 (16:11 +0200)]
gpio: ftgpio: Pass irqchip when adding gpiochip

We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip.

For chained irqchips this is a pretty straight-forward
conversion.

Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: Fix lost edge wake-up interrupts
Tony Lindgren [Wed, 12 Jun 2019 06:33:52 +0000 (23:33 -0700)]
gpio: omap: Fix lost edge wake-up interrupts

If an edge interrupt triggers while entering idle just before we save
GPIO datain register to saved_datain, the triggered GPIO will not be
noticed on wake-up. This is because the saved_datain and GPIO datain
are the same on wake-up in omap_gpio_unidle(). Let's fix this by
ignoring any pending edge interrupts for saved_datain.

This issue affects only idle states where the GPIO module internal
wake-up path is operational. For deeper idle states where the GPIO
module gets powered off, Linux generic wakeirqs must be used for
the padconf wake-up events with pinctrl-single driver. For examples,
please see "interrupts-extended" dts usage in many drivers.

This issue can be somewhat easily reproduced by pinging an idle system
with smsc911x Ethernet interface configured IRQ_TYPE_EDGE_FALLING. At
some point the smsc911x interrupts will just stop triggering. Also if
WLCORE WLAN is used with EDGE interrupt like it's documentation specifies,
we can see lost interrupts without this patch.

Note that in the long run we may be able to cancel entering idle by
returning an error in gpio_omap_cpu_notifier() on pending interrupts.
But let's fix the bug first.

Also note that because of the recent clean-up efforts this patch does
not apply directly to older kernels. This does fix a long term issue
though, and can be backported as needed.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Keerthy <j-keerthy@ti.com>
Cc: Ladislav Michl <ladis@linux-mips.org>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agofmc: Delete the FMC subsystem
Linus Walleij [Mon, 10 Jun 2019 14:04:39 +0000 (16:04 +0200)]
fmc: Delete the FMC subsystem

The FMC subsystem was created in 2012 with the ambition to
drive development of drivers for this hardware upstream.

The current implementation has architectural flaws and would
need to be revamped using real hardware to something that can
reuse existing kernel abstractions in the subsystems for e.g.
I2C, FPGA and GPIO.

We have concluded that for the mainline kernel it will be
better to delete the subsystem and start over with a clean
slate when/if an active maintainer steps up.

For details see:
https://lkml.org/lkml/2018/10/29/534

Suggested-by: Federico Vaga <federico.vaga@cern.ch>
Cc: Pat Riehecky <riehecky@fnal.gov>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: clean up register access in omap2_set_gpio_debounce()
Russell King [Mon, 10 Jun 2019 17:11:03 +0000 (20:11 +0300)]
gpio: omap: clean up register access in omap2_set_gpio_debounce()

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: irq_startup() must not return error codes
Russell King [Mon, 10 Jun 2019 17:11:02 +0000 (20:11 +0300)]
gpio: omap: irq_startup() must not return error codes

The irq_startup() method returns an unsigned int, but in __irq_startup()
it is assigned to an int.  However, nothing checks for errors, so any
error that is returned is ignored.

Remove the check for GPIO-input mode and the error return.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: clean up wakeup handling
Russell King [Mon, 10 Jun 2019 17:11:01 +0000 (20:11 +0300)]
gpio: omap: clean up wakeup handling

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: constify register tables
Russell King [Mon, 10 Jun 2019 17:11:00 +0000 (20:11 +0300)]
gpio: omap: constify register tables

We must never alter the register tables; these are read-only as far
as the driver is concerned.  Constify these tables.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: clean up omap_gpio_restore_context()
Russell King [Mon, 10 Jun 2019 17:10:59 +0000 (20:10 +0300)]
gpio: omap: clean up omap_gpio_restore_context()

Use local variables to store the base iomem address and regs table
pointer like omap_gpio_init_context() does. Not only does this make
the function neater, it also avoids unnecessary reloads of the same
data multiple times.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: remove dataout variation in context handling
Russell King [Mon, 10 Jun 2019 17:10:58 +0000 (20:10 +0300)]
gpio: omap: remove dataout variation in context handling

When a GPIO block has the set/clear dataout registers implemented, it
also has the normal dataout register implemented. Reading this register
reads the current GPIO output state, and writing it sets the GPIOs to
the explicit state. This is the behaviour that we want when saving and
restoring the context, so use the dataout register exclusively.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify omap_set_gpio_irqenable()
Russell King [Mon, 10 Jun 2019 17:10:57 +0000 (20:10 +0300)]
gpio: omap: simplify omap_set_gpio_irqenable()

omap_set_gpio_irqenable() calls two helpers that are almost the same
apart from whether they set or clear bits. We can consolidate these:

- in the set/clear bit register case, we can perform the operation on
  our saved context copy and write the appropriate set/clear register.
- otherwise, we can use our read-modify-write helper and invert enable
  if irqenable_inv is set.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify omap_toggle_gpio_edge_triggering()
Russell King [Mon, 10 Jun 2019 17:10:56 +0000 (20:10 +0300)]
gpio: omap: simplify omap_toggle_gpio_edge_triggering()

This function open-codes an exclusive-or bitwise operation using an
if() statement and explicitly setting or clearing the bit. Instead,
use an exclusive-or operation instead, and simplify the function.

We can combine the preprocessor conditional using IS_ENABLED() and
gain some additional compilation coverage.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify read-modify-write
Russell King [Mon, 10 Jun 2019 17:10:55 +0000 (20:10 +0300)]
gpio: omap: simplify read-modify-write

We already have a read-modify-write helper, but there's more that can
be done with a read-modify-write helper if it returned the new value.
Modify the existing helper to return the new value, and arrange for
it to take one less argument by having the caller compute the register
address.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify bank->level_mask
Russell King [Mon, 10 Jun 2019 17:10:54 +0000 (20:10 +0300)]
gpio: omap: simplify bank->level_mask

bank->level_mask is merely the bitwise or of the level detection
context which we have already read in this function.  Rather than
repeating additional reads, compute it from the values already
read.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify set_multiple()
Russell King [Mon, 10 Jun 2019 17:10:53 +0000 (20:10 +0300)]
gpio: omap: simplify set_multiple()

One of the reasons for set_multiple() to exist is to allow multiple
GPIOs on the same chip to be changed simultaneously - see commit
5f42424354f5 ("gpiolib: allow simultaneous setting of multiple GPIO
outputs"):

 - Simultaneous glitch-free setting of multiple pins on any kind of
   parallel bus attached to GPIOs provided they all reside on the
   same chip and bank.

In order for this to work, we should not use the atomic set/clear
registers, but instead read-modify-write the dataout register.  We
already take the spinlock to ensure that happens atomically, so
move the code into the set_multiple() function and kill the two
helper functions.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify get_multiple()
Russell King [Mon, 10 Jun 2019 17:10:52 +0000 (20:10 +0300)]
gpio: omap: simplify get_multiple()

There is no reason to have helper functions to read the datain and
dataout registers when they are only used in one location.  Simplify
this code to make it more readable.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify get() method
Russell King [Mon, 10 Jun 2019 17:10:51 +0000 (20:10 +0300)]
gpio: omap: simplify get() method

omap_gpio_get() calls omap_get_gpio_datain() or omap_get_gpio_dataout()
to read the GPIO state. These two functions are only called from this
method, so they don't add much value.  Move their contents into
omap_gpio_get() method and simplify.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: simplify omap_gpio_get_direction()
Russell King [Mon, 10 Jun 2019 17:10:50 +0000 (20:10 +0300)]
gpio: omap: simplify omap_gpio_get_direction()

Architectures are single-copy atomic, which means that simply reading
a register is an inherently atomic operation.  There is no need to
take a spinlock here.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: move omap_gpio_request() and omap_gpio_free()
Russell King [Mon, 10 Jun 2019 17:10:49 +0000 (20:10 +0300)]
gpio: omap: move omap_gpio_request() and omap_gpio_free()

Move these two functions to live beside the rest of the gpio chip
implementation, rather than in the middle of the irq chip
implementation.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: remove irq_ack method
Russell King [Mon, 10 Jun 2019 17:10:48 +0000 (20:10 +0300)]
gpio: omap: remove irq_ack method

The irq_ack method does not fit our hardware requirements. Edge
interrupts must be cleared before we handle them, and level interrupts
must be cleared after handling them.

We handle the interrupt clearance in our interrupt handler for edge IRQs
and in the unmask method for level IRQs.

Replace the irq_ack method with the no-op method from the dummy irq
chip.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: clean up edge interrupt handling
Russell King [Mon, 10 Jun 2019 17:10:47 +0000 (20:10 +0300)]
gpio: omap: clean up edge interrupt handling

The edge interrupt handling was effectively:

isr = ISR_reg & enabled;
if (bank->level_mask)
level_mask = bank->level_mask & enabled;
else
level_mask = 0;

edge = isr & ~level_mask;

When bank->level_mask is zero, level_mask will be computed as zero
anyway, so the if() statement is redundant.  We are then left with:

isr = ISR_reg & enabled;
level_mask = bank->level_mask & enabled;
edge = isr & ~level_mask;

This can be simplified further to:

isr = ISR_reg & enabled;
edge = isr & ~bank->level_mask;

since the second mask with 'enabled' is redundant.

Improve the associated comment as well.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: remove remainder of list management
Russell King [Mon, 10 Jun 2019 17:10:46 +0000 (20:10 +0300)]
gpio: omap: remove remainder of list management

Commit c4791bc6e3a6 ("gpio: omap: drop omap_gpio_list") removed the
list head and addition to the list head of each gpio bank, but failed
to remove the list_del() call and the node inside struct gpio_bank.
Remove these too.

Fixes: c4791bc6e3a6 ("gpio: omap: drop omap_gpio_list")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: fix lack of irqstatus_raw0 for OMAP4
Russell King [Mon, 10 Jun 2019 17:10:45 +0000 (20:10 +0300)]
gpio: omap: fix lack of irqstatus_raw0 for OMAP4

Commit 384ebe1c2849 ("gpio/omap: Add DT support to GPIO driver") added
the register definition tables to the gpio-omap driver. Subsequently to
that commit, commit 4e962e8998cc ("gpio/omap: remove cpu_is_omapxxxx()
checks from *_runtime_resume()") added definitions for irqstatus_raw*
registers to the legacy OMAP4 definitions, but missed the DT
definitions.

This causes an unintentional change of behaviour for the 1.101 errata
workaround on OMAP4 platforms. Fix this oversight.

Fixes: 4e962e8998cc ("gpio/omap: remove cpu_is_omapxxxx() checks from *_runtime_resume()")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: omap: ensure irq is enabled before wakeup
Russell King [Mon, 10 Jun 2019 17:10:44 +0000 (20:10 +0300)]
gpio: omap: ensure irq is enabled before wakeup

Documentation states:

  NOTE: There must be a correlation between the wake-up enable and
  interrupt-enable registers. If a GPIO pin has a wake-up configured
  on it, it must also have the corresponding interrupt enabled (on
  one of the two interrupt lines).

Ensure that this condition is always satisfied by enabling the detection
events after enabling the interrupt, and disabling the detection before
disabling the interrupt.  This ensures interrupt/wakeup events can not
happen until both the wakeup and interrupt enables correlate.

If we do any clearing, clear between the interrupt enable/disable and
trigger setting.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMerge branch 'ib-snps-reset-gpio' into devel
Linus Walleij [Wed, 12 Jun 2019 07:47:15 +0000 (09:47 +0200)]
Merge branch 'ib-snps-reset-gpio' into devel

5 years agogpio: of: parse stmmac PHY reset line specific active-low property
Martin Blumenstingl [Mon, 10 Jun 2019 17:05:23 +0000 (19:05 +0200)]
gpio: of: parse stmmac PHY reset line specific active-low property

The stmmac driver currently ignores the GPIO flags which are passed via
devicetree because it operates with legacy GPIO numbers instead of GPIO
descriptors. stmmac assumes that the GPIO is "active HIGH" by default.
This can be overwritten by setting "snps,reset-active-low" to make the
reset line "active LOW".

Recent Amlogic SoCs (G12A which includes S905X2 and S905D2 as well as
G12B which includes S922X) use GPIOZ_14 or GPIOZ_15 for the PHY reset
line. These GPIOs are special because they are marked as "3.3V input
tolerant open drain" pins which means they can only drive the pin output
LOW (to reset the PHY) or to switch to input mode (to take the PHY out
of reset).
The GPIO subsystem already supports this with the GPIO_OPEN_DRAIN and
GPIO_OPEN_SOURCE flags in the devicetree bindings.

Add the stmmac PHY reset line specific active low parsing to gpiolib-of
so stmmac can be ported to GPIO descriptors while being backwards
compatible with device trees which use the "old" way of specifying the
polarity.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: altera: Allocate irq_chip dynamically
Phil Reid [Mon, 10 Jun 2019 09:50:11 +0000 (17:50 +0800)]
gpio: altera: Allocate irq_chip dynamically

Keeping the irq_chip definition static shares it with multiple instances
of the altera gpiochip in the system. This is bad and now we get this
warning from gpiolib core:

"detected irqchip that is shared with multiple gpiochips: please fix the
driver."

Hence, move the irq_chip definition from being driver static into the
struct altera_gpio_chips. So a unique irq_chip is used for each gpiochip
instance.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: xilinx: convert from OF GPIO to standard devm APIs
Robert Hancock [Fri, 7 Jun 2019 17:04:16 +0000 (11:04 -0600)]
gpio: xilinx: convert from OF GPIO to standard devm APIs

This driver was using the OF GPIO helper API, but barely used any of its
features and it cost more code than it saved. Also, the OF GPIO code is
now deprecated. Convert it to use a more standard setup and use devm
APIs for initialization to avoid the need for a remove function.

Our rationale for this change is that we are using the Xilinx GPIO with
resources injected using the MFD core rather than on the device tree
itself. Using platform rather than OF-specific resources allows this to
work for free.

Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agofmc: Decouple from Linux GPIO subsystem
Linus Walleij [Sat, 8 Jun 2019 23:11:38 +0000 (01:11 +0200)]
fmc: Decouple from Linux GPIO subsystem

FMC has its own GPIO handling, the inclusion of <linux/gpio.h>
is only to reuse some flags that we can just as well provide
using local defines.

Cc: Federico Vaga <federico.vaga@cern.ch>
Cc: Pat Riehecky <riehecky@fnal.gov>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: gpio: davinci: Add k3 am654 compatible
Keerthy [Thu, 6 Jun 2019 09:56:17 +0000 (15:26 +0530)]
dt-bindings: gpio: davinci: Add k3 am654 compatible

The patch adds k3 am654 compatible, specific properties and
an example.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: davinci: Add new compatible for K3 AM654 SoCs
Keerthy [Wed, 5 Jun 2019 08:02:58 +0000 (13:32 +0530)]
gpio: davinci: Add new compatible for K3 AM654 SoCs

Add new compatible for K3 AM654 SoCs.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Davinci: Add K3 dependencies
Keerthy [Wed, 5 Jun 2019 05:55:19 +0000 (11:25 +0530)]
gpio: Davinci: Add K3 dependencies

Add K3 dependencies to enable the driver on K3 platforms.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: davinci: Fix the compiler warning with ARM64 config enabled
Keerthy [Wed, 5 Jun 2019 08:02:57 +0000 (13:32 +0530)]
gpio: davinci: Fix the compiler warning with ARM64 config enabled

Fix the compiler warning with ARM64 config enabled
as the current mask assumes 32 bit by default.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pass lookup and descriptor flags to request_own
Linus Walleij [Fri, 26 Apr 2019 12:40:18 +0000 (14:40 +0200)]
gpio: pass lookup and descriptor flags to request_own

When a gpio_chip wants to request a descriptor from itself
using gpiochip_request_own_desc() it needs to be able to specify
fully how to use the descriptor, notably line inversion
semantics. The workaround in the gpiolib.c can be removed
and cases (such as SPI CS) where we need at times to request
a GPIO with line inversion semantics directly on a chip for
workarounds, can be fully supported with this call.

Fix up some users of the API that weren't really using the
last flag to set up the line as input or output properly
but instead just calling direction setting explicitly
after requesting the line.

Cc: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodocs: gpio: driver.rst: fix a bad tag
Mauro Carvalho Chehab [Wed, 29 May 2019 23:23:47 +0000 (20:23 -0300)]
docs: gpio: driver.rst: fix a bad tag

With ReST, [foo]_ means a reference to foo, causing this warning:

    Documentation/driver-api/gpio/driver.rst:419: WARNING: Unknown target name: "devm".

Fix it by using a literal for the name.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Add support for the TI TCA9539
Peter Robinson [Sat, 1 Jun 2019 07:12:18 +0000 (08:12 +0100)]
gpio: pca953x: Add support for the TI TCA9539

The TI TCA9539 is a variant of the PCA953x GPIO expander,
with 16 GPIOs and interrupt functionality.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: of: Handle the Freescale SPI CS
Linus Walleij [Thu, 13 Dec 2018 14:22:47 +0000 (15:22 +0100)]
gpio: of: Handle the Freescale SPI CS

The Freescale SPI chipselects are special: while everyone else
is using "cs-gpios" the Freescale platforms just use "gpios".
Fix this by responding with "gpios" when asking for "cs-gpios"
in a freescale device node, so we hide this pecularity from
the SPI core.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: max732x: use devm_gpiochip_add_data()
Bartosz Golaszewski [Tue, 21 May 2019 09:03:06 +0000 (11:03 +0200)]
gpio: max732x: use devm_gpiochip_add_data()

We can simplify the code a bit with a resource managed variant of
gpiochip_add_data().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agogpio: max732x: use i2c_new_dummy_device()
Bartosz Golaszewski [Tue, 21 May 2019 09:03:05 +0000 (11:03 +0200)]
gpio: max732x: use i2c_new_dummy_device()

We now have a resource managed version of i2c_new_dummy_device() that
also returns an actual error code instead of a NULL-pointer. Use it
in the max732x GPIO driver and simplify code in the process.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agogpio: em: use the managed version of gpiochip_add_data()
Bartosz Golaszewski [Tue, 28 May 2019 15:46:01 +0000 (17:46 +0200)]
gpio: em: use the managed version of gpiochip_add_data()

Use the managed variant of gpiochip_add_data() and remove the call to
gpiochip_remove().

Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
5 years agogpio: em: Return early on error in em_gio_probe()
Geert Uytterhoeven [Mon, 27 May 2019 12:40:51 +0000 (14:40 +0200)]
gpio: em: Return early on error in em_gio_probe()

em_gio_probe() uses managed initializations for everything but creating
the IRQ domain.  Hence in most failure cases, no cleanup needs to be
performed at all.

Make this clearer for the casual reviewer by returning early, instead of
jumping to an out-of-sight label.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agogpio: em: Remove error messages on out-of-memory conditions
Geert Uytterhoeven [Mon, 27 May 2019 12:40:50 +0000 (14:40 +0200)]
gpio: em: Remove error messages on out-of-memory conditions

There is no need to print error messages when memory allocations or
related operations fail, as the core will take care of that.

Change the returned error codes to -ENOMEM to match the failure cause
while at it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agodt-bindings: gpio: Convert Arm PL061 to json-schema
Rob Herring [Tue, 14 May 2019 00:50:33 +0000 (19:50 -0500)]
dt-bindings: gpio: Convert Arm PL061 to json-schema

Convert the Arm PL061 GPIO controller binding to json-schema format.

As I'm the author for all but the gpio-ranges line, make the schema dual
GPL/BSD license.

Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoDocumentation: gpio: remove duplicated lines
Luca Ceresoli [Fri, 10 May 2019 09:03:39 +0000 (11:03 +0200)]
Documentation: gpio: remove duplicated lines

The 'default (active high)' lines are repeated twice. Avoid people stare at
their screens looking for differences.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ixp4xx: Use irq_domain_translate_twocell()
Linus Walleij [Thu, 23 May 2019 09:49:47 +0000 (11:49 +0200)]
gpio: ixp4xx: Use irq_domain_translate_twocell()

Use standard functions. Eventually we will be able to drop all
checks and just assign irq_domain_translate_twocell() to this
callback.

Cc: Brian Masney <masneyb@onstation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Fix minor grammar errors in documentation
Linus Walleij [Thu, 23 May 2019 08:17:36 +0000 (10:17 +0200)]
gpio: Fix minor grammar errors in documentation

This fixes up some of my own mistakes when I stressed to refresh
the documentation.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Update Kconfig text for GPIO_SYSFS
Linus Walleij [Thu, 23 May 2019 06:54:19 +0000 (08:54 +0200)]
gpio: Update Kconfig text for GPIO_SYSFS

This feature is deprecated, it is helpful to inform users about
this. I'm resisting the temptation to add "depends on BROKEN"
to this, but saving that for later.

Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vf610: Use PTR_ERR_OR_ZERO() in vf610_gpio_probe()
Andrey Smirnov [Mon, 29 Apr 2019 05:49:48 +0000 (22:49 -0700)]
gpio: vf610: Use PTR_ERR_OR_ZERO() in vf610_gpio_probe()

Simplify error checking code by replacing multiple ERR macros with a
call to PTR_ERR_OR_ZERO. No functional change intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoLinux 5.2-rc2
Linus Torvalds [Sun, 26 May 2019 23:49:19 +0000 (16:49 -0700)]
Linux 5.2-rc2

5 years agoMerge tag 'trace-v5.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Sun, 26 May 2019 20:49:40 +0000 (13:49 -0700)]
Merge tag 'trace-v5.2-rc1-2' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracing warning fix from Steven Rostedt:
 "Make the GCC 9 warning for sub struct memset go away.

  GCC 9 now warns about calling memset() on partial structures when it
  goes across multiple fields. This adds a helper for the place in
  tracing that does this type of clearing of a structure"

* tag 'trace-v5.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Silence GCC 9 array bounds warning

5 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 26 May 2019 20:45:15 +0000 (13:45 -0700)]
Merge tag 'for-linus' of git://git./virt/kvm/kvm

Pull KVM fixes from Paolo Bonzini:
 "The usual smattering of fixes and tunings that came in too late for
  the merge window, but should not wait four months before they appear
  in a release.

  I also travelled a bit more than usual in the first part of May, which
  didn't help with picking up patches and reports promptly"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (33 commits)
  KVM: x86: fix return value for reserved EFER
  tools/kvm_stat: fix fields filter for child events
  KVM: selftests: Wrap vcpu_nested_state_get/set functions with x86 guard
  kvm: selftests: aarch64: compile with warnings on
  kvm: selftests: aarch64: fix default vm mode
  kvm: selftests: aarch64: dirty_log_test: fix unaligned memslot size
  KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION
  KVM: x86/pmu: do not mask the value that is written to fixed PMUs
  KVM: x86/pmu: mask the result of rdpmc according to the width of the counters
  x86/kvm/pmu: Set AMD's virt PMU version to 1
  KVM: x86: do not spam dmesg with VMCS/VMCB dumps
  kvm: Check irqchip mode before assign irqfd
  kvm: svm/avic: fix off-by-one in checking host APIC ID
  KVM: selftests: do not blindly clobber registers in guest asm
  KVM: selftests: Remove duplicated TEST_ASSERT in hyperv_cpuid.c
  KVM: LAPIC: Expose per-vCPU timer_advance_ns to userspace
  KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow
  kvm: vmx: Fix -Wmissing-prototypes warnings
  KVM: nVMX: Fix using __this_cpu_read() in preemptible context
  kvm: fix compilation on s390
  ...

5 years agoMerge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 May 2019 15:30:16 +0000 (08:30 -0700)]
Merge tag 'random_for_linus_stable' of git://git./linux/kernel/git/tytso/random

Pull /dev/random fix from Ted Ts'o:
 "Fix a soft lockup regression when reading from /dev/random in early
  boot"

* tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
  random: fix soft lockup when trying to read from an uninitialized blocking pool

5 years agorandom: fix soft lockup when trying to read from an uninitialized blocking pool
Theodore Ts'o [Wed, 22 May 2019 16:02:16 +0000 (12:02 -0400)]
random: fix soft lockup when trying to read from an uninitialized blocking pool

Fixes: eb9d1bf079bb: "random: only read from /dev/random after its pool has received 128 bits"
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotracing: Silence GCC 9 array bounds warning
Miguel Ojeda [Thu, 23 May 2019 12:45:35 +0000 (14:45 +0200)]
tracing: Silence GCC 9 array bounds warning

Starting with GCC 9, -Warray-bounds detects cases when memset is called
starting on a member of a struct but the size to be cleared ends up
writing over further members.

Such a call happens in the trace code to clear, at once, all members
after and including `seq` on struct trace_iterator:

    In function 'memset',
        inlined from 'ftrace_dump' at kernel/trace/trace.c:8914:3:
    ./include/linux/string.h:344:9: warning: '__builtin_memset' offset
    [8505, 8560] from the object at 'iter' is out of the bounds of
    referenced subobject 'seq' with type 'struct trace_seq' at offset
    4368 [-Warray-bounds]
      344 |  return __builtin_memset(p, c, size);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to avoid GCC complaining about it, we compute the address
ourselves by adding the offsetof distance instead of referring
directly to the member.

Since there are two places doing this clear (trace.c and trace_kdb.c),
take the chance to move the workaround into a single place in
the internal header.

Link: http://lkml.kernel.org/r/20190523124535.GA12931@gmail.com
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
[ Removed unnecessary parenthesis around "iter" ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
5 years agoMerge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 25 May 2019 22:03:12 +0000 (15:03 -0700)]
Merge tag 'ext4_for_linus_stable' of git://git./linux/kernel/git/tytso/ext4

Pull ext4 fixes from Ted Ts'o:
 "Bug fixes (including a regression fix) for ext4"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: fix dcache lookup of !casefolded directories
  ext4: do not delete unlinked inode from orphan list on failed truncate
  ext4: wait for outstanding dio during truncate in nojournal mode
  ext4: don't perform block validity checks on the journal inode

5 years agoMerge tag 'libnvdimm-fixes-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 25 May 2019 17:11:23 +0000 (10:11 -0700)]
Merge tag 'libnvdimm-fixes-5.2-rc2' of git://git./linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm fixes from Dan Williams:

 - Fix a regression that disabled device-mapper dax support

 - Remove unnecessary hardened-user-copy overhead (>30%) for dax
   read(2)/write(2).

 - Fix some compilation warnings.

* tag 'libnvdimm-fixes-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  libnvdimm/pmem: Bypass CONFIG_HARDENED_USERCOPY overhead
  dax: Arrange for dax_supported check to span multiple devices
  libnvdimm: Fix compilation warnings with W=1

5 years agoMerge tag 'trace-v5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Sat, 25 May 2019 17:08:14 +0000 (10:08 -0700)]
Merge tag 'trace-v5.2-rc1' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:
 "Tom Zanussi sent me some small fixes and cleanups to the histogram
  code and I forgot to incorporate them.

  I also added a small clean up patch that was sent to me a while ago
  and I just noticed it"

* tag 'trace-v5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  kernel/trace/trace.h: Remove duplicate header of trace_seq.h
  tracing: Add a check_val() check before updating cond_snapshot() track_val
  tracing: Check keys for variable references in expressions too
  tracing: Prevent hist_field_var_ref() from accessing NULL tracing_map_elts

5 years agoext4: fix dcache lookup of !casefolded directories
Gabriel Krisman Bertazi [Sat, 25 May 2019 03:48:23 +0000 (23:48 -0400)]
ext4: fix dcache lookup of !casefolded directories

Found by visual inspection, this wasn't caught by my xfstest, since it's
effect is ignoring positive dentries in the cache the fallback just goes
to the disk.  it was introduced in the last iteration of the
case-insensitive patch.

d_compare should return 0 when the entries match, so make sure we are
correctly comparing the entire string if the encoding feature is set and
we are on a case-INsensitive directory.

Fixes: b886ee3e778e ("ext4: Support case-insensitive file name lookups")
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 25 May 2019 00:30:28 +0000 (17:30 -0700)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This is the same set of patches sent in the merge window as the final
  pull except that Martin's read only rework is replaced with a simple
  revert of the original change that caused the regression.

  Everything else is an obvious fix or small cleanup"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  Revert "scsi: sd: Keep disk read-only when re-reading partition"
  scsi: bnx2fc: fix incorrect cast to u64 on shift operation
  scsi: smartpqi: Reporting unhandled SCSI errors
  scsi: myrs: Fix uninitialized variable
  scsi: lpfc: Update lpfc version to 12.2.0.2
  scsi: lpfc: add check for loss of ndlp when sending RRQ
  scsi: lpfc: correct rcu unlock issue in lpfc_nvme_info_show
  scsi: lpfc: resolve lockdep warnings
  scsi: qedi: remove set but not used variables 'cdev' and 'udev'
  scsi: qedi: remove memset/memcpy to nfunc and use func instead
  scsi: qla2xxx: Add cleanup for PCI EEH recovery

5 years agoMerge tag 'for-linus-20190524' of git://git.kernel.dk/linux-block
Linus Torvalds [Fri, 24 May 2019 23:02:14 +0000 (16:02 -0700)]
Merge tag 'for-linus-20190524' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

 - NVMe pull request from Keith, with fixes from a few folks.

 - bio and sbitmap before atomic barrier fixes (Andrea)

 - Hang fix for blk-mq freeze and unfreeze (Bob)

 - Single segment count regression fix (Christoph)

 - AoE now has a new maintainer

 - tools/io_uring/ Makefile fix, and sync with liburing (me)

* tag 'for-linus-20190524' of git://git.kernel.dk/linux-block: (23 commits)
  tools/io_uring: sync with liburing
  tools/io_uring: fix Makefile for pthread library link
  blk-mq: fix hang caused by freeze/unfreeze sequence
  block: remove the bi_seg_{front,back}_size fields in struct bio
  block: remove the segment size check in bio_will_gap
  block: force an unlimited segment size on queues with a virt boundary
  block: don't decrement nr_phys_segments for physically contigous segments
  sbitmap: fix improper use of smp_mb__before_atomic()
  bio: fix improper use of smp_mb__before_atomic()
  aoe: list new maintainer for aoe driver
  nvme-pci: use blk-mq mapping for unmanaged irqs
  nvme: update MAINTAINERS
  nvme: copy MTFA field from identify controller
  nvme: fix memory leak for power latency tolerance
  nvme: release namespace SRCU protection before performing controller ioctls
  nvme: merge nvme_ns_ioctl into nvme_ioctl
  nvme: remove the ifdef around nvme_nvm_ioctl
  nvme: fix srcu locking on error return in nvme_get_ns_from_disk
  nvme: Fix known effects
  nvme-pci: Sync queues on reset
  ...