pinctrl: sh-pfc: Add new flags into struct sh_pfc_pin_config

To clean/modify the code up later, this patch just adds new flags
"mux_set" and "gpio_enabled" into the struct sh_pfc_pin_config.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
This commit is contained in:
Yoshihiro Shimoda 2019-08-08 15:19:01 +09:00 committed by Geert Uytterhoeven
parent 625efea83a
commit 1d4ba593d0
1 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,8 @@
struct sh_pfc_pin_config { struct sh_pfc_pin_config {
u32 type; u32 type;
bool mux_set;
bool gpio_enabled;
}; };
struct sh_pfc_pinctrl { struct sh_pfc_pinctrl {
@ -364,7 +366,15 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
for (i = 0; i < grp->nr_pins; ++i) { for (i = 0; i < grp->nr_pins; ++i) {
ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION); ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
if (ret < 0) if (ret < 0)
break; goto done;
}
/* All group pins are configured, mark the pins as mux_set */
for (i = 0; i < grp->nr_pins; ++i) {
int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]);
struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
cfg->mux_set = true;
} }
done: done:
@ -405,6 +415,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
} }
cfg->type = PINMUX_TYPE_GPIO; cfg->type = PINMUX_TYPE_GPIO;
cfg->gpio_enabled = true;
ret = 0; ret = 0;
@ -426,6 +437,7 @@ static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
spin_lock_irqsave(&pfc->lock, flags); spin_lock_irqsave(&pfc->lock, flags);
cfg->type = PINMUX_TYPE_NONE; cfg->type = PINMUX_TYPE_NONE;
cfg->gpio_enabled = false;
spin_unlock_irqrestore(&pfc->lock, flags); spin_unlock_irqrestore(&pfc->lock, flags);
} }