提交 5ff77688 编写于 作者: C Christoph Muellner 提交者: Philipp Tomsich

dm: pinctrl: Add pinctrl_decode_pin_config_dm().

pinctrl_decode_pin_config_dm() is basically a feature-equivalent
implementation of pinctrl_decode_pin_config(), which operates
on struct udevice devices and uses the dev_read_*() API.
Signed-off-by: NChristoph Muellner <christoph.muellner@theobroma-systems.com>
Reviewed-by: NPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
上级 4de2bbb3
......@@ -27,6 +27,28 @@ int pinctrl_decode_pin_config(const void *blob, int node)
return flags;
}
/*
* TODO: this function is temporary for v2019.01.
* It should be renamed to pinctrl_decode_pin_config(),
* the original pinctrl_decode_pin_config() function should
* be removed and all callers of the original function should
* be migrated to use the new one.
*/
int pinctrl_decode_pin_config_dm(struct udevice *dev)
{
int pinconfig = 0;
if (dev->uclass->uc_drv->id != UCLASS_PINCONFIG)
return -EINVAL;
if (dev_read_bool(dev, "bias-pull-up"))
pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_UP;
else if (dev_read_bool(dev, "bias-pull-down"))
pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_DOWN;
return pinconfig;
}
#if CONFIG_IS_ENABLED(PINCTRL_FULL)
/**
* pinctrl_config_one() - apply pinctrl settings for a single node
......
......@@ -354,6 +354,18 @@ int pinctrl_get_periph_id(struct udevice *dev, struct udevice *periph);
*/
int pinctrl_decode_pin_config(const void *blob, int node);
/**
* pinctrl_decode_pin_config_dm() - decode pin configuration flags
*
* This decodes some of the PIN_CONFIG values into flags, with each value
* being (1 << pin_cfg). This does not support things with values like the
* slew rate.
*
* @pinconfig: Pinconfig udevice
* @return decoded flag value, or -ve on error
*/
int pinctrl_decode_pin_config_dm(struct udevice *dev);
/**
* pinctrl_get_gpio_mux() - get the mux value for a particular GPIO
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册