All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] gpio: xilinx: Set value before changing direction
Date: Mon, 30 Jul 2018 14:34:07 +0200	[thread overview]
Message-ID: <0a76e524a79cfd177361be0f6e9a2b8903812c4b.1532954043.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <f93db74b32d2d371bdcb02fff1e2ea0de67e6bc9.1532954043.git.michal.simek@xilinx.com>

Set a value before changing gpio direction. This will ensure that the
old value is not propagated when direction has changed but new value is
not written yet.

Reported-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/gpio/xilinx_gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c
index 776a147cc8d7..1e5f3da8d7e8 100644
--- a/drivers/gpio/xilinx_gpio.c
+++ b/drivers/gpio/xilinx_gpio.c
@@ -139,14 +139,14 @@ static int xilinx_gpio_direction_output(struct udevice *dev, unsigned offset,
 	if (platdata->bank_input[bank])
 		return -EINVAL;
 
+	xilinx_gpio_set_value(dev, offset, value);
+
 	if (!platdata->bank_output[bank]) {
 		val = readl(&platdata->regs->gpiodir + bank * 2);
 		val = val & ~(1 << pin);
 		writel(val, &platdata->regs->gpiodir + bank * 2);
 	}
 
-	xilinx_gpio_set_value(dev, offset, value);
-
 	return 0;
 }
 
-- 
1.9.1

  parent reply	other threads:[~2018-07-30 12:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 12:34 [U-Boot] [PATCH 1/4] gpio: xilinx: Find out bank before use in xilinx_gpio_get_function() Michal Simek
2018-07-30 12:34 ` [U-Boot] [PATCH 2/4] gpio: xilinx: Remove !DM driver Michal Simek
2018-07-30 12:34 ` Michal Simek [this message]
2018-07-30 13:31   ` [U-Boot] [PATCH 3/4] gpio: xilinx: Set value before changing direction Stefan Herbrechtsmeier
2018-07-30 12:34 ` [U-Boot] [PATCH 4/4] gpio: xilinx: Simplify logic in xilinx_gpio_set_value Michal Simek
2018-07-30 13:31   ` Stefan Herbrechtsmeier
2018-07-30 13:42     ` Michal Simek
2018-07-30 13:47       ` Stefan Herbrechtsmeier
2018-07-30 13:28 ` [U-Boot] [PATCH 1/4] gpio: xilinx: Find out bank before use in xilinx_gpio_get_function() Stefan Herbrechtsmeier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a76e524a79cfd177361be0f6e9a2b8903812c4b.1532954043.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.