[PATCH 1/4] gpio: rcar: Enhance gpio-ranges support

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

 



Enhance gpio-ranges to support more than one gpio-range.

Signed-off-by: Biju Das <biju.das@xxxxxxxxxxxxxx>
Reviewed-by: Fabrizio Castro <fabrizio.castro@xxxxxxxxxxxxxx>
---
cat /sys/kernel/debug/pinctrl/e6060000.pin-controller-sh-pfc/gpio-
GPIO ranges handled:
0: e6050000.gpio GPIOS [1001 - 1023] PINS [0 - 22]
0: e6051000.gpio GPIOS [978 - 1000] PINS [32 - 54]
0: e6052000.gpio GPIOS [946 - 977] PINS [64 - 95]
0: e6053000.gpio GPIOS [926 - 942] PINS [96 - 112]
17: e6053000.gpio GPIOS [943 - 945] PINS [123 - 125]
0: e6054000.gpio GPIOS [900 - 925] PINS [128 - 153]
0: e6055000.gpio GPIOS [868 - 899] PINS [160 - 191]
---
 drivers/gpio/gpio-rcar.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 350390c..a7bbe78 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -399,13 +399,22 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
 	struct device_node *np = p->pdev->dev.of_node;
 	const struct gpio_rcar_info *info;
 	struct of_phandle_args args;
-	int ret;
+	int index = 0, ret;
 
 	info = of_device_get_match_data(&p->pdev->dev);
 
-	ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
-	*npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
 	p->has_both_edge_trigger = info->has_both_edge_trigger;
+	*npins = 0;
+	for (;; index++) {
+		ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
+							index, &args);
+		if (ret) {
+			if (index == 0)
+				*npins = RCAR_MAX_GPIO_PER_BANK;
+			break;
+		}
+		*npins += args.args[2];
+	}
 
 	if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) {
 		dev_warn(&p->pdev->dev,
-- 
2.7.4

--
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