pinctrl: samsung: do not use bindings header with constants
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Fri, 24 Jun 2022 08:10:22 +0000 (10:10 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 28 Jun 2022 13:55:20 +0000 (15:55 +0200)
The Samsung SoC pin controller driver uses only three defines from the
bindings header with pin configuration register values, which proves
the point that this header is not a proper bindings-type abstraction
layer with IDs.

Define the needed register values directly in the driver and stop using
the bindings header.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Chanho Park <chanho61.park@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220605160508.134075-8-krzysztof.kozlowski@linaro.org
Link: https://lore.kernel.org/r/20220624081022.32384-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/samsung/pinctrl-exynos.c
drivers/pinctrl/samsung/pinctrl-exynos.h
drivers/pinctrl/samsung/pinctrl-samsung.c
drivers/pinctrl/samsung/pinctrl-samsung.h

index 6d7ca17..a8212fc 100644 (file)
@@ -27,8 +27,6 @@
 #include <linux/soc/samsung/exynos-pmu.h>
 #include <linux/soc/samsung/exynos-regs-pmu.h>
 
-#include <dt-bindings/pinctrl/samsung.h>
-
 #include "pinctrl-samsung.h"
 #include "pinctrl-exynos.h"
 
@@ -173,7 +171,7 @@ static int exynos_irq_request_resources(struct irq_data *irqd)
 
        con = readl(bank->pctl_base + reg_con);
        con &= ~(mask << shift);
-       con |= EXYNOS_PIN_FUNC_EINT << shift;
+       con |= EXYNOS_PIN_CON_FUNC_EINT << shift;
        writel(con, bank->pctl_base + reg_con);
 
        raw_spin_unlock_irqrestore(&bank->slock, flags);
@@ -196,7 +194,7 @@ static void exynos_irq_release_resources(struct irq_data *irqd)
 
        con = readl(bank->pctl_base + reg_con);
        con &= ~(mask << shift);
-       con |= EXYNOS_PIN_FUNC_INPUT << shift;
+       con |= PIN_CON_FUNC_INPUT << shift;
        writel(con, bank->pctl_base + reg_con);
 
        raw_spin_unlock_irqrestore(&bank->slock, flags);
index bfad1ce..7bd6d82 100644 (file)
@@ -16,6 +16,9 @@
 #ifndef __PINCTRL_SAMSUNG_EXYNOS_H
 #define __PINCTRL_SAMSUNG_EXYNOS_H
 
+/* Values for the pin CON register */
+#define EXYNOS_PIN_CON_FUNC_EINT       0xf
+
 /* External GPIO and wakeup interrupt related definitions */
 #define EXYNOS_GPIO_ECON_OFFSET                0x700
 #define EXYNOS_GPIO_EFLTCON_OFFSET     0x800
index 26d309d..4837bce 100644 (file)
@@ -26,8 +26,6 @@
 #include <linux/of_device.h>
 #include <linux/spinlock.h>
 
-#include <dt-bindings/pinctrl/samsung.h>
-
 #include "../core.h"
 #include "pinctrl-samsung.h"
 
@@ -614,7 +612,7 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc,
        data = readl(reg);
        data &= ~(mask << shift);
        if (!input)
-               data |= EXYNOS_PIN_FUNC_OUTPUT << shift;
+               data |= PIN_CON_FUNC_OUTPUT << shift;
        writel(data, reg);
 
        return 0;
index fc6f519..9af93e3 100644 (file)
@@ -53,6 +53,14 @@ enum pincfg_type {
 #define PINCFG_UNPACK_TYPE(cfg)                ((cfg) & PINCFG_TYPE_MASK)
 #define PINCFG_UNPACK_VALUE(cfg)       (((cfg) & PINCFG_VALUE_MASK) >> \
                                                PINCFG_VALUE_SHIFT)
+/*
+ * Values for the pin CON register, choosing pin function.
+ * The basic set (input and output) are same between: S3C24xx, S3C64xx, S5PV210,
+ * Exynos ARMv7, Exynos ARMv8, Tesla FSD.
+ */
+#define PIN_CON_FUNC_INPUT             0x0
+#define PIN_CON_FUNC_OUTPUT            0x1
+
 /**
  * enum eint_type - possible external interrupt types.
  * @EINT_TYPE_NONE: bank does not support external interrupts