Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3940445pxj; Mon, 21 Jun 2021 09:49:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEDN32Ryf+xZYiCGdST7OlI/ruOXagX50omamTYoPyo+p25DjjmqVpt0hEb+3z4t0Yj1eh X-Received: by 2002:a02:942e:: with SMTP id a43mr19055204jai.74.1624294173932; Mon, 21 Jun 2021 09:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624294173; cv=none; d=google.com; s=arc-20160816; b=jjy+ZdzX7roA16h/Z/8IkdSLv+8sb1UlfxnUulLRAgzGGZWcKl2a87zLm+/adgJUzF Lwr/FCitDfR1GT3436Y59483WNmMLZaB5eZNDr+7O8cTvrpU7+ngHyeGr5TYhZBpuykU EIcWmXp79SyjrPSFhyToNgD4ix5+B9lQF48kNJ0EhnWaigSrqOz2pdepSIA0EbHAL/8s f1vKyiG77HH/4S4gUUX6ke79MKmifTIBhVvXP3JFG6sKNA0ia38jwO2wRXvAZtKrzz5h uuviC0VjxOp57tfVY/lC3RBxn7KP5uZkesU0fNhygR+cF9nQzilfHpA6gR1yBITv05MZ tk3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MZJQnMtmB6QWZol7Ww9KU43pBrYXIpull/c7EBMwXnA=; b=EhWl+8vSlUgqQtjnB7mu2tECPoVGlMS0lHvZUcMOizQoiaj81OcnmMV0xKd/N6u3if GD0CBOdAdN3ZDPHComNfko+NaEOoHyXErojj65o9/3UpGMZ210KMe733OTlkEDnTui0m 63B8bQhWQYcUvxDkKUYe7/qsCO/0JDob6i/Re4XZK2zRdQtj+9FiowU605EHHzQ4ETcJ gpmQFJ3eERvzLep0tE6UDzmBbVUlr8sMeryKPzBGyka8NsodEPthJGISeumsJvlAA+ZH G+ZCYQhNo0kMItJtsShLqm688Q0rMfcvAvZ2lRYho5DFdNtIxy3HR8GzN42/Qm73tGIh vHiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a9rxPiTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si20810277jac.31.2021.06.21.09.49.21; Mon, 21 Jun 2021 09:49:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a9rxPiTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbhFUQuh (ORCPT + 99 others); Mon, 21 Jun 2021 12:50:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:37914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbhFUQrI (ORCPT ); Mon, 21 Jun 2021 12:47:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 769AA613E0; Mon, 21 Jun 2021 16:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293198; bh=B60Ie+OjEirDWdruJwC0k9ONKwgVsf/7BWwlQr6AOtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9rxPiTxrr8bphJfwaySWDH+k7et0mt1+LjTxMB/41+XJobHC6VxwG5AZa3/2SCtA Ch3YjJtLEbMT1FKa0JFrRzXqZgzx8HLhM3Urx98/g2kDyi3j6cYVNtQ8VOn/jpQh6G 1riEQSvTrTdIhddiaZdIsGy+mwprPyEDqxKxWYkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrice Chotard , Mark Brown , Sasha Levin Subject: [PATCH 5.12 101/178] spi: stm32-qspi: Always wait BUSY bit to be cleared in stm32_qspi_wait_cmd() Date: Mon, 21 Jun 2021 18:15:15 +0200 Message-Id: <20210621154926.220686913@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patrice Chotard [ Upstream commit d38fa9a155b2829b7e2cfcf8a4171b6dd3672808 ] In U-boot side, an issue has been encountered when QSPI source clock is running at low frequency (24 MHz for example), waiting for TCF bit to be set didn't ensure that all data has been send out the FIFO, we should also wait that BUSY bit is cleared. To prevent similar issue in kernel driver, we implement similar behavior by always waiting BUSY bit to be cleared. Signed-off-by: Patrice Chotard Link: https://lore.kernel.org/r/20210603073421.8441-1-patrice.chotard@foss.st.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-stm32-qspi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index 2786470a5201..4f24f6392212 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -293,7 +293,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, int err = 0; if (!op->data.nbytes) - return stm32_qspi_wait_nobusy(qspi); + goto wait_nobusy; if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) goto out; @@ -314,6 +314,9 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, out: /* clear flags */ writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR); +wait_nobusy: + if (!err) + err = stm32_qspi_wait_nobusy(qspi); return err; } -- 2.30.2