Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3929537pxj; Mon, 21 Jun 2021 09:35:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTOW6k/NOTSYpyhKCpgF3EwD3VDsbhpkmn/sbQ/8EfQ0bXn3yk7MuM10D8rmImkKPmnwoP X-Received: by 2002:a05:6402:845:: with SMTP id b5mr22482410edz.266.1624293317068; Mon, 21 Jun 2021 09:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293317; cv=none; d=google.com; s=arc-20160816; b=kBWJfIWhs1k37+NBBcB3fwkk+Q5sKo/7HzST3cLtAEbWbIbpIbIrDu9Iplw+ctqkLW 9QnpwxqnY8IoP278tXahiEeOd6Qz41/QeSU1iiqnQ+G9Iv8oax3QHHDRKLbu/zJbCM91 Lmk9eM7mK0s81PnTWfVCM7wer/fqxFsR2le1vdzuzQbwX0/MRJoiDqU+DApCe5D5mIqb YDeHrhx3sHzp6xSQI0iPuiNQtgQFVS0W5pHrp2Zbux9gjWmKka3L136AZ7lO4QyY6y7h GzRd7SyPeeG1gadKY4uC186/lObozu1afQDhrAQik2ArbdqvVcHSM/8Ttff4yVBUDuTg 1/Ow== 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=nczvycOdAEM3eo2wjBiHLd2QZ6AozjWew12VA671mBIf6iYVgkA+Y4CwU/OcytSzX6 bD+rF4ODq+NF/CZIqAjVOT6lCP04eqWIicMGrnQdFvUu0PLgbWE0HDKiOVwcuArXwYu4 k715TktqcwTQj4pak4vLWQroCW5MJOlt2tEBaz+45XPPASCsoektMAJ/BinSqOcaz5h3 XsAZiP4MnXWEyO6chTZu0GFka/aNrsamYid9h27v+O99Hw8ZwuznTv2oqHbsGczpyI1K HMkneRm6E6I8eyQTnhoWdenOZKYph97CLLxv7Kn1ttEzHli3UJUqCuMzn3+opFw1fsYO aUHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2OlYUOVu; 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 aq2si10983112ejc.214.2021.06.21.09.34.54; Mon, 21 Jun 2021 09:35:17 -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=2OlYUOVu; 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 S232218AbhFUQgN (ORCPT + 99 others); Mon, 21 Jun 2021 12:36:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:54996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbhFUQcI (ORCPT ); Mon, 21 Jun 2021 12:32:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E70F613B0; Mon, 21 Jun 2021 16:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292757; bh=B60Ie+OjEirDWdruJwC0k9ONKwgVsf/7BWwlQr6AOtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2OlYUOVuSWgrMavtGHsii2+IFE3zOXAYlQVtvPz8IihRf6xt3feCRbukUxPIzgpqR njmBr6atB/iqM1YZzHmI//C9Lll4a2ut6fWS9J5xt8B7BpnH0OCik2WkNc1EMx0nuW bhy+wV+bXpHSmJ9WPNvvZFDr4V+VV/EJ3CTyFKKw= 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.10 085/146] 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: <20210621154916.452264604@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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