aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-rcar.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 20:23:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 20:23:44 -0500
commit6aa2f9441f1ef21f10c41f45e6453b135e9cd736 (patch)
tree334e67c4693eddff47a098b9afad63ca2ccfcd55 /drivers/gpio/gpio-rcar.c
parente37e0ee0190034a059c9faea8adfb4982fb24ddd (diff)
parent24f0966c3e3f52a96e888504d60810d9df5b2d42 (diff)
Merge tag 'gpio-v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.15 kernel cycle: Core: - Fix the semantics of raw GPIO to actually be raw. No inversion semantics as before, but also no open draining, and allow the raw operations to affect lines used for interrupts as the caller supposedly knows what they are doing if they are getting the big hammer. - Rewrote the __inner_function() notation calls to names that make more sense. I just find this kind of code disturbing. - Drop the .irq_base() field from the gpiochip since now all IRQs are mapped dynamically. This is nice. - Support for .get_multiple() in the core driver API. This allows us to read several GPIO lines with a single register read. This has high value for some usecases: it can be used to create oscilloscopes and signal analyzers and other things that rely on reading several lines at exactly the same instant. Also a generally nice optimization. This uses the new assign_bit() macro from the bitops lib that was ACKed by Andrew Morton and is implemented for two drivers, one of them being the generic MMIO driver so everyone using that will be able to benefit from this. - Do not allow requests of Open Drain and Open Source setting of a GPIO line simultaneously. If the hardware actually supports enabling both at the same time the electrical result would be disastrous. - A new interrupt chip core helper. This will be helpful to deal with "banked" GPIOs, which means GPIO controllers with several logical blocks of GPIO inside them. This is several gpiochips per device in the device model, in contrast to the case when there is a 1-to-1 relationship between a device and a gpiochip. New drivers: - Maxim MAX3191x industrial serializer, a very interesting piece of professional I/O hardware. - Uniphier GPIO driver. This is the GPIO block from the recent Socionext (ex Fujitsu and Panasonic) platform. - Tegra 186 driver. This is based on the new banked GPIO infrastructure. Other improvements: - Some documentation improvements. - Wakeup support for the DesignWare DWAPB GPIO controller. - Reset line support on the DesignWare DWAPB GPIO controller. - Several non-critical bug fixes and improvements for the Broadcom BRCMSTB driver. - Misc non-critical bug fixes like exotic errorpaths, removal of dead code etc. - Explicit comments on fall-through switch() statements" * tag 'gpio-v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (65 commits) gpio: tegra186: Remove tegra186_gpio_lock_class gpio: rcar: Add r8a77995 (R-Car D3) support pinctrl: bcm2835: Fix some merge fallout gpio: Fix undefined lock_dep_class gpio: Automatically add lockdep keys gpio: Introduce struct gpio_irq_chip.first gpio: Disambiguate struct gpio_irq_chip.nested gpio: Add Tegra186 support gpio: Export gpiochip_irq_{map,unmap}() gpio: Implement tighter IRQ chip integration gpio: Move lock_key into struct gpio_irq_chip gpio: Move irq_valid_mask into struct gpio_irq_chip gpio: Move irq_nested into struct gpio_irq_chip gpio: Move irq_chained_parent to struct gpio_irq_chip gpio: Move irq_default_type to struct gpio_irq_chip gpio: Move irq_handler to struct gpio_irq_chip gpio: Move irqdomain into struct gpio_irq_chip gpio: Move irqchip into struct gpio_irq_chip gpio: Introduce struct gpio_irq_chip pinctrl: armada-37xx: remove unused variable ...
Diffstat (limited to 'drivers/gpio/gpio-rcar.c')
-rw-r--r--drivers/gpio/gpio-rcar.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 1f0871553fd2..0ea998a3e357 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -24,6 +24,7 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/of.h> 26#include <linux/of.h>
27#include <linux/of_device.h>
27#include <linux/pinctrl/consumer.h> 28#include <linux/pinctrl/consumer.h>
28#include <linux/platform_device.h> 29#include <linux/platform_device.h>
29#include <linux/pm_runtime.h> 30#include <linux/pm_runtime.h>
@@ -206,7 +207,7 @@ static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
206 gpio_rcar_read(p, INTMSK))) { 207 gpio_rcar_read(p, INTMSK))) {
207 offset = __ffs(pending); 208 offset = __ffs(pending);
208 gpio_rcar_write(p, INTCLR, BIT(offset)); 209 gpio_rcar_write(p, INTCLR, BIT(offset));
209 generic_handle_irq(irq_find_mapping(p->gpio_chip.irqdomain, 210 generic_handle_irq(irq_find_mapping(p->gpio_chip.irq.domain,
210 offset)); 211 offset));
211 irqs_handled++; 212 irqs_handled++;
212 } 213 }
@@ -393,16 +394,11 @@ MODULE_DEVICE_TABLE(of, gpio_rcar_of_table);
393static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins) 394static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
394{ 395{
395 struct device_node *np = p->pdev->dev.of_node; 396 struct device_node *np = p->pdev->dev.of_node;
396 const struct of_device_id *match;
397 const struct gpio_rcar_info *info; 397 const struct gpio_rcar_info *info;
398 struct of_phandle_args args; 398 struct of_phandle_args args;
399 int ret; 399 int ret;
400 400
401 match = of_match_node(gpio_rcar_of_table, np); 401 info = of_device_get_match_data(&p->pdev->dev);
402 if (!match)
403 return -EINVAL;
404
405 info = match->data;
406 402
407 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args); 403 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
408 *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; 404 *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
@@ -456,19 +452,17 @@ static int gpio_rcar_probe(struct platform_device *pdev)
456 452
457 pm_runtime_enable(dev); 453 pm_runtime_enable(dev);
458 454
459 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
460 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 455 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
461 456 if (!irq) {
462 if (!io || !irq) { 457 dev_err(dev, "missing IRQ\n");
463 dev_err(dev, "missing IRQ or IOMEM\n");
464 ret = -EINVAL; 458 ret = -EINVAL;
465 goto err0; 459 goto err0;
466 } 460 }
467 461
468 p->base = devm_ioremap_nocache(dev, io->start, resource_size(io)); 462 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
469 if (!p->base) { 463 p->base = devm_ioremap_resource(dev, io);
470 dev_err(dev, "failed to remap I/O memory\n"); 464 if (IS_ERR(p->base)) {
471 ret = -ENXIO; 465 ret = PTR_ERR(p->base);
472 goto err0; 466 goto err0;
473 } 467 }
474 468