]> git.sur5r.net Git - u-boot/blobdiff - drivers/pinctrl/pinctrl-uclass.c
fdt: add memory bank decoding functions for board setup
[u-boot] / drivers / pinctrl / pinctrl-uclass.c
index c42b312ddd090a0d4b9400fd6cbeb1be0ace6aec..02ab9b4afde6499ad9deee4b68fcd6b4b7947cd7 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int pinctrl_decode_pin_config(const void *blob, int node)
+{
+       int flags = 0;
+
+       if (fdtdec_get_bool(blob, node, "bias-pull-up"))
+               flags |= 1 << PIN_CONFIG_BIAS_PULL_UP;
+       else if (fdtdec_get_bool(blob, node, "bias-pull-down"))
+               flags |= 1 << PIN_CONFIG_BIAS_PULL_DOWN;
+
+       return flags;
+}
+
 #if CONFIG_IS_ENABLED(PINCTRL_FULL)
 /**
  * pinctrl_config_one() - apply pinctrl settings for a single node
@@ -60,7 +72,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;
                /*
@@ -101,7 +113,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
@@ -234,8 +246,18 @@ int pinctrl_get_periph_id(struct udevice *dev, struct udevice *periph)
        return ops->get_periph_id(dev, periph);
 }
 
+int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index)
+{
+       struct pinctrl_ops *ops = pinctrl_get_ops(dev);
+
+       if (!ops->get_gpio_mux)
+               return -ENOSYS;
+
+       return ops->get_gpio_mux(dev, banknum, 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
@@ -265,5 +287,6 @@ static int pinctrl_post_bind(struct udevice *dev)
 UCLASS_DRIVER(pinctrl) = {
        .id = UCLASS_PINCTRL,
        .post_bind = pinctrl_post_bind,
+       .flags = DM_UC_FLAG_SEQ_ALIAS,
        .name = "pinctrl",
 };