Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3920104pxj; Mon, 21 Jun 2021 09:23:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuj2/xolkve9d7ZTwmcRxYlAK2sXPd7fPyb6tiUfajz2ip0iNurqk5ccAc9znL9KJhqfnp X-Received: by 2002:a05:6402:50ce:: with SMTP id h14mr22797199edb.219.1624292591427; Mon, 21 Jun 2021 09:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292591; cv=none; d=google.com; s=arc-20160816; b=sBQdzzG31pcP6KaZ+vweAIQkQqoK5uFfOELVQo+qBz21pQKHZUNwfWqUkMM81FP4RL AVIzAfRK9//Tsguav1CgTI7Msn51Q3mK6stT39iBCsR2ml6jRF3jhrjfEvIOTwNVLXth T4spHni1k/MEprDkBa5NIwGHTR2nJR+urHkWXM91378GLsZE7DlJH/PdGyO6QUcvJyFb Q+1e7jKoIEzE53e1h2fenocgUVWRaDzmUPUTbmmDkcIf6weakHH81C+BtzdaVulW2ise 1kGBT//XdtDNnyGzFp2KNv3ypCvXoGM/cn2o9V3Fe79UyG1SqWQnABHjsElE2vZxrEW7 PUYg== 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=muDcWDtweDcb0HadOKCPXRCxpKvK41jxA0lyHqdlH84=; b=n3IXPy5zkAXibzepvWYhxo+8FaYyNV57R7jjwTcuFP0cxcT0sEx4LhF/3pDS468FqT oCOPiEyDJYwvkA86QBa65BL/sW+i1R1Ky89vOKOyBON/h888PzkWHZmDuwk3q745IZL0 RQ+bHN4S/+eHFD6UbnEWHlmvSoAkNRfvks0ykGOqKt4mm9BOhrRxsGmZZGDIqa3ApWiV YudcAAUEaC4AIVjjK7fEmsD5L8GNvwg9Btok5JOErHcusTEYLwD6LCcqQm6R235GeApz pjez41z73zsG95efAuWhdvB2/4xbpnDFSp+fEQUVbSQJoxFolGTa3uVSdIHC1xsVNeWE JHjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OkyX0iji; 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 i11si1849712eds.153.2021.06.21.09.22.49; Mon, 21 Jun 2021 09:23:11 -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=OkyX0iji; 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 S231824AbhFUQVv (ORCPT + 99 others); Mon, 21 Jun 2021 12:21:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:41712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbhFUQUq (ORCPT ); Mon, 21 Jun 2021 12:20:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E17FB613CC; Mon, 21 Jun 2021 16:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292312; bh=9QCDooSLI5lGrufx4gMOLz7/kIWNX/cvUYTiHDEsmU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OkyX0ijiPJNVeMiJdNCefNz+en/NdX8V+o2zg3hxKlRsj6Ga6/5GDDWukgkeaSdSD i2mjSpklGOsupBQFDi71LzV3bPGecij4+eaG07UDfjAYDulKinr93/sKRc0o+po76h mJDf/VkG7oSBOJn2I/Eg09Ejywo3FkNti00DbwB0= 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.4 45/90] spi: stm32-qspi: Always wait BUSY bit to be cleared in stm32_qspi_wait_cmd() Date: Mon, 21 Jun 2021 18:15:20 +0200 Message-Id: <20210621154905.650401693@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154904.159672728@linuxfoundation.org> References: <20210621154904.159672728@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 4e726929bb4f..ea77d915216a 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -291,7 +291,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; @@ -312,6 +312,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