From patchwork Mon Jul 30 12:34:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 950863 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="YBC6fUnt"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41fJw10pG5z9s0R for ; Mon, 30 Jul 2018 22:36:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CC69FC22020; Mon, 30 Jul 2018 12:35:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BBECAC22004; Mon, 30 Jul 2018 12:34:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D49F0C21FBB; Mon, 30 Jul 2018 12:34:21 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by lists.denx.de (Postfix) with ESMTPS id 9C423C21FB9 for ; Mon, 30 Jul 2018 12:34:16 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id h15-v6so12694201wrs.7 for ; Mon, 30 Jul 2018 05:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=sF0Q/FhKUQVcZaAey6NrdCLL3jP7wWKCGfRfrvIkGlE=; b=YBC6fUntAl8/S4uaKmhrqP7beKKpcFJLvfrQCUG7c0I57IeTN5vbLy0PtTOGBiw5ct +woy4+AZaPX8yCUX5EpzuKGaPDdLKiJotCjYDOsNqkaS9q6lLCDDW789zUPFPOx0RyOX GRHtW8pKifhcnomta5fX+Vgoqf2Cv4OR5b2IX35F4lZuMVFT2XtSA+DQ5sufgNYunsNg v04DVlFxiebobIrXHDWKVkEA5h4zv46BRf4tbN+lelaa57Ad8Wy+PJTGyEc9xvjP4l8v aAtgZ3boFYOrxMEVr0pQYeSRzUIjVGNB+3zC3zISLy3TP5e+VIqYPp2Qa2mC3fTSp3o7 bvKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=sF0Q/FhKUQVcZaAey6NrdCLL3jP7wWKCGfRfrvIkGlE=; b=je+IcUs3e4vUA/vLe1dVNVtj51jpmoBVF9Hn3ikNSvXud6wcovJKXrqSyUI+JMF/Gn /KbIIrA4V83gsr4NU/VDlpLK73Jtoht67yhIZ7iPAkaQzp1Txb72oCIgDDxCsB5ZWrrA ED1xjhMW7pN04cmyNNMn8FQ4CZFWxLS09jdHBbXN6cQ/jFisCwK+eRkxYa904pBBfED7 YJ8FuK5N4RjcpHWkTdcJ0m5LL7orT4gCetnRtgFJWyWyquLLUfY3x24VYmdkN46nbmVt Itz4rs3DwgMR3dHXMrVwG1VkwsKgersyIfwSezbXT0E7DC/jxGF+14JvCfaDrTRqzy+g 1qxA== X-Gm-Message-State: AOUpUlGRwWF460xc7gB9PohTOeVuoFshiOB1Q3HMWEr4qJMTOZVfeLKE U7k+bWNrkUYJ6WfKyAgOFx0lF+RryPhSQg== X-Google-Smtp-Source: AAOMgpeioa6xnIC7PiGbJhiweIiWqDMukVxV8dGiP9iVwzKS0dYHcWNTL1SKTJ63hy+crYWo3SfWxw== X-Received: by 2002:a5d:648a:: with SMTP id r10-v6mr11796490wru.109.1532954056021; Mon, 30 Jul 2018 05:34:16 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id b11-v6sm19829052wma.34.2018.07.30.05.34.15 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 30 Jul 2018 05:34:15 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, stefan@herbrechtsmeier.net Date: Mon, 30 Jul 2018 14:34:07 +0200 Message-Id: <0a76e524a79cfd177361be0f6e9a2b8903812c4b.1532954043.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Subject: [U-Boot] [PATCH 3/4] gpio: xilinx: Set value before changing direction X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Signed-off-by: Michal Simek Reviewed-by: Stefan Herbrechtsmeier --- 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; }