Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp444484iog; Mon, 13 Jun 2022 06:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4JevcTFyt/BcRLe8cKgrTo1wVE2CA+loFc215X+NbTHte4Hd6Y6QRl1aVViM5kPna4Z7e X-Received: by 2002:a63:4b20:0:b0:401:ae11:2593 with SMTP id y32-20020a634b20000000b00401ae112593mr17137144pga.375.1655125653630; Mon, 13 Jun 2022 06:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125653; cv=none; d=google.com; s=arc-20160816; b=Zag5PsO0T0QNPDDBoWpHbd6SazieDeTgwtAQlOycqmo/4T+/99V73r3AWTfLHtd8uJ oU6WYNZzIH5R1T/8TB2+jr7yG2i8EbbEhbpncNkpjYhjN+KQmdMsC8EGtLUgzv23Pmmr g8ddr1p0z9TqPO3l0dPDUTHlkWN1d6ThTFaa4vBlMtqRfcIhAN7tJ+g/jCOMXCwF3sZ7 MWyCgWcRfMuHzrQhCc1cz8zVcqrsVF7j2t7YDZOZ0cRtsEdGvLzQBgjRdOx8JIRu/17t Xa8sLMpiVxMfUiHh2zeQAWJKHr42u3J199w+eOQj3nJRYAkoaAlcKMsPtDa5HTdaZAq5 nItA== 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=VxFuFFtt3LC2oJme02UFAXEMwCnA1q9pVURut5riEbk=; b=dja3h260miTr+0gtAT+EGTK5fF80WhExV97XisepqA5M91ZnOwvTiCddh8DAkLT9Ld ovGbE0uAvY51pkLhRFTLb5NI2vYTXMqFnoxhrAnR17Tqi8L7jTVSepzDcoQYJouJm7+7 XpfTRZXL3C6TPRczUVzZ3UetO95EeDJ1Cx84X5g16HliU80tDtPT+ky4fKNROwdn8mtv QefF4qTDKOGFjpGbh1Op3NQ+FkEVTvlwZubTwgj0BURcr3t8rATk62JpA4Y/MQK1wMY9 7pqeM0DMYlBQ6aJsuDoghhcewuV6ivd+l8CoyCbyphDMFu3QG8RhaTciYm9Gty2ygzn9 dX+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PaR+w05r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w69-20020a638248000000b0040554829f04si4700391pgd.466.2022.06.13.06.07.19; Mon, 13 Jun 2022 06:07:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PaR+w05r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1350199AbiFMLBE (ORCPT + 99 others); Mon, 13 Jun 2022 07:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350203AbiFMKyp (ORCPT ); Mon, 13 Jun 2022 06:54:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A434CDA4; Mon, 13 Jun 2022 03:30:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 59BBDB80E95; Mon, 13 Jun 2022 10:30:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6B04C34114; Mon, 13 Jun 2022 10:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116212; bh=NA4E3y1t021we4LSyaOq70PfxfQjsWhyAXt2a1xl6e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PaR+w05rOQ+ZAZCxtARPImuTp4TDkIOqaiUmQsTWEUUcjmDZSUxlPMQl62dSeaY+0 o0Knfb9L0v5MWNWg3ezkzW+qJa81NuQbEQ33vQQA3qPMSNGj3ZN9E4klry/dsqUK90 sGOaImgtDxZSIkyeAZPNLvEMx7tG+lzsPcVrWvdI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrice Chotard , eberhard.stoll@kontron.de, Mark Brown , Sasha Levin Subject: [PATCH 5.4 044/411] spi: stm32-qspi: Fix wait_cmd timeout in APM mode Date: Mon, 13 Jun 2022 12:05:17 +0200 Message-Id: <20220613094929.831976150@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patrice Chotard [ Upstream commit d83d89ea68b4726700fa87b22db075e4217e691c ] In APM mode, TCF and TEF flags are not set. To avoid timeout in stm32_qspi_wait_cmd(), don't check if TCF/TEF are set. Signed-off-by: Patrice Chotard Reported-by: eberhard.stoll@kontron.de Link: https://lore.kernel.org/r/20220511074644.558874-2-patrice.chotard@foss.st.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-stm32-qspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index ea77d915216a..8070b7420217 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -293,7 +293,8 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, if (!op->data.nbytes) goto wait_nobusy; - if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) + if ((readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) || + qspi->fmode == CCR_FMODE_APM) goto out; reinit_completion(&qspi->data_completion); -- 2.35.1