ARM: mmp: add more compatible names in gpio driver
authorHaojian Zhuang <haojian.zhuang@linaro.org>
Tue, 9 Apr 2013 14:27:50 +0000 (22:27 +0800)
committerHaojian Zhuang <haojian.zhuang@linaro.org>
Thu, 11 Apr 2013 02:00:34 +0000 (10:00 +0800)
Since more driver names are added into platform id, do the same thing on
compatible names for DT mode.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
arch/arm/boot/dts/mmp2.dtsi
arch/arm/boot/dts/pxa168.dtsi
arch/arm/boot/dts/pxa910.dtsi
arch/arm/mach-mmp/mmp-dt.c
arch/arm/mach-mmp/mmp2-dt.c
drivers/gpio/gpio-pxa.c

index e13787498bcf443977ca534ebb2ccfe66fc87cb3..9b3f1d4a88d69fa931ca819c4776727435512104 100644 (file)
@@ -1,7 +1,10 @@
 * Marvell PXA GPIO controller
 
 Required properties:
-- compatible : Should be "mrvl,pxa-gpio" or "mrvl,mmp-gpio"
+- compatible : Should be "intel,pxa25x-gpio", "intel,pxa26x-gpio",
+               "intel,pxa27x-gpio", "intel,pxa3xx-gpio",
+               "marvell,pxa93x-gpio", "marvell,mmp-gpio" or
+               "marvell,mmp2-gpio".
 - reg : Address and length of the register set for the device
 - interrupts : Should be the port interrupt shared by all gpio pins.
   There're three gpio interrupts in arch-pxa, and they're gpio0,
@@ -18,7 +21,7 @@ Required properties:
 Example:
 
        gpio: gpio@d4019000 {
-               compatible = "mrvl,mmp-gpio";
+               compatible = "marvell,mmp-gpio";
                reg = <0xd4019000 0x1000>;
                interrupts = <49>;
                interrupt-name = "gpio_mux";
index 1429ac05b36d45cff8aff69e745e98444c547f88..4e8b08c628c7ee405efd864f743cbadc8a617321 100644 (file)
                        };
 
                        gpio@d4019000 {
-                               compatible = "mrvl,mmp-gpio";
+                               compatible = "marvell,mmp2-gpio";
                                #address-cells = <1>;
                                #size-cells = <1>;
                                reg = <0xd4019000 0x1000>;
index 31a71869608033b4d1c461ce925a020f73c98714..975dad21ac3890d4b81bb23a0d1bf2962a831e09 100644 (file)
@@ -77,7 +77,7 @@
                        };
 
                        gpio@d4019000 {
-                               compatible = "mrvl,mmp-gpio";
+                               compatible = "marvell,mmp-gpio";
                                #address-cells = <1>;
                                #size-cells = <1>;
                                reg = <0xd4019000 0x1000>;
index 825aaca33034d9f23e63ade23bd611a38c3a6f9d..0247c622f580728f77f31dbb36d555d310f524d0 100644 (file)
@@ -89,7 +89,7 @@
                        };
 
                        gpio@d4019000 {
-                               compatible = "mrvl,mmp-gpio";
+                               compatible = "marvell,mmp-gpio";
                                #address-cells = <1>;
                                #size-cells = <1>;
                                reg = <0xd4019000 0x1000>;
index 5b890b686952be3e66d0dfee3990be4328e6669a..b37915dc44709852f39d716f11df69c66054abe3 100644 (file)
@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
-       OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
+       OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
        {}
 };
@@ -39,7 +39,7 @@ static const struct of_dev_auxdata pxa910_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL),
-       OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
+       OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
        {}
 };
index 924b6e838e507b907a65ae863b519b993802060f..4ac256720f7db089531bdbb0452b11b9f7d47d3d 100644 (file)
@@ -31,7 +31,7 @@ static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
-       OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "mmp2-gpio", NULL),
+       OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp2-gpio", NULL),
        OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
        {}
 };
index a0905b20f48e896e4cc99eb0689e83f0bc1dd6e2..b80717e1ce5b0d8fe74eb497b00e9e4ec19bdd48 100644 (file)
@@ -499,8 +499,13 @@ static int pxa_gpio_nums(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static struct of_device_id pxa_gpio_dt_ids[] = {
-       { .compatible = "mrvl,pxa-gpio" },
-       { .compatible = "mrvl,mmp-gpio", .data = (void *)MMP_GPIO },
+       { .compatible = "intel,pxa25x-gpio",    .data = &pxa25x_id, },
+       { .compatible = "intel,pxa26x-gpio",    .data = &pxa26x_id, },
+       { .compatible = "intel,pxa27x-gpio",    .data = &pxa27x_id, },
+       { .compatible = "intel,pxa3xx-gpio",    .data = &pxa3xx_id, },
+       { .compatible = "marvell,pxa93x-gpio",  .data = &pxa93x_id, },
+       { .compatible = "marvell,mmp-gpio",     .data = &mmp_id, },
+       { .compatible = "marvell,mmp2-gpio",    .data = &mmp2_id, },
        {}
 };
 
@@ -520,16 +525,18 @@ const struct irq_domain_ops pxa_irq_domain_ops = {
 
 static int pxa_gpio_probe_dt(struct platform_device *pdev)
 {
-       int ret, nr_banks, nr_gpios;
+       int ret, nr_gpios;
        struct device_node *prev, *next, *np = pdev->dev.of_node;
        const struct of_device_id *of_id =
                                of_match_device(pxa_gpio_dt_ids, &pdev->dev);
+       const struct pxa_gpio_id *gpio_id;
 
-       if (!of_id) {
+       if (!of_id || !of_id->data) {
                dev_err(&pdev->dev, "Failed to find gpio controller\n");
                return -EFAULT;
        }
-       gpio_type = (int)of_id->data;
+       gpio_id = of_id->data;
+       gpio_type = gpio_id->type;
 
        next = of_get_next_child(np, NULL);
        prev = next;
@@ -538,14 +545,8 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev)
                ret = -EINVAL;
                goto err;
        }
-       for (nr_banks = 1; ; nr_banks++) {
-               next = of_get_next_child(np, prev);
-               if (!next)
-                       break;
-               prev = next;
-       }
        of_node_put(prev);
-       nr_gpios = nr_banks << 5;
+       nr_gpios = gpio_id->gpio_nums;
        pxa_last_gpio = nr_gpios - 1;
 
        irq_base = irq_alloc_descs(-1, 0, nr_gpios, 0);