dm: allow limiting pre-reloc markings to spl or tpl
[oweals/u-boot.git] / drivers / pinctrl / pinctrl-uclass.c
index fd04b2645417f9eb5d5a649cc4ab90155d430525..9efad0623a31ce362a8c4420fc42397a6175701d 100644 (file)
@@ -12,6 +12,7 @@
 #include <dm/lists.h>
 #include <dm/pinctrl.h>
 #include <dm/uclass.h>
+#include <dm/util.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -64,7 +65,7 @@ static int pinctrl_config_one(struct udevice *config)
 static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 {
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        char propname[32]; /* long enough */
        const fdt32_t *list;
        uint32_t phandle;
@@ -72,7 +73,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
        struct udevice *config;
        int state, size, i, ret;
 
-       state = fdt_find_string(fdt, node, "pinctrl-names", statename);
+       state = fdt_stringlist_search(fdt, node, "pinctrl-names", statename);
        if (state < 0) {
                char *end;
                /*
@@ -113,7 +114,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 }
 
 /**
- * pinconfig_post-bind() - post binding for PINCONFIG uclass
+ * pinconfig_post_bind() - post binding for PINCONFIG uclass
  * Recursively bind its children as pinconfig devices.
  *
  * @dev: pinconfig device
@@ -122,7 +123,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 static int pinconfig_post_bind(struct udevice *dev)
 {
        const void *fdt = gd->fdt_blob;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
        bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC);
        const char *name;
        int ret;
@@ -131,7 +132,7 @@ static int pinconfig_post_bind(struct udevice *dev)
             offset > 0;
             offset = fdt_next_subnode(fdt, offset)) {
                if (pre_reloc_only &&
-                   !fdt_getprop(fdt, offset, "u-boot,dm-pre-reloc", NULL))
+                   !dm_fdt_pre_reloc(fdt, offset))
                        continue;
                /*
                 * If this node has "compatible" property, this is not
@@ -257,7 +258,7 @@ int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index)
 }
 
 /**
- * pinconfig_post-bind() - post binding for PINCTRL uclass
+ * pinconfig_post_bind() - post binding for PINCTRL uclass
  * Recursively bind child nodes as pinconfig devices in case of full pinctrl.
  *
  * @dev: pinctrl device