pinctrl: renesas: Set pin type in sh_pfc_config_mux_for_gpio
authorMarek Vasut <marek.vasut+renesas@gmail.com>
Sun, 21 Apr 2019 20:46:25 +0000 (22:46 +0200)
committerMarek Vasut <marex@denx.de>
Sat, 4 May 2019 17:26:49 +0000 (19:26 +0200)
Add missing cfg->type = PINMUX_TYPE_GPIO upon successfully setting pin
as a GPIO to retain the pin configuration information.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alex Kiernan <alex.kiernan@gmail.com>
Cc: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Cc: Eugeniu Rosca <roscaeugeniu@gmail.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick DELAUNAY <patrick.delaunay@st.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Simon Glass <sjg@chromium.org>
drivers/pinctrl/renesas/pfc.c

index 06359501b7d21a4d31ee906d805383a4eefb4a3e..59dc4af7027998a4e19cf104062ca80ac7825800 100644 (file)
@@ -466,7 +466,7 @@ int sh_pfc_config_mux_for_gpio(struct udevice *dev, unsigned pin_selector)
        struct sh_pfc *pfc = &priv->pfc;
        struct sh_pfc_pin_config *cfg;
        const struct sh_pfc_pin *pin = NULL;
-       int i, idx;
+       int i, ret, idx;
 
        for (i = 1; i < pfc->info->nr_pins; i++) {
                if (priv->pfc.info->pins[i].pin != pin_selector)
@@ -485,7 +485,13 @@ int sh_pfc_config_mux_for_gpio(struct udevice *dev, unsigned pin_selector)
        if (cfg->type != PINMUX_TYPE_NONE)
                return -EBUSY;
 
-       return sh_pfc_config_mux(pfc, pin->enum_id, PINMUX_TYPE_GPIO);
+       ret = sh_pfc_config_mux(pfc, pin->enum_id, PINMUX_TYPE_GPIO);
+       if (ret)
+               return ret;
+
+       cfg->type = PINMUX_TYPE_GPIO;
+
+       return 0;
 }
 
 static int sh_pfc_pinctrl_pin_set(struct udevice *dev, unsigned pin_selector,