History

gpio: rcar: Remove obsolete platform data support

Since commit 4baadb9e05c68962 ("ARM: shmobile: r8a7778: remove obsolete setup code"), Renesas R-Car SoCs are only supported in generic DT-only ARM multi-platform builds. The driver doesn't need to use platform data anymore, hence remove platform data configuration. Make gpio_rcar_priv.has_both_edge_trigger a boolean for consistency with gpio_rcar_info.has_both_edge_trigger. Move gpio_rcar_priv.irq_parent down while we're at it, to prevent gaps on 64-bit.

Geert Uytterhoeven committed 10 years ago

Commit 8b092be1 parent 0d1bb2b2 files · +26 −80Browse files

Unified · Split

2 files
  1. drivers/gpio/gpio-rcar.c +26 −51
  2. include/linux/platform_data/gpio-rcar.h +0 −29
drivers/gpio/gpio-rcar.c+26−51
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525 #include <linux/module.h>
2626 #include <linux/of.h>
2727 #include <linux/pinctrl/consumer.h>
28−#include <linux/platform_data/gpio-rcar.h>
2928 #include <linux/platform_device.h>
3029 #include <linux/pm_runtime.h>
3130 #include <linux/spinlock.h>
@@ -34,12 +33,12 @@ · 2 unmodified lines
3433 struct gpio_rcar_priv {
3534 void __iomem *base;
3635 spinlock_t lock;
37− struct gpio_rcar_config config;
3836 struct platform_device *pdev;
3937 struct gpio_chip gpio_chip;
4038 struct irq_chip irq_chip;
41− unsigned int irq_parent;
4239 struct clk *clk;
40+ unsigned int irq_parent;
41+ bool has_both_edge_trigger;
4342 };
4443
4544 #define IOINTSEL 0x00 /* General IO/Interrupt Switching Register */
@@ -121,7 +120,7 @@ static void gpio_rcar_config_interrupt_input_mode(struct gpio_rcar_priv *p, · 75 unmodified lines
121120 gpio_rcar_modify_bit(p, EDGLEVEL, hwirq, !level_trigger);
122121
123122 /* Select one edge or both edges in BOTHEDGE */
124− if (p->config.has_both_edge_trigger)
123+ if (p->has_both_edge_trigger)
125124 gpio_rcar_modify_bit(p, BOTHEDGE, hwirq, both);
126125
127126 /* Select "Interrupt Input Mode" in IOINTSEL */
@@ -161,7 +160,7 @@ static int gpio_rcar_irq_set_type(struct irq_data *d, unsigned int type) · 33 unmodified lines
161160 false);
162161 break;
163162 case IRQ_TYPE_EDGE_BOTH:
164− if (!p->config.has_both_edge_trigger)
163+ if (!p->has_both_edge_trigger)
165164 return -EINVAL;
166165 gpio_rcar_config_interrupt_input_mode(p, hwirq, true, false,
167166 true);
@@ -355,39 +354,29 @@ static const struct of_device_id gpio_rcar_of_table[] = { · 187 unmodified lines
355354
356355 MODULE_DEVICE_TABLE(of, gpio_rcar_of_table);
357356
358−static int gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
357+static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
359358 {
360− struct gpio_rcar_config *pdata = dev_get_platdata(&p->pdev->dev);
361359 struct device_node *np = p->pdev->dev.of_node;
360+ const struct of_device_id *match;
361+ const struct gpio_rcar_info *info;
362362 struct of_phandle_args args;
363363 int ret;
364364
365− if (pdata) {
366− p->config = *pdata;
367− } else if (IS_ENABLED(CONFIG_OF) && np) {
368− const struct of_device_id *match;
369− const struct gpio_rcar_info *info;
365+ match = of_match_node(gpio_rcar_of_table, np);
366+ if (!match)
367+ return -EINVAL;
370368
371− match = of_match_node(gpio_rcar_of_table, np);
372− if (!match)
373− return -EINVAL;
369+ info = match->data;
374370
375− info = match->data;
371+ ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
372+ *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
373+ p->has_both_edge_trigger = info->has_both_edge_trigger;
376374
377− ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0,
378− &args);
379− p->config.number_of_pins = ret == 0 ? args.args[2]
380− : RCAR_MAX_GPIO_PER_BANK;
381− p->config.gpio_base = -1;
382− p->config.has_both_edge_trigger = info->has_both_edge_trigger;
383− }
384−
385− if (p->config.number_of_pins == 0 ||
386− p->config.number_of_pins > RCAR_MAX_GPIO_PER_BANK) {
375+ if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) {
387376 dev_warn(&p->pdev->dev,
388− "Invalid number of gpio lines %u, using %u\n",
389− p->config.number_of_pins, RCAR_MAX_GPIO_PER_BANK);
390− p->config.number_of_pins = RCAR_MAX_GPIO_PER_BANK;
377+ "Invalid number of gpio lines %u, using %u\n", *npins,
378+ RCAR_MAX_GPIO_PER_BANK);
379+ *npins = RCAR_MAX_GPIO_PER_BANK;
391380 }
392381
393382 return 0;
@@ -401,6 +390,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 7 unmodified lines
401390 struct irq_chip *irq_chip;
402391 struct device *dev = &pdev->dev;
403392 const char *name = dev_name(dev);
393+ unsigned int npins;
404394 int ret;
405395
406396 p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
@@ -410,8 +400,8 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 3 unmodified lines
410400 p->pdev = pdev;
411401 spin_lock_init(&p->lock);
412402
413− /* Get device configuration from DT node or platform data. */
414− ret = gpio_rcar_parse_pdata(p);
403+ /* Get device configuration from DT node */
404+ ret = gpio_rcar_parse_dt(p, &npins);
415405 if (ret < 0)
416406 return ret;
417407
@@ -451,8 +441,8 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 33 unmodified lines
451441 gpio_chip->label = name;
452442 gpio_chip->parent = dev;
453443 gpio_chip->owner = THIS_MODULE;
454− gpio_chip->base = p->config.gpio_base;
455− gpio_chip->ngpio = p->config.number_of_pins;
444+ gpio_chip->base = -1;
445+ gpio_chip->ngpio = npins;
456446
457447 irq_chip = &p->irq_chip;
458448 irq_chip->name = name;
@@ -468,8 +458,8 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 9 unmodified lines
468458 goto err0;
469459 }
470460
471− ret = gpiochip_irqchip_add(gpio_chip, irq_chip, p->config.irq_base,
472− handle_level_irq, IRQ_TYPE_NONE);
461+ ret = gpiochip_irqchip_add(gpio_chip, irq_chip, 0, handle_level_irq,
462+ IRQ_TYPE_NONE);
473463 if (ret) {
474464 dev_err(dev, "cannot add irqchip\n");
475465 goto err1;
@@ -483,22 +473,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 7 unmodified lines
483473 goto err1;
484474 }
485475
486− dev_info(dev, "driving %d GPIOs\n", p->config.number_of_pins);
487−
488− /* warn in case of mismatch if irq base is specified */
489− if (p->config.irq_base) {
490− ret = irq_find_mapping(gpio_chip->irqdomain, 0);
491− if (p->config.irq_base != ret)
492− dev_warn(dev, "irq base mismatch (%u/%u)\n",
493− p->config.irq_base, ret);
494− }
495−
496− if (p->config.pctl_name) {
497− ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0,
498− gpio_chip->base, gpio_chip->ngpio);
499− if (ret < 0)
500− dev_warn(dev, "failed to add pin range\n");
501− }
476+ dev_info(dev, "driving %d GPIOs\n", npins);
502477
503478 return 0;
504479
include/linux/platform_data/gpio-rcar.h+0−29
@@ -1,29 +0,0 @@
1−/*
2− * Renesas R-Car GPIO Support
3− *
4− * Copyright (C) 2013 Magnus Damm
5− *
6− * This program is free software; you can redistribute it and/or modify
7− * it under the terms of the GNU General Public License as published by
8− * the Free Software Foundation; either version 2 of the License
9− *
10− * This program is distributed in the hope that it will be useful,
11− * but WITHOUT ANY WARRANTY; without even the implied warranty of
12− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13− * GNU General Public License for more details.
14− */
15−
16−#ifndef __GPIO_RCAR_H__
17−#define __GPIO_RCAR_H__
18−
19−struct gpio_rcar_config {
20− int gpio_base;
21− unsigned int irq_base;
22− unsigned int number_of_pins;
23− const char *pctl_name;
24− unsigned has_both_edge_trigger:1;
25−};
26−
27−#define RCAR_GP_PIN(bank, pin) (((bank) * 32) + (pin))
28−
29−#endif /* __GPIO_RCAR_H__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t