@@ -317,6 +317,7 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
{
struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
struct sh_pfc *pfc = pmx->pfc;
+ const struct sh_pfc_function *func = &pfc->info->functions[selector];
const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
unsigned long flags;
unsigned int i;
@@ -340,6 +341,9 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
break;
}
+ if (func->set_mux)
+ func->set_mux(pfc, func, grp);
+
done:
spin_unlock_irqrestore(&pfc->lock, flags);
return ret;
@@ -28,6 +28,8 @@ enum {
#define SH_PFC_PIN_CFG_PULL_DOWN (1 << 3)
#define SH_PFC_PIN_CFG_NO_GPIO (1 << 31)
+struct sh_pfc;
+
struct sh_pfc_pin {
u16 pin;
u16 enum_id;
@@ -50,17 +52,23 @@ struct sh_pfc_pin_group {
unsigned int nr_pins;
};
-#define SH_PFC_FUNCTION(n) \
+#define SH_PFC_FUNCTION_SPECIAL(n, set_mux_fn) \
{ \
.name = #n, \
.groups = n##_groups, \
.nr_groups = ARRAY_SIZE(n##_groups), \
+ .set_mux = (set_mux_fn), \
}
+#define SH_PFC_FUNCTION(n) SH_PFC_FUNCTION_SPECIAL(n, NULL)
+
struct sh_pfc_function {
const char *name;
const char * const *groups;
unsigned int nr_groups;
+ void (*set_mux)(struct sh_pfc *pfc,
+ const struct sh_pfc_function *func,
+ const struct sh_pfc_pin_group *grp);
};
struct pinmux_func {
In some cases a change of function requires changes in more than just the GPSR/IPSR registers. In particular, changing the SDHI between 3.3V and 1.8V signalling also requires modifying IOCTRL6. Add this optional operation so that such special cases can be handled in each SoC's code. Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> --- drivers/pinctrl/sh-pfc/pinctrl.c | 4 ++++ drivers/pinctrl/sh-pfc/sh_pfc.h | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)