]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/gpio/gpio-samsung.c
Merge branch 'next/dt-samsung' into next/dt-samsung-new
[linux-beck.git] / drivers / gpio / gpio-samsung.c
index 92f7b2bb79d40ccf277d19a4d234a53fd8c98d83..41ab7f66cdf9aad6bad1b23f8f01e6f352d1a6ca 100644 (file)
@@ -2452,12 +2452,6 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = {
                        .ngpio  = EXYNOS5_GPIO_C3_NR,
                        .label  = "GPC3",
                },
-       }, {
-               .chip   = {
-                       .base   = EXYNOS5_GPC4(0),
-                       .ngpio  = EXYNOS5_GPIO_C4_NR,
-                       .label  = "GPC4",
-               },
        }, {
                .chip   = {
                        .base   = EXYNOS5_GPD0(0),
@@ -2512,6 +2506,12 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = {
                        .ngpio  = EXYNOS5_GPIO_Y6_NR,
                        .label  = "GPY6",
                },
+       }, {
+               .chip   = {
+                       .base   = EXYNOS5_GPC4(0),
+                       .ngpio  = EXYNOS5_GPIO_C4_NR,
+                       .label  = "GPC4",
+               },
        }, {
                .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(0),
@@ -2734,6 +2734,27 @@ static __init void exynos4_gpiolib_init(void)
        int group = 0;
        void __iomem *gpx_base;
 
+#ifdef CONFIG_PINCTRL_SAMSUNG
+               /*
+                * This gpio driver includes support for device tree support and
+                * there are platforms using it. In order to maintain
+                * compatibility with those platforms, and to allow non-dt
+                * Exynos4210 platforms to use this gpiolib support, a check
+                * is added to find out if there is a active pin-controller
+                * driver support available. If it is available, this gpiolib
+                * support is ignored and the gpiolib support available in
+                * pin-controller driver is used. This is a temporary check and
+                * will go away when all of the Exynos4210 platforms have
+                * switched to using device tree and the pin-ctrl driver.
+                */
+               struct device_node *pctrl_np;
+               const char *pctrl_compat = "samsung,pinctrl-exynos4210";
+               pctrl_np = of_find_compatible_node(NULL, NULL, pctrl_compat);
+               if (pctrl_np)
+                       if (of_device_is_available(pctrl_np))
+                               return;
+#endif
+
        /* gpio part1 */
        gpio_base1 = ioremap(EXYNOS4_PA_GPIO1, SZ_4K);
        if (gpio_base1 == NULL) {
@@ -2836,7 +2857,7 @@ static __init void exynos5_gpiolib_init(void)
        }
 
        /* need to set base address for gpc4 */
-       exynos5_gpios_1[11].base = gpio_base1 + 0x2E0;
+       exynos5_gpios_1[20].base = gpio_base1 + 0x2E0;
 
        /* need to set base address for gpx */
        chip = &exynos5_gpios_1[21];