[U-Boot] [PATCH 1/4] pinctrl: rmobile: Add support for setting single pins
Marek Vasut
marek.vasut at gmail.com
Wed Nov 29 03:07:41 UTC 2017
Add code to handle single pins nodes from DT in addition to already
support groups handling.
Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
---
drivers/pinctrl/renesas/pfc.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/pinctrl/renesas/pfc.c b/drivers/pinctrl/renesas/pfc.c
index edaac77f43..2f23d335f9 100644
--- a/drivers/pinctrl/renesas/pfc.c
+++ b/drivers/pinctrl/renesas/pfc.c
@@ -450,6 +450,22 @@ static const char *sh_pfc_pinctrl_get_function_name(struct udevice *dev,
return priv->pfc.info->functions[selector].name;
}
+static int sh_pfc_pinctrl_pin_set(struct udevice *dev, unsigned pin_selector,
+ unsigned func_selector)
+{
+ struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev);
+ struct sh_pfc_pinctrl *pmx = &priv->pmx;
+ struct sh_pfc *pfc = &priv->pfc;
+ const struct sh_pfc_pin *pin = &priv->pfc.info->pins[pin_selector];
+ int idx = sh_pfc_get_pin_index(pfc, pin->pin);
+ struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
+
+ if (cfg->type != PINMUX_TYPE_NONE)
+ return -EBUSY;
+
+ return sh_pfc_config_mux(pfc, pin->enum_id, PINMUX_TYPE_FUNCTION);
+}
+
static int sh_pfc_pinctrl_group_set(struct udevice *dev, unsigned group_selector,
unsigned func_selector)
{
@@ -644,6 +660,19 @@ static int sh_pfc_pinconf_set(struct sh_pfc_pinctrl *pmx, unsigned _pin,
return 0;
}
+static int sh_pfc_pinconf_pin_set(struct udevice *dev,
+ unsigned int pin_selector,
+ unsigned int param, unsigned int arg)
+{
+ struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev);
+ struct sh_pfc_pinctrl *pmx = &priv->pmx;
+ struct sh_pfc *pfc = &priv->pfc;
+ const struct sh_pfc_pin *pin = &pfc->info->pins[pin_selector];
+
+ sh_pfc_pinconf_set(pmx, pin->pin, param, arg);
+
+ return 0;
+}
static int sh_pfc_pinconf_group_set(struct udevice *dev,
unsigned int group_selector,
@@ -673,8 +702,10 @@ static struct pinctrl_ops sh_pfc_pinctrl_ops = {
#if CONFIG_IS_ENABLED(PINCONF)
.pinconf_num_params = ARRAY_SIZE(sh_pfc_pinconf_params),
.pinconf_params = sh_pfc_pinconf_params,
+ .pinconf_set = sh_pfc_pinconf_pin_set,
.pinconf_group_set = sh_pfc_pinconf_group_set,
#endif
+ .pinmux_set = sh_pfc_pinctrl_pin_set,
.pinmux_group_set = sh_pfc_pinctrl_group_set,
.set_state = pinctrl_generic_set_state,
};
--
2.15.0
More information about the U-Boot
mailing list