[PATCH 21/22] gpio: xilinx: Add reset support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Swapna Manupati <swapna.manupati@xxxxxxxxxx>
Date: Wed, 7 Mar 2018 17:03:19 +0530

This patch updates xlate api and gpio cells value to
provide reset support for other IP's using axi gpio.

Signed-off-by: Swapna Manupati <swapnam@xxxxxxxxxx>
Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx>
Signed-off-by: Alexander Hedges <ahedges@xxxxxxx>
(cherry picked from commit dbf204e7a104cd1bb5eeaec945811c986bed4840)
---
 drivers/gpio/gpio-xilinx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index 9256ad296082..674f94d13251 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -265,6 +265,8 @@ static int xgpio_xlate(struct gpio_chip *gc,
 	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
 	struct xgpio_instance *chip = container_of(mm_gc, struct xgpio_instance,
 						   mmchip);
+	if (gc->of_gpio_n_cells == 3 && flags)
+		*flags = gpiospec->args[2];
 
 	if (gpiospec->args[1] == chip->offset)
 		return gpiospec->args[0];
@@ -584,6 +586,7 @@ static int xgpio_of_probe(struct platform_device *pdev)
 	int status = 0;
 	const u32 *tree_info;
 	u32 ngpio;
+	u32 cells = 2;
 
 	chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
@@ -600,6 +603,9 @@ static int xgpio_of_probe(struct platform_device *pdev)
 	/* Update GPIO direction shadow register with default value */
 	of_property_read_u32(np, "xlnx,tri-default", &chip->gpio_dir);
 
+	/* Update cells with gpio-cells value */
+	of_property_read_u32(np, "#gpio-cells", &cells);
+
 	/*
 	 * Check device node and parent device node for device width
 	 * and assume default width of 32
@@ -613,7 +619,7 @@ static int xgpio_of_probe(struct platform_device *pdev)
 	chip->mmchip.gc.parent = &pdev->dev;
 	chip->mmchip.gc.owner = THIS_MODULE;
 	chip->mmchip.gc.of_xlate = xgpio_xlate;
-	chip->mmchip.gc.of_gpio_n_cells = 2;
+	chip->mmchip.gc.of_gpio_n_cells = cells;
 	chip->mmchip.gc.direction_input = xgpio_dir_in;
 	chip->mmchip.gc.direction_output = xgpio_dir_out;
 	chip->mmchip.gc.get = xgpio_get;
@@ -702,7 +708,7 @@ static int xgpio_of_probe(struct platform_device *pdev)
 		chip->mmchip.gc.parent = &pdev->dev;
 		chip->mmchip.gc.owner = THIS_MODULE;
 		chip->mmchip.gc.of_xlate = xgpio_xlate;
-		chip->mmchip.gc.of_gpio_n_cells = 2;
+		chip->mmchip.gc.of_gpio_n_cells = cells;
 		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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux