From patchwork Wed Apr 19 06:06:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 13216425 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 DECB8C6FD18 for ; Wed, 19 Apr 2023 06:29:04 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: 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: List-Owner; bh=+YCKM1vyJHFkmQh+FOzT8qffTlqPiotBtHHwyCqJDfM=; b=aMO9ad4YNAWEdM o9WbRFSQ2FtOG+foojUZQpwLlWMP1jfsA7eBPUzVrAM4ZpGwBY3PPSE1XT1u/3CTjwzhXSNaOdwO5 UpBWjVHCoAWSGKz112i7TgOE9RnCIGujO200gyp2Sid57Ei/F08ot7zN9mvAmvOtJPyQ/vKguiZ62 FKlfSURIaBKqmy7se1LEyt1AW5snsCV4IOwyb80C9c3sZTOAVEBXgdixwi8tipdlJjDHFQBqT1hxz u3BRUaPijz2z/mAwcm6ngJR/0PwfW/cuexksQ16pbD9O5Sl42XG9jM8TIyVeSkVovqsPs+OlfbHn6 Dc6YUo3Wn552fmtM2e0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pp1IX-004ETm-34; Wed, 19 Apr 2023 06:28:09 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pp1IS-004ELU-23 for linux-arm-kernel@lists.infradead.org; Wed, 19 Apr 2023 06:28:07 +0000 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230419062757epoutp01daf11ad1c6b91c911f924db3e016ab68~XQhzF1qZJ1108311083epoutp01e for ; Wed, 19 Apr 2023 06:27:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230419062757epoutp01daf11ad1c6b91c911f924db3e016ab68~XQhzF1qZJ1108311083epoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681885677; bh=zBQii4SsEZtzNvLXFRd+FOyaA7s8PZ1eCZ95L8Nnpsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqxrFC4mu3D8OUVkVolOuf3EfE+y3ZRqSm0dZWJYMDqrKUDFkXwoovSAhqX6NxG0A Fp0SVIx5IiaBVuXaLSECffSK2LSb4JwTpyj/Rpschu0zB3cQqgXzdPhV1WsMochntm 05wqvKGYiNmoMvSbPdi8q35A3vv2l4MHFXpCxty0= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230419062756epcas2p4d4a9d2b4a40b21f122c508e269bc07d0~XQhySo0Hg2825128251epcas2p4R; Wed, 19 Apr 2023 06:27:56 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.68]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Q1W7H6ncRz4x9Pt; Wed, 19 Apr 2023 06:27:55 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 59.79.10686.BE98F346; Wed, 19 Apr 2023 15:27:55 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20230419062755epcas2p1bca14bbd5200ebe5241780d2d7ec1596~XQhxU57Zo1254712547epcas2p1E; Wed, 19 Apr 2023 06:27:55 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230419062755epsmtrp237eeea82f6a9201bccaf60ff17503d48~XQhxUF1lW0106901069epsmtrp2R; Wed, 19 Apr 2023 06:27:55 +0000 (GMT) X-AuditID: b6c32a46-ed1f8700000029be-0e-643f89eb7f4f Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id CC.65.08279.BE98F346; Wed, 19 Apr 2023 15:27:55 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.55]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230419062755epsmtip23d3becbdee94c2272c6b2fb646350df1~XQhxJWMMz0489404894epsmtip2s; Wed, 19 Apr 2023 06:27:55 +0000 (GMT) From: Jaewon Kim To: Mark Brown , Krzysztof Kozlowski , Andi Shyti , Alim Akhtar Cc: linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chanho Park , Jaewon Kim Subject: [PATCH v2 3/4] spi: s3c64xx: add sleep during transfer Date: Wed, 19 Apr 2023 15:06:38 +0900 Message-Id: <20230419060639.38853-4-jaewon02.kim@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230419060639.38853-1-jaewon02.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHKsWRmVeSWpSXmKPExsWy7bCmqe7rTvsUg4dzDSwezNvGZrH4x3Mm i6kPn7BZXN6vbbGj4Qirxd7XW9ktNj2+xmpxedccNosZ5/cxWTR+vMnuwOVxfc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p+4KmRzsL/H69kC7TeL 9pgeT1yek6nPdWE+kxJLcUaioRZzUXEiAO8u0ucBBAAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsWy7bCSvO7rTvsUg7sX+SwezNvGZrH4x3Mm i6kPn7BZXN6vbbGj4Qirxd7XW9ktNj2+xmpxedccNosZ5/cxWTR+vMnuwOVxfcknZo9NqzrZ PO5c28PmsXlJvUffllWMHp83yQWwRXHZpKTmZJalFunbJXBlrO9ZxFjwkr2i7elktgbGjWxd jJwcEgImEg//nmLpYuTiEBLYzShxqq+NGSIhI7H8WR9UkbDE/ZYjrBBF7xkllrW1gSXYBLQl vq9fzApiiwgsZZS42S0FUsQscI9R4uWkb0wgCWEBe4knO6eydzFycLAIqEo09cmDhHkFbCV2 ffkNtUxeYvWGA2A2p4CdxMJP18DmCwHV7J73ln0CI98CRoZVjJKpBcW56bnFhgWGeanlesWJ ucWleel6yfm5mxjBoamluYNx+6oPeocYmTgYDzFKcDArifCecbVKEeJNSaysSi3Kjy8qzUkt PsQozcGiJM57oetkvJBAemJJanZqakFqEUyWiYNTqoGJgUEssVXkV3vc98t8xsIWQl4nufnf MXdqd99qdEusj/zE95jzDk/DtsliKcFnTNasOdqgPivhUfrTc6K7Xukaq07cP1laOUVJf7/p 4XMxN+pT2wwsdwTXemyrSZJMnF6lxL5konNkyP0zD/c7pwVP+5v15/4L2Wfd3tdLHzVFm7y9 pbbXJ5hX07+kaZvLqegW7sK2AEUN24tHQ5lE1rx6KvK7uuVrU0z14UMxz/KYJ+zTe/bv7LTm Stuu5YnnDwTe6f9/f5Z/peRqWZ6YlQcMOIu/Hl356pp0t64V19dD6joPHPm9l54T234yUf/E OvtnNcHJXrOset6Ltzq/l13L+fiGxfsyZ0P/uLnGs5RYijMSDbWYi4oTAVVTr968AgAA X-CMS-MailID: 20230419062755epcas2p1bca14bbd5200ebe5241780d2d7ec1596 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230419062755epcas2p1bca14bbd5200ebe5241780d2d7ec1596 References: <20230419060639.38853-1-jaewon02.kim@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_232805_212998_B7A800C8 X-CRM114-Status: GOOD ( 17.86 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In polling mode, the status register is constantly read to check transfer completion. It cause excessive CPU usage. So, it calculates the SPI transfer time and made it sleep. Signed-off-by: Jaewon Kim --- drivers/spi/spi-s3c64xx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 886722fb40ea..cf3060b2639b 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -561,6 +561,14 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd, u32 cpy_len; u8 *buf; int ms; + u32 tx_time; + + /* sleep during signal transfer time */ + status = readl(regs + S3C64XX_SPI_STATUS); + if (RX_FIFO_LVL(status, sdd) < xfer->len) { + tx_time = (xfer->len * 8 * 1000 * 1000) / sdd->cur_speed; + usleep_range(tx_time / 2, tx_time); + } /* millisecs to xfer 'len' bytes @ 'cur_speed' */ ms = xfer->len * 8 * 1000 / sdd->cur_speed;