Commit 1e234375 authored by Patrice Chotard's avatar Patrice Chotard Committed by Linus Walleij

pinctrl: st: Use second parameter to gpio specifier

This patch allows to use the second parameter of gpio
specifier, which is used to specify whether the gpio is
active high or low.

Simply remove specific of_xlate callback() and of_gpio_n_cells
and use default one set by of_gpiochip_add() which allows
to use second parameter gpio specifier.
Signed-off-by: default avatarMaxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: default avatarPatrice Chotard <patrice.chotard@st.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 0f9d85b7
...@@ -50,7 +50,11 @@ Optional properties: ...@@ -50,7 +50,11 @@ Optional properties:
GPIO controller/bank node. GPIO controller/bank node.
Required properties: Required properties:
- gpio-controller : Indicates this device is a GPIO controller - gpio-controller : Indicates this device is a GPIO controller
- #gpio-cells : Should be one. The first cell is the pin number. - #gpio-cells : Must be two.
- First cell: specifies the pin number inside the controller
- Second cell: specifies whether the pin is logically inverted.
- 0 = active high
- 1 = active low
- st,bank-name : Should be a name string for this bank as specified in - st,bank-name : Should be a name string for this bank as specified in
datasheet. datasheet.
...@@ -88,7 +92,7 @@ Example: ...@@ -88,7 +92,7 @@ Example:
PIO0: gpio@fe610000 { PIO0: gpio@fe610000 {
gpio-controller; gpio-controller;
#gpio-cells = <1>; #gpio-cells = <2>;
interrupt-controller; interrupt-controller;
#interrupt-cells = <2>; #interrupt-cells = <2>;
reg = <0 0x100>; reg = <0 0x100>;
......
...@@ -799,21 +799,6 @@ static int st_gpio_get_direction(struct gpio_chip *chip, unsigned offset) ...@@ -799,21 +799,6 @@ static int st_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
return (direction == ST_GPIO_DIRECTION_IN); return (direction == ST_GPIO_DIRECTION_IN);
} }
static int st_gpio_xlate(struct gpio_chip *gc,
const struct of_phandle_args *gpiospec, u32 *flags)
{
if (WARN_ON(gc->of_gpio_n_cells < 1))
return -EINVAL;
if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells))
return -EINVAL;
if (gpiospec->args[0] > gc->ngpio)
return -EINVAL;
return gpiospec->args[0];
}
/* Pinctrl Groups */ /* Pinctrl Groups */
static int st_pctl_get_groups_count(struct pinctrl_dev *pctldev) static int st_pctl_get_groups_count(struct pinctrl_dev *pctldev)
{ {
...@@ -1486,8 +1471,6 @@ static struct gpio_chip st_gpio_template = { ...@@ -1486,8 +1471,6 @@ static struct gpio_chip st_gpio_template = {
.direction_output = st_gpio_direction_output, .direction_output = st_gpio_direction_output,
.get_direction = st_gpio_get_direction, .get_direction = st_gpio_get_direction,
.ngpio = ST_GPIO_PINS_PER_BANK, .ngpio = ST_GPIO_PINS_PER_BANK,
.of_gpio_n_cells = 1,
.of_xlate = st_gpio_xlate,
}; };
static struct irq_chip st_gpio_irqchip = { static struct irq_chip st_gpio_irqchip = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment