From patchwork Fri Mar 29 08:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 13610371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BD79C6FD1F for ; Fri, 29 Mar 2024 09:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=+Uv7ae4ZSs8XZ9k9mP8gNu8YrgvnAYtA6UWke6ACsRU=; b=jHIF3QTLBeqp9N EGt+HZxE3x3dxVNFNR3XLpyUaoHsJIX/1hMFbnN2pOlXtRBS/Yz2eH2OuUW6vTrY3aiOhA7NFhjWm Gv4KT9vNe8qWPHjhEJNMdRe5ioGjP3qQPDjtKud3z1OSpoEZVhqvwuzzE7apGU+aDFRmhdvkV/Ze4 lfyvGy4qjX9d5pXWkc2cn1ejvdP9ja/KyUs2hISOrhqbNzlbXyiYd5aW2UISHRZaWlUFY1qPqKpe8 i/WM+t328s742USllN+Nz15GiR5AdraZy4aYQECgFGcl9zRhJIPT3eRQyIZaOWkker2l77i6T8moz WWUj7kaZPIVImQjPGi9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rq891-0000000HOxS-0uOK; Fri, 29 Mar 2024 09:03:27 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rq88v-0000000HOvM-40Hq for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2024 09:03:25 +0000 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20240329090315epoutp0172f283caf1da3709532ca59a3b0141bf~BMM4kX1z20788607886epoutp01Y for ; Fri, 29 Mar 2024 09:03:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20240329090315epoutp0172f283caf1da3709532ca59a3b0141bf~BMM4kX1z20788607886epoutp01Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1711702995; bh=vX1ZmIy4KsaTHCPGAztg5Vs9WgV9OgxLWHoj1r1oYXE=; h=From:To:Cc:Subject:Date:References:From; b=SrVxiFGa8akfytfIz1yX+Vho8vmNwqB50uFqAvfjKvw4ayqzZ9e8uxCca1NahfFz2 nPwseYyuXsx413l4nf0iJWvSm/0Vk9br4ofRpT35RaaYeZfQ9PZutPQ97Gw2AaPEZQ Sq/LLbnXiQivn83o04dFgnAXpfITAB3bgbYRDuxI= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20240329090314epcas2p1f06d978f384f00afcbfe9ddb00f5cc31~BMM4QeIJb1882218822epcas2p11; Fri, 29 Mar 2024 09:03:14 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.100]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4V5ZFG25fhz4x9Q7; Fri, 29 Mar 2024 09:03:14 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 9F.60.08666.1D386066; Fri, 29 Mar 2024 18:03:13 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20240329090313epcas2p2cf95d22e44b6b1c120021622da68aeb8~BMM2hPQd40316503165epcas2p2i; Fri, 29 Mar 2024 09:03:13 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240329090313epsmtrp15c7e69f53459f0207025c0c8d795eab3~BMM2gPMyD3021330213epsmtrp1W; Fri, 29 Mar 2024 09:03:13 +0000 (GMT) X-AuditID: b6c32a43-84dff700000021da-c7-660683d14aee Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 05.C2.19234.0D386066; Fri, 29 Mar 2024 18:03:12 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.55]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240329090312epsmtip1629a5d6fd45db15e32ae9f22f7fede5d~BMM2SSe5u0799507995epsmtip1Z; Fri, 29 Mar 2024 09:03:12 +0000 (GMT) From: Jaewon Kim To: Andi Shyti , Mark Brown , Krzysztof Kozlowski , Alim Akhtar , Sam Protsenko Cc: linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jaewon Kim Subject: [PATCH] spi: s3c64xx: Use DMA mode from fifo size Date: Fri, 29 Mar 2024 17:58:40 +0900 Message-ID: <20240329085840.65856-1-jaewon02.kim@samsung.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjk+LIzCtJLcpLzFFi42LZdljTTPdiM1uawdtj4hYP5m1js7j/tYPR YurDJ2wWOxqOsFrsfb2V3WLT42usFpd3zWGzmHF+H5NF48eb7BbP+/YxOXB5bFrVyeZx59oe No/NS+o9+rasYvT4vEkug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NbOOKLEUZyQaajEXFScCALUXSdEhBAAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFLMWRmVeSWpSXmKPExsWy7bCSnO6FZrY0g51zrS0ezNvGZnH/awej xdSHT9gsdjQcYbXY+3oru8Wmx9dYLS7vmsNmMeP8PiaLxo832S2e9+1jcuDy2LSqk83jzrU9 bB6bl9R79G1ZxejxeZNcAGsUl01Kak5mWWqRvl0CV8aZluXsBde5K/acX8LWwLifs4uRk0NC wERi6v1NrCC2kMB2RoknXxMg4jISy5/1sUHYwhL3W44A1XAB1bxnlHj3fi4jSIJNQFvi+/rF YAkRgRuMEquXP2IBcZgFNjNKtJ8/BzZWWMBK4tviBWA2i4CqxOY735lAbF4BW4kD62FWyEvc PTOLGSIuKHFy5hMWEJsZKN68dTbzBEa+WUhSs5CkFjAyrWIUTS0ozk3PTS4w1CtOzC0uzUvX S87P3cQIDl6toB2My9b/1TvEyMTBeIhRgoNZSYR351GWNCHelMTKqtSi/Pii0pzU4kOM0hws SuK8yjmdKUIC6YklqdmpqQWpRTBZJg5OqQamvRGZl30bTj//qXKGRdXPsJPvhquSbT1bo4iO 6+vP1U92X74u4FfY/IxBOD1M6YZm2bqHc4rYlfYf/f/z07ElVvbnfnZaSBoGKR3zu5U6gWGJ r2+ZmsihV8fVpmzKP+uw9O3vomlN235Kujd6msb1Bf5XSJxf+vZ+dlT4nmt13LnO+2JKz70R 3v9o6TbWtco5yQrxvN3x36s3/N292GTajNeHv1xdXML7ZzP3oj8XD9ZtrmtaaBD+X5j5Yr26 5PM/z56sKtKTvXJeOKfewM5C0FzkbY2vamxvgLnydY87kc832W4zeROtbl56+fyvfSo9rzL6 NhvwXfkz4etV9cuJAlnnX6gvWPFbbpXp+g2nlViKMxINtZiLihMBwF8Dms0CAAA= X-CMS-MailID: 20240329090313epcas2p2cf95d22e44b6b1c120021622da68aeb8 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240329090313epcas2p2cf95d22e44b6b1c120021622da68aeb8 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240329_020323_527278_5BC6E1BB X-CRM114-Status: GOOD ( 20.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If the SPI data size is smaller than FIFO, it operates in PIO mode, and if it is larger than FIFO size, it oerates in DMA mode. If the SPI data size is equal to fifo, it operates in PIO mode and it is separated to 2 transfers. To prevent it, it must operate in DMA mode from the case where the data size and the fifo size are the same. Fixes: 1ee806718d5e ("spi: s3c64xx: support interrupt based pio mode") Signed-off-by: Jaewon Kim Reviewed-by: Sam Protsenko --- drivers/spi/spi-s3c64xx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 9fcbe040cb2f..f726d8670428 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -430,7 +430,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host, struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host); if (sdd->rx_dma.ch && sdd->tx_dma.ch) - return xfer->len > sdd->fifo_depth; + return xfer->len >= sdd->fifo_depth; return false; } @@ -826,10 +826,9 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host, return status; } - if (!is_polling(sdd) && (xfer->len > fifo_len) && + if (!is_polling(sdd) && xfer->len >= fifo_len && sdd->rx_dma.ch && sdd->tx_dma.ch) { use_dma = 1; - } else if (xfer->len >= fifo_len) { tx_buf = xfer->tx_buf; rx_buf = xfer->rx_buf;