]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gpio: add gpio offset in gpio range cells property
authorHaojian Zhuang <haojian.zhuang@linaro.org>
Sun, 17 Feb 2013 11:42:47 +0000 (19:42 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 7 Mar 2013 04:27:29 +0000 (05:27 +0100)
Add gpio offset into "gpio-range-cells" property. It's used to support
sparse pinctrl range in gpio chip.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Documentation/devicetree/bindings/gpio/gpio.txt
arch/arm/boot/dts/spear1310.dtsi
arch/arm/boot/dts/spear1340.dtsi
arch/arm/boot/dts/spear310.dtsi
arch/arm/boot/dts/spear320.dtsi
drivers/gpio/gpiolib-of.c

index a33628759d36e10a0c4b2c181458311134561eaa..d933af37069791f8a0e15a6f31f5edf3358d6377 100644 (file)
@@ -98,7 +98,7 @@ announce the pinrange to the pin ctrl subsystem. For example,
                compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
                reg = <0x1460 0x18>;
                gpio-controller;
-               gpio-ranges = <&pinctrl1 20 10>, <&pinctrl2 50 20>;
+               gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
 
     }
 
@@ -107,8 +107,8 @@ where,
 
    Next values specify the base pin and number of pins for the range
    handled by 'qe_pio_e' gpio. In the given example from base pin 20 to
-   pin 29 under pinctrl1 and pin 50 to pin 69 under pinctrl2 is handled
-   by this gpio controller.
+   pin 29 under pinctrl1 with gpio offset 0 and pin 50 to pin 69 under
+   pinctrl2 with gpio offset 10 is handled by this gpio controller.
 
 The pinctrl node must have "#gpio-range-cells" property to show number of
 arguments to pass with phandle from gpio controllers node.
index 1513c1927cc8f2b2e3d7e64e3eabfd0c4ec1ff96..122ae94076c8a7785e2bf1e92c97dfee77bbc674 100644 (file)
@@ -89,7 +89,7 @@
                pinmux: pinmux@e0700000 {
                        compatible = "st,spear1310-pinmux";
                        reg = <0xe0700000 0x1000>;
-                       #gpio-range-cells = <2>;
+                       #gpio-range-cells = <3>;
                };
 
                apb {
                                interrupt-controller;
                                gpio-controller;
                                #gpio-cells = <2>;
-                               gpio-ranges = <&pinmux 0 246>;
+                               gpio-ranges = <&pinmux 0 246>;
                                status = "disabled";
 
                                st-plgpio,ngpio = <246>;
index 34da11aa679504616359ec759568d31160eb829a..c511c4772efdd8f85b17dac9fac18030f0782845 100644 (file)
@@ -63,7 +63,7 @@
                pinmux: pinmux@e0700000 {
                        compatible = "st,spear1340-pinmux";
                        reg = <0xe0700000 0x1000>;
-                       #gpio-range-cells = <2>;
+                       #gpio-range-cells = <3>;
                };
 
                pwm: pwm@e0180000 {
                                interrupt-controller;
                                gpio-controller;
                                #gpio-cells = <2>;
-                               gpio-ranges = <&pinmux 0 252>;
+                               gpio-ranges = <&pinmux 0 252>;
                                status = "disabled";
 
                                st-plgpio,ngpio = <250>;
index ab45b8c81982d17937052943370517bdfb6cb261..95372080eea60b38f3397cebf52bfb5364900e1c 100644 (file)
@@ -25,7 +25,7 @@
                pinmux: pinmux@b4000000 {
                        compatible = "st,spear310-pinmux";
                        reg = <0xb4000000 0x1000>;
-                       #gpio-range-cells = <2>;
+                       #gpio-range-cells = <3>;
                };
 
                fsmc: flash@44000000 {
                                interrupt-controller;
                                gpio-controller;
                                #gpio-cells = <2>;
-                               gpio-ranges = <&pinmux 0 102>;
+                               gpio-ranges = <&pinmux 0 102>;
                                status = "disabled";
 
                                st-plgpio,ngpio = <102>;
index caa5520b1fd4e4e243f194c821d4b196833a1bee..ffea342aeec99575612c38224f05aeaa70594640 100644 (file)
@@ -24,7 +24,7 @@
                pinmux: pinmux@b3000000 {
                        compatible = "st,spear320-pinmux";
                        reg = <0xb3000000 0x1000>;
-                       #gpio-range-cells = <2>;
+                       #gpio-range-cells = <3>;
                };
 
                clcd@90000000 {
                                interrupt-controller;
                                gpio-controller;
                                #gpio-cells = <2>;
-                               gpio-ranges = <&pinmux 0 102>;
+                               gpio-ranges = <&pinmux 0 102>;
                                status = "disabled";
 
                                st-plgpio,ngpio = <102>;
index a71a54a3e3f783a4151ed5919c01290ade8ffd5d..892040ad0095f071338730e1b53a195d588b213a 100644 (file)
@@ -203,22 +203,11 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
                if (!pctldev)
                        break;
 
-               /*
-                * This assumes that the n GPIO pins are consecutive in the
-                * GPIO number space, and that the pins are also consecutive
-                * in their local number space. Currently it is not possible
-                * to add different ranges for one and the same GPIO chip,
-                * as the code assumes that we have one consecutive range
-                * on both, mapping 1-to-1.
-                *
-                * TODO: make the OF bindings handle multiple sparse ranges
-                * on the same GPIO chip.
-                */
                ret = gpiochip_add_pin_range(chip,
                                             pinctrl_dev_get_devname(pctldev),
-                                            0, /* offset in gpiochip */
                                             pinspec.args[0],
-                                            pinspec.args[1]);
+                                            pinspec.args[1],
+                                            pinspec.args[2]);
 
                if (ret)
                        break;