Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp28458rwr; Wed, 19 Apr 2023 02:58:11 -0700 (PDT) X-Google-Smtp-Source: AKy350ZJ6BFV4wu+Z7F171JyOJryB4QHsBW9n2FHzZSxuxXeTq2fxtqwpXSpk6x9DpXGhAbMg0y5 X-Received: by 2002:a05:6a20:3ca5:b0:ee:9272:73f8 with SMTP id b37-20020a056a203ca500b000ee927273f8mr3302421pzj.36.1681898291344; Wed, 19 Apr 2023 02:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681898291; cv=none; d=google.com; s=arc-20160816; b=p2j0I8gBeiZD2ICH/YtUyKIRYIjkbmmHdWEj9UW25GiLgDUU+w3vUWHDHiLCty+98c Uk03LfnuSuUsKj8WShDXpWAQEnKoumFxKKq7d0pUIlva1AFLNehWeD+jvZGCHcSPQBqm NuCBjKPBXt3fOLKNA5hhsPpmC/aJ5+bqSt4aUcMl+prOROJiKeJbWBstJvyAWbqIduPa le1U/uHfyvcleeUzPxDPw0IojCUTD6pWZmm8qCx3yO1mQSd5swUxvGWNfy7Wt6GcD1AT omUc7E4rvmFHdtJ0Mh3WDEZ+2EdkzZeYn6dllEDOTzjqbkppjr4zV48IpoLdhIUZoH92 p7Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:in-reply-to:from:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature :dkim-filter; bh=TQgUzzFFttsU0U0WH50ZEOp7y6GtQknqfcN2eXAxO0I=; b=Ol+j3KsRQw4viv5rdDcMi9otat8HWfCfKjxxYbH9Jthxox6ffFNUbA7cyzz8H0gY88 ciKUVQABUHQYAfJ6+aE16Ipvfa/zozJJ7TxtzE8qu9xB/Khk41LkqulUwSxxX1WGD4Eg cmiGTtHAvlHyNP1eHRyn4SdIkyOms8dTUxiQax+Fp/ytP+ELiYt7VwSs1gfOUcvL70a6 CYquVi769K7XWWrPjYMCm465JATrZT0MNBD+bPRNwLYORZaAxk6DlLG9vdgU3U6v2ORE 7sQF7w38pXXRyQ5TuxBhS8ygvXt29liGhlNVjcn+8WB5ncV5RgJuuCjSftlCzP8Sa+TT TfSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TlL8iAn0; 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=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y185-20020a638ac2000000b0051ba9b9c3f3si1718499pgd.321.2023.04.19.02.58.00; Wed, 19 Apr 2023 02:58:11 -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=@samsung.com header.s=mail20170921 header.b=TlL8iAn0; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232505AbjDSJrm (ORCPT + 99 others); Wed, 19 Apr 2023 05:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232346AbjDSJrk (ORCPT ); Wed, 19 Apr 2023 05:47:40 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4912055AC for ; Wed, 19 Apr 2023 02:47:38 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230419094734epoutp031f5758b2725b34b06160f0f0dc27439a~XTQF6mO5w0649206492epoutp03L for ; Wed, 19 Apr 2023 09:47:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230419094734epoutp031f5758b2725b34b06160f0f0dc27439a~XTQF6mO5w0649206492epoutp03L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681897654; bh=TQgUzzFFttsU0U0WH50ZEOp7y6GtQknqfcN2eXAxO0I=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=TlL8iAn0j7C3I4HJ4bp29fBLBhTAvmmIpOgpRwZFhF6Evc4t9rf94iP0BrrGBmWxM MSAJYXB4lAov5PlYa1tUGYJNn01ceESRemI16XAbS9oh+EcuUjJCxPnbjzXBbTzGRl 2D16quBNVD5VJSxCNyWQApNU/+GOcJph9n0xrwDA= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230419094734epcas2p23b7becb2665b6fa243d2262eab2b2724~XTQFioHZf1376113761epcas2p2O; Wed, 19 Apr 2023 09:47:34 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.91]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Q1bYd5t5Bz4x9Q7; Wed, 19 Apr 2023 09:47:33 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id E6.C5.09938.5B8BF346; Wed, 19 Apr 2023 18:47:33 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20230419094733epcas2p13688d0f9e6fcd935df4c80c9fe75b01f~XTQEho9zV1826618266epcas2p1a; Wed, 19 Apr 2023 09:47:33 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230419094733epsmtrp2369b2a521630a21c988e0ce6f2d64c3a~XTQEgx5mE2196821968epsmtrp2k; Wed, 19 Apr 2023 09:47:33 +0000 (GMT) X-AuditID: b6c32a47-a39ff700000026d2-83-643fb8b58490 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7B.3F.08279.4B8BF346; Wed, 19 Apr 2023 18:47:32 +0900 (KST) Received: from [10.229.8.168] (unknown [10.229.8.168]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230419094732epsmtip1d06255b7dcf03e4f9c51b732e4d0e33f~XTQEQkH2b1590715907epsmtip1w; Wed, 19 Apr 2023 09:47:32 +0000 (GMT) Message-ID: Date: Wed, 19 Apr 2023 18:45:08 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2 4/4] spi: s3c64xx: support interrupt based pio mode Content-Language: en-US To: Krzysztof Kozlowski , Mark Brown , 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 From: Jaewon Kim In-Reply-To: <88e74f8f-feee-159a-3048-736a5ffc13cd@linaro.org> Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMJsWRmVeSWpSXmKPExsWy7bCmme7WHfYpBhte6Fk8mLeNzWLxj+dM FlMfPmGzuLxf22Lv663sFpseX2O1uLxrDpvFjPP7mCwaP95kd+D0uL7kE7PHplWdbB53ru1h 89i8pN6jb8sqRo/Pm+QC2KKybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPIS c1NtlVx8AnTdMnOAblJSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5Be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LIzCtJLcpLzFFi42LZdlhJTnfLDvsUg9WvrSwezNvGZrH4x3Mm i6kPn7BZXN6vbbH39VZ2i02Pr7FaXN41h81ixvl9TBaNH2+yO3B6XF/yidlj06pONo871/aw eWxeUu/Rt2UVo8fnTXIBbFFcNimpOZllqUX6dglcGSc2fGcquChRse7qdZYGxg0iXYwcHBIC JhKrpiZ1MXJxCAnsZpQ4eHcuSxcjJ1BcRmL5sz42CFtY4n7LEVaIopeMErf/f2IGSfAK2Elc PvoVzGYRUJVoWrKcDSIuKHFy5hOwQaIC0RI3ln9jArGFBbwk3h58BWYzC4hL3HoynwlkqIjA YkaJjktv2UEcZoGNjBIrr69nhlj3k1Hi0ZbbYGPZBLQlvq9fzApicwKtvr1rATPEKDOJrq1d jBC2vETz1tnMExiFZiG5ZBaSjbOQtMxC0rKAkWUVo2RqQXFuem6xYYFhXmq5XnFibnFpXrpe cn7uJkZwVGlp7mDcvuqD3iFGJg7GQ4wSHMxKIrxnXK1ShHhTEiurUovy44tKc1KLDzFKc7Ao ifNe6DoZLySQnliSmp2aWpBaBJNl4uCUamDqkXmUdSTE6HjEklSRvhP9FTNiDlyMTkyd0Hb5 d3ph+Ow/7vLus7Ml5gZtMfJM0Y/+9TGh60r/Jjmtcyopqmcvaofm7X928b5lSPENkxVcEYdi V95Y4nrKZP6bp2m/AjexHjz6as7DQ2kMyWm+mzQ2X4up9DbnYy581fc+6aDm/E6nOu+XGteK 7Iv/P/rpM0UnSfxXuNmpv4eThK6WLK4P2XZL8RUH2we1kPMMEd/9TukePNz3fNK288zSTy0n 3t38fLuH8wPxH+ddk7wyvmhHJRRuZJLK+mxem1rx9Uh2k23s9n1fPNfetebe+kHvTecTs9Q3 2pejjteblhhOFtRztSq5XJG/Kf+Vyub/jc5KLMUZiYZazEXFiQB7KksvGQMAAA== X-CMS-MailID: 20230419094733epcas2p13688d0f9e6fcd935df4c80c9fe75b01f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230419062755epcas2p43a1127f4bb28cf1cf3f42e5d3cc597cd References: <20230419060639.38853-1-jaewon02.kim@samsung.com> <20230419060639.38853-5-jaewon02.kim@samsung.com> <88e74f8f-feee-159a-3048-736a5ffc13cd@linaro.org> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 On 23. 4. 19. 17:21, Krzysztof Kozlowski wrote: > On 19/04/2023 08:06, Jaewon Kim wrote: >> Interrupt based pio mode is supported to reduce CPU load. >> If transfer size is larger than 32 byte, it is processed using interrupt. >> >> Signed-off-by: Jaewon Kim >> --- >> drivers/spi/spi-s3c64xx.c | 82 ++++++++++++++++++++++++++++++++------- >> 1 file changed, 67 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c >> index cf3060b2639b..ce1afb9a4ed4 100644 >> --- a/drivers/spi/spi-s3c64xx.c >> +++ b/drivers/spi/spi-s3c64xx.c >> @@ -58,6 +58,8 @@ >> #define S3C64XX_SPI_MODE_BUS_TSZ_HALFWORD (1<<17) >> #define S3C64XX_SPI_MODE_BUS_TSZ_WORD (2<<17) >> #define S3C64XX_SPI_MODE_BUS_TSZ_MASK (3<<17) >> +#define S3C64XX_SPI_MODE_RX_RDY_LVL GENMASK(16, 11) >> +#define S3C64XX_SPI_MODE_RX_RDY_LVL_SHIFT 11 >> #define S3C64XX_SPI_MODE_SELF_LOOPBACK (1<<3) >> #define S3C64XX_SPI_MODE_RXDMA_ON (1<<2) >> #define S3C64XX_SPI_MODE_TXDMA_ON (1<<1) >> @@ -114,6 +116,8 @@ >> >> #define S3C64XX_SPI_TRAILCNT S3C64XX_SPI_MAX_TRAILCNT >> >> +#define S3C64XX_SPI_POLLING_SIZE 32 >> + >> #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) >> #define is_polling(x) (x->cntrlr_info->polling) >> >> @@ -552,10 +556,11 @@ static int s3c64xx_wait_for_dma(struct s3c64xx_spi_driver_data *sdd, >> } >> >> static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd, >> - struct spi_transfer *xfer) >> + struct spi_transfer *xfer, int use_irq) >> { >> void __iomem *regs = sdd->regs; >> unsigned long val; >> + unsigned long time; >> u32 status; >> int loops; >> u32 cpy_len; >> @@ -563,17 +568,24 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd, >> 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); >> - } > You just added this code. Adding and immediately removing it, suggests > this should be one patch. > This code has been moved, not removed. +       if (use_irq) { +               val = msecs_to_jiffies(ms); +               time = wait_for_completion_timeout(&sdd->xfer_completion, val); +               if (!time) +                       return -EIO; +       } else { +               /* 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); +               } +       } + > Best regards, > Krzysztof > > Thanks Jaewon Kim