aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-vf610.c
AgeCommit message (Collapse)AuthorFilesLines
2019-08-23gpio: vf610: Pass irqchip when adding gpiochipLinus Walleij1-12/+14
We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For more info see drivers/gpio/TODO. For chained irqchips this is a pretty straight-forward conversion. Cc: Andrey Smirnov <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Dong Aisheng <[email protected]> Cc: Stefan Agner <[email protected]> Cc: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2019-05-28gpio: vf610: Use PTR_ERR_OR_ZERO() in vf610_gpio_probe()Andrey Smirnov1-6/+8
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 <[email protected]> Cc: Chris Healy <[email protected]> Cc: [email protected] Cc: [email protected] Reviewed-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2019-04-08Merge tag 'gpio-v5.2-updates-for-linus-part1' of ↵Linus Walleij1-49/+36
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
2019-04-05drivers: gpio: vf610: use devm_platform_ioremap_resource()Enrico Weigelt, metux IT consult1-5/+2
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2019-03-18gpio: vf610: Don't use explicit &pdev->dev in vf610_gpio_probe()Andrey Smirnov1-3/+3
The code already defines "dev" variable to help with that, so make sure all of the code uses it. Signed-off-by: Andrey Smirnov <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Chris Healy <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
2019-03-18gpio: vf610: Use devres to remove gpiochipAndrey Smirnov1-14/+1
Now that the driver's custom remove hook contains only a single action, replace it by converting the code to use devm_gpiochip_add_data() to simplify things. Signed-off-by: Andrey Smirnov <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Chris Healy <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
2019-03-18gpio: vf610: Use devres to disable clk_gpioAndrey Smirnov1-2/+4
Clk_gpio should be disabled in all error paths in the code that follws, including the case when either gpiochip_add_data() or gpiochip_irqchip_add() fail. To simplify things fix this by using devm_add_action() to disable corresponding clock in case of any erros as well as driver/device removal. Signed-off-by: Andrey Smirnov <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Chris Healy <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
2019-03-18gpio: vf610: Use devres to disable clk_portAndrey Smirnov1-6/+10
Clk_port should be disabled in all error paths in the code that follws, including the case when either gpiochip_add_data() or gpiochip_irqchip_add() fail. To simplify things fix this by using devm_add_action_or_reset() to disable corresponding clock in case of any erros as well as driver/device removal. Signed-off-by: Andrey Smirnov <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Chris Healy <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
2019-03-18gpio: vf610: Simplify vf610_gpio_get()Andrey Smirnov1-7/+5
Both branches of the if statement do exactly the same thing, just at different offsets. Simplify the code a bit by moving shared action code outside of the if statement. No functional change intended. Signed-off-by: Andrey Smirnov <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Chris Healy <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
2019-03-18gpio: vf610: Simplify vf610_gpio_set()Andrey Smirnov1-4/+2
The only difference between two codepaths is register offset used. Simplify the code a bit by replacing explicit calls with a single call with a variable offset. No functional change intended. Signed-off-by: Andrey Smirnov <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Chris Healy <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
2019-03-18gpio: vf610: Do not share irq_chipAndrey Smirnov1-14/+12
Fix the warning produced by gpiochip_set_irq_hooks() by allocating a dedicated IRQ chip per GPIO chip/port. Signed-off-by: Andrey Smirnov <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Chris Healy <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
2019-01-28gpio: vf610: Mask all GPIO interruptsAndrew Lunn1-0/+5
On SoC reset all GPIO interrupts are disable. However, if kexec is used to boot into a new kernel, the SoC does not experience a reset. Hence GPIO interrupts can be left enabled from the previous kernel. It is then possible for the interrupt to fire before an interrupt handler is registered, resulting in the kernel complaining of an "unexpected IRQ trap", the interrupt is never cleared, and so fires again, resulting in an interrupt storm. Disable all GPIO interrupts before registering the GPIO IRQ chip. Fixes: 7f2691a19627 ("gpio: vf610: add gpiolib/IRQ chip driver for Vybrid") Signed-off-by: Andrew Lunn <[email protected]> Acked-by: Stefan Agner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-11-16gpio: vf610: add optional clock supportA.s. Dong1-0/+44
Some SoCs need the gpio clock to be enabled before accessing HW registers. This patch add the optional clock handling. Cc: Linus Walleij <[email protected]> Cc: Stefan Agner <[email protected]> Cc: Shawn Guo <[email protected]> Cc: [email protected] Signed-off-by: Dong Aisheng <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-12gpio: vf610: Cut down on boilerplateLinus Walleij1-10/+1
Just use the SPDX identifier for the license. Acked-by: Stefan Agner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-12gpio: vf610: Include the right headerLinus Walleij1-1/+1
This is a GPIO driver so only include <linux/gpio/driver.h>. Acked-by: Stefan Agner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: vf610: Use of_device_get_match_data()Thierry Reding1-3/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-11-08gpio: Move irqdomain into struct gpio_irq_chipThierry Reding1-1/+1
In order to consolidate the multiple ways to associate an IRQ chip with a GPIO chip, move more fields into the new struct gpio_irq_chip. Signed-off-by: Thierry Reding <[email protected]> Acked-by: Grygorii Strashko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-08-14gpio: vf610: add imx7ulp supportDong Aisheng1-3/+44
The Rapid General-Purpose Input and Output with 2 Ports (RGPIO2P) on MX7ULP is similar to GPIO on Vibrid. But unlike Vibrid, the RGPIO2P has an extra Port Data Direction Register (PDDR) used to configure the individual port pins for input or output. We introduce a bool have_paddr with fsl_gpio_soc_data data to distinguish this differences. And we support getting the output status by checking the GPIO direction in PDDR. Cc: Alexandre Courbot <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Stefan Agner <[email protected]> Cc: Fugang Duan <[email protected]> Cc: Peter Chen <[email protected]> Signed-off-by: Dong Aisheng <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-11-24gpio: vf610: use builtin_platform_driverGeliang Tang1-5/+1
Use builtin_platform_driver() helper to simplify the code. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-08-23gpio: vf610: drop unused MODULE_ tags from non-modular codePaul Gortmaker1-6/+1
The Kconfig currently controlling compilation of this code is: drivers/gpio/Kconfig:config GPIO_VF610 drivers/gpio/Kconfig: def_bool y ...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only. We delete the MODULE_LICENSE tag etc. since all that information is now contained at the top of the file in the comments. We don't replace module.h with init.h since the file already has that. Cc: Alexandre Courbot <[email protected]> Cc: Stefan Agner <[email protected]> Cc: [email protected] Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-01-05gpio: vf610: use gpiochip data pointerLinus Walleij1-14/+9
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Stefan Agner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-11-19gpio: change member .dev to .parentLinus Walleij1-1/+1
The name .dev in a struct is normally reserved for a struct device that is let us say a superclass to the thing described by the struct. struct gpio_chip stands out by confusingly using a struct device *dev to point to the parent device (such as a platform_device) that represents the hardware. As we want to give gpio_chip:s real devices, this is not working. We need to rename this member to parent. This was done by two coccinelle scripts, I guess it is possible to combine them into one, but I don't know such stuff. They look like this: @@ struct gpio_chip *var; @@ -var->dev +var->parent and: @@ struct gpio_chip var; @@ -var.dev +var.parent and: @@ struct bgpio_chip *var; @@ -var->gc.dev +var->gc.parent Plus a few instances of bgpio that I couldn't figure out how to teach Coccinelle to rewrite. This patch hits all over the place, but I *strongly* prefer this solution to any piecemal approaches that just exercise patch mechanics all over the place. It mainly hits drivers/gpio and drivers/pinctrl which is my own backyard anyway. Cc: Haavard Skinnemoen <[email protected]> Cc: Rafał Miłecki <[email protected]> Cc: Richard Purdie <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Alek Du <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Jiri Kosina <[email protected]> Acked-by: Hans-Christian Egtvedt <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-10-16gpio: replace trivial implementations of request/free with generic oneJonas Gorski1-12/+2
Replace all trivial request/free callbacks that do nothing but call into pinctrl code with the generic versions. Signed-off-by: Jonas Gorski <[email protected]> Reviewed-by: Thomas Petazzoni <[email protected]> Acked-by: James Hogan <[email protected]> Acked-by: Stefan Agner <[email protected]> Acked-by: Joachim Eastwood <[email protected]> Acked-by: Gregory CLEMENT <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-10-02gpio: vf610: use container_of() to get state containerLinus Walleij1-10/+19
The state container of the vf610 GPIO driver is sometimes extracted from the gpio_chip exploiting the fact that offsetof() the struct gpio_chip inside the struct vf610_gpio_port is 0, so the container_of() is in practice a noop. However if a member is added to struct vf610_gpio_port in front of struct gpio_chip, things will break. Using proper container_of() avoids this problem. Semantically this is a noop, the compiler will optimize it away, but syntactically it makes me happier. Also replace some explicit container_of() calls with the helper function. Acked-by: Stefan Agner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-09-16genirq: Remove irq argument from irq flow handlersThomas Gleixner1-1/+1
Most interrupt flow handlers do not use the irq argument. Those few which use it can retrieve the irq number from the irq descriptor. Remove the argument. Search and replace was done with coccinelle and some extra helper scripts around it. Thanks to Julia for her help! Signed-off-by: Thomas Gleixner <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Jiang Liu <[email protected]>
2015-09-16gpio: vf610: Use irq_set_handler_lockedThomas Gleixner1-2/+2
Use irq_set_handler_locked() as it avoids a redundant lookup of the irq descriptor. Search and replacement was done with coccinelle: Signed-off-by: Thomas Gleixner <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Linus Walleij <[email protected]> Cc: [email protected]
2015-08-26gpio: vf610: handle level IRQ's properlyStefan Agner1-1/+8
The GPIO IRQ controller is able to generate level triggered interrupts, however, these were handled by handle_simple_irq so far which did not take care of IRQ masking. This lead to "nobody cared (try booting with the "irqpoll" option)" stack traces. Use the generic interrupt handlers depending on the IRQ type. Signed-off-by: Stefan Agner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-07-14gpio: Use irq_desc_get_xxx() to avoid redundant lookup of irq_descJiang Liu1-1/+1
Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we already have a pointer to corresponding irq_desc. Preparatory patch for the removal of the 'irq' argument from irq flow handlers. Signed-off-by: Jiang Liu <[email protected]> Acked-by: Linus Walleij <[email protected]> Cc: Alexandre Courbot <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2015-03-06gpio: vf610: Replaces comma between expression statements by semicolonAxel Lin1-8/+8
Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-01-15gpio: drop owner assignment from platform_driversWolfram Sang1-1/+0
This platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2014-10-24gpio: vf610: add gpiolib/IRQ chip driver for VybridStefan Agner1-0/+295
Add a gpiolib and IRQ chip driver for Vybrid ARM SoC using the Vybrid's GPIO and PORT module. The driver is instanced once per each GPIO/PORT module pair and handles 32 GPIO's. Signed-off-by: Stefan Agner <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Linus Walleij <[email protected]>