drivers/pinmux: stm32: Get remap functions visible across family

Move pinctrl remap functions out of stm32f1 definition in order
to get it available to all series.
Allows use of more IS_ENABLED macros in calling drivers and make
code more readable.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2020-10-16 14:28:48 +02:00 committed by Kumar Gala
commit f44e931b0c
6 changed files with 62 additions and 51 deletions

View file

@ -412,17 +412,18 @@ static int can_stm32_init(const struct device *dev)
/* configure pinmux */
if (cfg->pinctrl_len != 0U) {
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32f1_pinctrl)
int remap;
/* Check that remap configuration is coherent across pins */
remap = stm32_dt_pinctrl_remap_check(cfg->pinctrl,
cfg->pinctrl_len);
if (remap < 0) {
return remap;
}
stm32_dt_pinctrl_remap_set((uint32_t)cfg->can, remap);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32f1_pinctrl) */
if (IS_ENABLED(DT_HAS_COMPAT_STATUS_OKAY(st_stm32f1_pinctrl))) {
int remap;
/* Check remap configuration is coherent across pins */
remap = stm32_dt_pinctrl_remap_check(cfg->pinctrl,
cfg->pinctrl_len);
if (remap < 0) {
return remap;
}
stm32_dt_pinctrl_remap_set((uint32_t)cfg->can, remap);
}
stm32_dt_pinctrl_configure(cfg->pinctrl, cfg->pinctrl_len);
}