From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32EBFC433F5 for ; Tue, 17 May 2022 08:42:25 +0000 (UTC) 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) 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-Google-Smtp-Source: ABdhPJyzQwUlhihzP/OM36MlOrgfMihVU/kYCqbRGfmaM1RUlKSrjdrz98VvSt0ad3eDPIXIWVFwVw== 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 --- 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); } } -- 2.17.1