diff mbox series

[U-Boot,2/5] pinctrl: renesas: Set pin type in sh_pfc_config_mux_for_gpio

Message ID 20190421222021.22494-2-marek.vasut+renesas@gmail.com
State Accepted
Commit 50e6901fec0bd7dbfb2e39e750119ee0c78160c5
Delegated to: Marek Vasut
Headers show
Series [U-Boot,1/5] pinctrl: gpio: Add callback for configuring pin as GPIO | expand

Commit Message

Marek Vasut April 21, 2019, 10:20 p.m. UTC
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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Eugeniu Rosca April 26, 2019, 12:49 p.m. UTC | #1
On Mon, Apr 22, 2019 at 12:20 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>
> 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>

Fixes: f6e545a73f8842 ("pfc: rmobile: Add hook to configure pin as GPIO")
Reviewed-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>
diff mbox series

Patch

diff --git a/drivers/pinctrl/renesas/pfc.c b/drivers/pinctrl/renesas/pfc.c
index 06359501b7..59dc4af702 100644
--- a/drivers/pinctrl/renesas/pfc.c
+++ b/drivers/pinctrl/renesas/pfc.c
@@ -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,