Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597776pxj; Wed, 12 May 2021 08:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz54nY+U5B0LGztEKpg4BjqGOo4Nb9awIrAR6N4K+i0LcXTkPdgm8MfsO4kBNbZUO6ExE2z X-Received: by 2002:a17:906:58d6:: with SMTP id e22mr38535099ejs.216.1620835098414; Wed, 12 May 2021 08:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835098; cv=none; d=google.com; s=arc-20160816; b=av8sqllb055ph7OZYWyY9u8vTCN5aZEBggItc9d5OfMA2YT0ES3j0T+Xey69GzCy+a F5ng12trn9aS6zmzX/NEU1ZVX1KWuk94926vmgGO0Z/E/2UeHszvLI02zChZPSmCpTJc y8EHc27lp+0Dpjd442NallywnaTvJb0G1mJDmc//njtKdRNLeSih71K574AH4DHna+zR +ypwdZxkWjcM8TGASrwxSTxIX/kw+1F5ALZSMnG3KTqZFUHbY0bw67Q9p8/4mu0CktmD 7L6+XtUaVeKVrAGTPpC3gyY2Y9pvPwyW7FdIH28ySZbb8lACTcsp7YixYHh5iVlsnAr5 2P1A== 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=BNS7axKGpS97fYTz9Mv6fJwpvnLST2sewkAlnNDG6jo=; b=mK1l73z+6Fsajx9woH7lWRzm5ZbvxEtlSHJUJaATqWcU6Js9UvjYw5Fva7kzwec+jL lZLqwtUOkeFZ0fuhk+6AmwyGhegw8C4ftqmFlsfCy2pVxStd6cs+WsZGBxlRf3ZCfBal Bo/q6QW8B95Rr5n8EqsNod/bXaG1kcxY24Rl8ImhVnsyRTgfAwHtdbMeCqAHv7VpcKp5 vcp6dJPg5yA8PMpw1axLt8xBjdBLlq/axWXmEIxQQa5SFnScH/NrLQUJUNfNjAsHCNM4 d268oL4nUM8wuAHbbCZ0VoVNMVK8jSlF2dueMkaOEagTfQc0tEoGNPKEDHQhJEAM6zdf E98w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EZZW50Dp; 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 ji21si212335ejc.740.2021.05.12.08.57.52; Wed, 12 May 2021 08:58:18 -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=EZZW50Dp; 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 S237949AbhELP4z (ORCPT + 99 others); Wed, 12 May 2021 11:56:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:40848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235297AbhELP13 (ORCPT ); Wed, 12 May 2021 11:27:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFC1A61432; Wed, 12 May 2021 15:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832342; bh=TffKJI8KAmcyDmLPVib2/8wDzsgHdlux5bMi96Gdqn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EZZW50Dpz7Mgi2AX8pjHoEAqH7c17yX4qMq3cIhgu2Na5vw2HRsZp02lWf07e6Bih i2fkBtKRFhMK0GyXjb+MPksJHGpmWBZkbGa7UJA/W0b4pdnaU5SlPRUjEv40GLFBVO j7VGOS9zIONSXJa6UL5lE77TIsvF+eQgIbIcanbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quanyang Wang , Amit Kumar Mahapatra , Mark Brown , Sasha Levin Subject: [PATCH 5.10 240/530] spi: spi-zynqmp-gqspi: fix incorrect operating mode in zynqmp_qspi_read_op Date: Wed, 12 May 2021 16:45:50 +0200 Message-Id: <20210512144827.729399031@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Quanyang Wang [ Upstream commit 41d310930084502433fcb3c4baf219e7424b7734 ] When starting a read operation, we should call zynqmp_qspi_setuprxdma first to set xqspi->mode according to xqspi->bytes_to_receive and to calculate correct xqspi->dma_rx_bytes. Then in the function zynqmp_qspi_fillgenfifo, generate the appropriate command with operating mode and bytes to transfer, and fill the GENFIFO with the command to perform the read operation. Calling zynqmp_qspi_fillgenfifo before zynqmp_qspi_setuprxdma will result in incorrect transfer length and operating mode. So change the calling order to fix this issue. Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework") Signed-off-by: Quanyang Wang Reviewed-by: Amit Kumar Mahapatra Link: https://lore.kernel.org/r/20210408040223.23134-5-quanyang.wang@windriver.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-zynqmp-gqspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index cf73a069b759..036d8ae41c06 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -827,8 +827,8 @@ static void zynqmp_qspi_write_op(struct zynqmp_qspi *xqspi, u8 tx_nbits, static void zynqmp_qspi_read_op(struct zynqmp_qspi *xqspi, u8 rx_nbits, u32 genfifoentry) { - zynqmp_qspi_fillgenfifo(xqspi, rx_nbits, genfifoentry); zynqmp_qspi_setuprxdma(xqspi); + zynqmp_qspi_fillgenfifo(xqspi, rx_nbits, genfifoentry); } /** -- 2.30.2