]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: exynos: Convert to use livetree API for fdt access
authorSam Protsenko <semen.protsenko@linaro.org>
Thu, 30 Nov 2023 20:13:52 +0000 (14:13 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 9 Jan 2024 15:59:28 +0000 (10:59 -0500)
Use counterpart dev_read_* functions instead of fdt* ones. It fixes
checkpatch warnings like this:

    WARNING: Use the livetree API (dev_read_...)
    #54: FILE: drivers/pinctrl/exynos/pinctrl-exynos.c:137:
        pinvals[idx] = fdtdec_get_int(fdt, node,

and also makes it possible to avoid using the global data pointer in the
driver.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
drivers/pinctrl/exynos/pinctrl-exynos.c

index b6af3befbf9b1712a4b7eeea15a948d1b03dfdf1..8a045cdf7aa8948e9567b61a34f326286a9a416b 100644 (file)
@@ -9,12 +9,9 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include "pinctrl-exynos.h"
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /* CON, DAT, PUD, DRV */
 const struct samsung_pin_bank_type bank_type_alive = {
        .fld_width = { 4, 1, 2, 2, },
@@ -118,8 +115,6 @@ static void exynos_pinctrl_set_pincfg(unsigned long reg_base, u32 pin_num,
 int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 {
        struct exynos_pinctrl_priv *priv = dev_get_priv(dev);
-       const void *fdt = gd->fdt_blob;
-       int node = dev_of_offset(config);
        unsigned int count, idx;
        unsigned int pinvals[PINCFG_TYPE_NUM];
 
@@ -127,13 +122,13 @@ int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
         * refer to the following document for the pinctrl bindings
         * linux/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
         */
-       count = fdt_stringlist_count(fdt, node, "samsung,pins");
+       count = dev_read_string_count(config, "samsung,pins");
        if (count <= 0)
                return -EINVAL;
 
        for (idx = 0; idx < PINCFG_TYPE_NUM; ++idx) {
-               pinvals[idx] = fdtdec_get_int(fdt, node,
-                                             exynos_pinctrl_props[idx], -1);
+               pinvals[idx] = dev_read_u32_default(config,
+                                               exynos_pinctrl_props[idx], -1);
        }
        pinvals[PINCFG_TYPE_DAT] = -1; /* ignore GPIO data register */
 
@@ -142,12 +137,13 @@ int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
                unsigned int pin_num;
                char bank_name[10];
                unsigned long reg;
-               const char *name;
-               int pincfg;
+               const char *name = NULL;
+               int pincfg, err;
 
-               name = fdt_stringlist_get(fdt, node, "samsung,pins", idx, NULL);
-               if (!name)
+               err = dev_read_string_index(config, "samsung,pins", idx, &name);
+               if (err || !name)
                        continue;
+
                parse_pin(name, &pin_num, bank_name);
                bank = get_bank(dev, bank_name);
                reg = priv->base + bank->offset;