summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-01-21 19:43:26 -0700
committerSimon Glass <sjg@chromium.org>2016-01-21 20:42:34 -0700
commit52db39a22b0544446e630c853292bfa255a21e24 (patch)
treecc1360edc2d0167bd3262493f01976e7365d9850 /drivers/pinctrl
parent0379597e55c17519be36fdf357d4463279da5aca (diff)
dm: pinctrl: Add a function to parse PIN_CONFIG flags
Add a function which produces a flags word from a few common PIN_CONFIG settings. This is useful for simple pinctrl drivers that don't need to worry about drive strength, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-uclass.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index c42b312ddd0..1acbfafa818 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -15,6 +15,18 @@
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