From patchwork Tue May 17 08:41:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 573446 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp200587mab; Tue, 17 May 2022 01:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWD6BJEWGNUeWGc7/wkca9C62umTXCn4tqDU2tHU2LdnqQOlg+sEy02fdC79GyV4YqlogI X-Received: by 2002:a05:6402:27cc:b0:427:b593:62ef with SMTP id c12-20020a05640227cc00b00427b59362efmr17497709ede.409.1652776944935; Tue, 17 May 2022 01:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652776944; cv=none; d=google.com; s=arc-20160816; b=WVb4xYmu2aC6dvY0hF/+CvBYjhh41yTuzVYR8vBfbmjcn3d7udmKCPFBXx+79fJBwC 2WK6wIKIaitxUCGTa8J3gglXHJCFJTFgJ6mLL3wM+jmBWrw+mBfNiWFybJ/t0LnTtcQE +w1Sv39ETUSVKiKpf90Z8DdkeUcZsm56EATKJwEicisiYZ2qPMxWRsap1y+sKSuPG/mP d3iqIMFPHZUKq6hjyogvXSVqcZNAl7YYjTRbtLPbsRLvDvURzkaGO9+EWhedf1z2+U/u LPY/v/rkeVGV1oikY7LJePhtdYDcjOnemoMrMHEITaAs5COn8it8MtDGO2byCx+RIQtw 4Vtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=sG1MMswZ8Ao9z9UDs1+ligLDc+rctH2W+HIQWi7D48Q=; b=q8ng/+QK76kvHk5r053qufQUfxO3HvugE1YbHgk2wUSUDgxAAHPIVS6mSJcoulJa4v K30T82Dw0xyFGKc2ege7E2xkCOK+EYX4RA9b9WU6ZKg2xl956xuSHMZdolZyTYiD7+7+ 7BpdiXdaWnHeIKuTxbYrPJsNXQZbHJFFt32/uXF0CAXuZ9U2Z2E0VvNaKePR28rZY8WQ ASzAFMoyMY9E0xZIiMZCpx43PoLgi0Thq0kCYIT0F1uUpQK4+VPJZMWlnmvxqLF0715t o9pCfKbHBSWWtTrEHYVMweOTzn2NFL/VbEIKBQOoDtTkNBui0BoiLQKqdsfXKlHNBMel gx6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+KYQHWv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id bx23-20020a170906a1d700b006ec0acfe30esi2065971ejb.877.2022.05.17.01.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+KYQHWv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D6D284278; Tue, 17 May 2022 10:41:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="P+KYQHWv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ACA398425C; Tue, 17 May 2022 10:41:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 178048424F for ; Tue, 17 May 2022 10:41:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pg1-x52b.google.com with SMTP id 202so16337725pgc.9 for ; Tue, 17 May 2022 01:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sG1MMswZ8Ao9z9UDs1+ligLDc+rctH2W+HIQWi7D48Q=; b=P+KYQHWvD11p+Bc9Bt2VlmUIAzrFuRd1Fk1bEj0rVM+cQFT+xdTGATSykk+AqhyyqW bfOrCHLFuj4cFqfkrNWgLMsc9kjPwd2rLEK6915WHZ/xWa9MgnWFuvPnArJ6UP7Qos9J ZD9h3J0x2dyMG6XunsUZA0/SGPAw3pM24QSvyPQ62E+j6exWWmqtebqEmcQbabNGZzJ+ cjXYFtXfxyIhE6od1NKibqI32QTxRofoOSI05Fd6rkgrr1V7U0LNTCV8k/X3xfk952In Zsh2FelbRUk36MKkcCQ7lIQpMd+u+nwK8ZZ0DcVnjbr9vNJl7RvpgvpL3jb0cY/o4jjH cmlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sG1MMswZ8Ao9z9UDs1+ligLDc+rctH2W+HIQWi7D48Q=; b=0IhnB9l8TQ/Cmrt4tVNoAcgDJFfNQqscAoM+GTeJwYLh/4DQCYHnbstUrllay8L7wK edMTe+BJO09nKf+eyNpj2uu1ZU/Ec4ut30iEUPzbTIYwakViYdCpLsNjtMcut9JBWjkO MuZtMvmCM14Rz4BUFDAWbCUPjDAt8zET4HvMT9Ht3X6ZLHbIka3CBgW7UwiuV5ct5vMI gjaxPDJwwyVHjz8MavbZvlFYZB/4P7X9IUQ6UjRP/6tLKObuMpeEeqLKQfkFg17eVCum s+OdI+zPO9yU2YFo4DzVqCwAs4npWsAnsi4/gPzf4R+w54tSfjzmkA7nuuv0KZaKpgEO jH0g== X-Gm-Message-State: AOAM532oqGQnF5w7YytCVLdTXYuMOOUKBiTt77tRuCsL5sziPvzCpM9U ltb170TPN+u7CxtrL/iPLNi0PP/yo2zHhg== X-Received: by 2002:a65:4685:0:b0:3da:eb4e:61ed with SMTP id h5-20020a654685000000b003daeb4e61edmr18216203pgr.591.1652776894358; Tue, 17 May 2022 01:41:34 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id s200-20020a632cd1000000b003f5912ba179sm741569pgs.58.2022.05.17.01.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:41:34 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Jassi Brar , Satoru Okamoto , Masahisa Kojima , Jagan Teki Subject: [PATCH 4/4] spi: synquacer: simplify tx completion checking Date: Tue, 17 May 2022 17:41:39 +0900 Message-Id: <20220517084139.6986-5-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220517084139.6986-1-masahisa.kojima@linaro.org> References: <20220517084139.6986-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean There is a TX-FIFO and Shift Register empty(TFES) status bit in spi controller. This commit checks the TFES bit to wait the TX transfer completes. Signed-off-by: Masahisa Kojima Signed-off-by: Satoru Okamoto Acked-by: Jassi Brar --- drivers/spi/spi-synquacer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index 5e1b3aedc7..0cae3dfc77 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -45,6 +45,7 @@ #define RXF 0x20 #define RXE 0x24 #define RXC 0x28 +#define TFES 1 #define TFLETE 4 #define TSSRS 6 #define RFMTE 5 @@ -345,13 +346,10 @@ static int synquacer_spi_xfer(struct udevice *dev, unsigned int bitlen, if (priv->tx_words) { write_fifo(priv); } else { - u32 len; - - do { /* wait for shifter to empty out */ + /* wait for shifter to empty out */ + while (!(readl(priv->base + TXF) & BIT(TFES))) cpu_relax(); - len = readl(priv->base + DMSTATUS); - len = (len >> TX_DATA_SHIFT) & TX_DATA_MASK; - } while (tx_buf && len); + busy &= ~BIT(TXBIT); } }