From: Iban Rodriguez <irodriguez@xxxxxxxxxxx> Date: Mon, 13 Jun 2016 12:53:39 +0200 General kernel function of_gpio_simple_xlate is not valid for dual gpio devices as it always returns the gpio in the first channel. Use own xlate function always and not only when gpio irq is present. Signed-off-by: Iban Rodriguez <irodriguez@xxxxxxxxxxx> Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx> Signed-off-by: Alexander Hedges <ahedges@xxxxxxx> (cherry picked from commit 1c9c40cbcbd896a6ee35e46560b5c3e99718c620) --- drivers/gpio/gpio-xilinx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index fd14ea4ea19e..98293743012d 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -246,7 +246,7 @@ static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc) } /** - * xgpio_xlate - Set initial values of GPIO pins + * xgpio_xlate - Translate gpio_spec to the GPIO number and flags * @gc: Pointer to gpio_chip device structure. * @gpiospec: gpio specifier as found in the device tree * @flags: A flags pointer based on binding @@ -433,8 +433,6 @@ static int xgpio_irq_setup(struct device_node *np, struct xgpio_instance *chip) return 0; } - chip->mmchip.gc.of_xlate = xgpio_xlate; - chip->mmchip.gc.of_gpio_n_cells = 2; chip->mmchip.gc.to_irq = xgpio_to_irq; chip->irq_base = irq_alloc_descs(-1, 0, chip->mmchip.gc.ngpio, 0); @@ -520,11 +518,13 @@ static int xgpio_of_probe(struct platform_device *pdev) */ if (of_property_read_u32(np, "xlnx,gpio-width", &ngpio)) ngpio = 32; + chip->mmchip.gc.ngpio = (u16)ngpio;; spin_lock_init(&chip->gpio_lock); - chip->mmchip.gc.ngpio = (u16)ngpio;; chip->mmchip.gc.parent = &pdev->dev; + chip->mmchip.gc.of_xlate = xgpio_xlate; + chip->mmchip.gc.of_gpio_n_cells = 2; chip->mmchip.gc.direction_input = xgpio_dir_in; chip->mmchip.gc.direction_output = xgpio_dir_out; chip->mmchip.gc.get = xgpio_get; @@ -585,6 +585,8 @@ static int xgpio_of_probe(struct platform_device *pdev) spin_lock_init(&chip->gpio_lock); + chip->mmchip.gc.of_xlate = xgpio_xlate; + chip->mmchip.gc.of_gpio_n_cells = 2; chip->mmchip.gc.direction_input = xgpio_dir_in; chip->mmchip.gc.direction_output = xgpio_dir_out; chip->mmchip.gc.get = xgpio_get; -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html