From patchwork Wed Aug 19 12:32:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 11723879 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAE59138C for ; Wed, 19 Aug 2020 12:33:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 92FBF206FA for ; Wed, 19 Aug 2020 12:33:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="S3/vqXYU"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="jJ9wvAcz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 92FBF206FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YDpzAYQItBM3TXp3J5je8BAGpkgHvEmu0CdxtAVBCaI=; b=S3/vqXYUWYU81X24+TUr/wJUk nE8FmEUGbAQTTqFSyBScjpkz2C1TSEmKzRhC5m4ogdJhJWbV/G7BYOA2mKhSfTwWxXodlJ9k8+Uhb 9BBjFsa8dHl7Lcy/HgEuKV/UWQCOJywrV6FRvf52ID54vAkT2G5Xvyhf6pTCyDo3gjnCBqWEwixHH yRJXa2KmQlYZjP4YjEonHgJBpVZ30+Hli+pjNWIlLDzJBIAObdG6M/w30yk2PqewUSnwlkw51r5LS W/k1DGrPAyM1MAKjcrWFXDaWuVOyg4pFO727KYyzgDa8QMyRJfHBzGCHnRokYH1wufrwkt/lmRm5b axGke5ZvA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NGu-0006us-Sf; Wed, 19 Aug 2020 12:32:52 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NGX-0006ly-Gi for linux-arm-kernel@lists.infradead.org; Wed, 19 Aug 2020 12:32:32 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200819123227euoutp01a7118525f02266ef04380b43bfcd9ae1~sq1SVfOKE2980229802euoutp01b for ; Wed, 19 Aug 2020 12:32:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200819123227euoutp01a7118525f02266ef04380b43bfcd9ae1~sq1SVfOKE2980229802euoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1597840347; bh=bD6acsWiSYtcxnLapp4okxd9iLVm6ou2mGNH7IDBWDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jJ9wvAczDuFORSya0itZUngf79/lqHNTzGFumbhq4LuDfmoRaLdqyOMDv0mEz6qtG NaQIAhHgAUAaMumE9wLYW9vD5khbuVYsLRslGV4ZOd0IPjGLlHRgaT4ICi9NbkljGP QbAXRLQPNdVEeLETWXv9/4Sc3h5PcVr+gIE/3pb0= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200819123227eucas1p21864bf4b7d237f4ffcfa7cbaf126be7a~sq1SBssiJ2958529585eucas1p2S; Wed, 19 Aug 2020 12:32:27 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id C3.FC.05997.BDB1D3F5; Wed, 19 Aug 2020 13:32:27 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200819123226eucas1p2dc50cd60f71f2155524ec21bf4dcdd74~sq1Rsc4hE2428624286eucas1p2J; Wed, 19 Aug 2020 12:32:26 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200819123226eusmtrp1ddbce7041bdae136f2a3618dc98d54ba~sq1Rrw1-W1680116801eusmtrp18; Wed, 19 Aug 2020 12:32:26 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-3d-5f3d1bdb5791 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 3E.63.06017.ADB1D3F5; Wed, 19 Aug 2020 13:32:26 +0100 (BST) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200819123226eusmtip1a68e77ea0c68b513f6c34ad23bfb81bb~sq1RgttCh3139831398eusmtip1Y; Wed, 19 Aug 2020 12:32:26 +0000 (GMT) From: =?utf-8?q?=C5=81ukasz_Stelmach?= To: Kukjin Kim , Krzysztof Kozlowski , Andi Shyti , Mark Brown , linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] spi: spi-s3c64xx: Report more information when errors occur Date: Wed, 19 Aug 2020 14:32:03 +0200 Message-Id: <20200819123208.12337-4-l.stelmach@samsung.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200819123208.12337-1-l.stelmach@samsung.com> MIME-Version: 1.0 Organization: Samsung R&D Institute Poland X-Brightmail-Tracker: H4sIAAAAAAAAA01SfSyUcRzf757nnnscp8ex+Y5K3eqP5KW32WNonRr3V2v9U2y5rjwd6+7o HkRrKC2y8zIvkawUxizhHC6Z1dUQuSu2ZIVulJJMoXG11N3D8t/n9/u8fD/f334kJm7ie5Hx miRGq1GoJIQQb+9Zsfi/8w6T7xlbFNLVy9M8uqW8iU+XWqcIumDyK0ZbLM0CetRUj2j95Bs+ PdxZSdDllm4efeX7qIBufD4mOOQsG6n5gcn0DTcIWWtNhizf0IBkC/qtx/jRwtBYRhWfwmgD D54Wxlm7p/DEfip14aeBn4lKRbnIiQTqAFTZOni5SEiKqXoEtY/H+dxhEcHyyJM1ZgHBSE4e lotIh2VuzsvuFlN1CJ4uRXKaaQT14724nSAoKRTU9jmSPKhCHljNs4SdwKhk0D0yObA7dRxW 2/oEdoxTO6G8a55nxyIqBAZWDAKunw9k13U49E5UKFhtJQSncYMXt6YcwzZRvvDg6gjO5ftA VtttjPOaBTBfJ+XwETB/shIcdoeZ3vX8zTBQrMO5xTKguCjI3hkoHYL2ymWc04TAe7ONsGsw ahc0dQZy11KoNt5CnNUV3n5z4xq4QlF72dpTiSDnuphT74CHBV1rgV6QN1OPCpGkYsMuFRv6 V/yfVYWwBuTJJLNqJcPu0zAXA1iFmk3WKAPOJqj16N83GvjTu2hEnb/PmBBFIomLKNUcIhfz FSlsmtqEgMQkHqLwwYEYsShWkXaJ0SbItckqhjUhbxKXeIr23/9ySkwpFUnMeYZJZLTrLI90 8spEjeHS9KroYOnkh+lWf2X/tYKhEltYoltAUJyv7WSN8cJ89mXVbsUviEwxbYt5FVV6Z7Yy 6vXne2oki9uuy282ZER8xLMjysYYZ/ms9AQRNCqNNQ61PjNvyThXEWZkb4LGL2nYbdXlZfVE 8IRzS9Tho7almcFev6y69Ls9bTpvCc7GKfb6YlpW8Rd2tasGQgMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRmVeSWpSXmKPExsVy+t/xu7q3pG3jDdbOMLJY/OM5k8XGGetZ LaY+fMJm0f/4NbPF+fMb2C1uHlrBaLHp8TVWi8u75rBZzDi/j8mi8eNNdou1R+6yO3B7XF/y idlj06pONo/NS+o9+rasYvT4vEkugDVKz6Yov7QkVSEjv7jEVina0MJIz9DSQs/IxFLP0Ng8 1srIVEnfziYlNSezLLVI3y5BL+PhvicsBacEKj5/28LawDiVt4uRg0NCwETi3TupLkYuDiGB pYwSl3ctZ4aIS0msnJvexcgJZApL/LnWxQZR85RRYt+BeywgCTYBR4n+pSdYQRIiAjOYJJ7c mMwKkmAWKJe4NOs5O8ggYYEAiQMNqiBhFgFViRl7PjCB2LwC1hKnf25hh1ggL9G+fDsbiM0p YCPx8NcUMFsIqKZr8UKoekGJkzOfsICMZBZQl1g/TwgkzC+gJbGm6ToLxFZ5ieats5knMArN QtIxC6FjFpKqBYzMqxhFUkuLc9Nzi430ihNzi0vz0vWS83M3MQJjb9uxn1t2MHa9Cz7EKMDB qMTDW3HOOl6INbGsuDL3EKMEB7OSCK/T2dNxQrwpiZVVqUX58UWlOanFhxhNgd6cyCwlmpwP TAt5JfGGpobmFpaG5sbmxmYWSuK8HQIHY4QE0hNLUrNTUwtSi2D6mDg4pRoYdx6W/yCQYVah /NIvRlsgOixKUvFHwg/R7dtEMra0Tu/h+h36V/3hlt8fJy1PeHDsztxzxXM9XBTyWg+vZBWQ vjRd9vwxz+TE3+0Lk1IOPwr88UQuZOUM6zlG5yyu3NvSuVjmX9IlqVNB85+735n1MPLsrW1H H06+kyha/sfzwA/njLatq+N9C5RYijMSDbWYi4oTASYPkNHTAgAA X-CMS-MailID: 20200819123226eucas1p2dc50cd60f71f2155524ec21bf4dcdd74 X-Msg-Generator: CA X-RootMTR: 20200819123226eucas1p2dc50cd60f71f2155524ec21bf4dcdd74 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200819123226eucas1p2dc50cd60f71f2155524ec21bf4dcdd74 References: <20200819123208.12337-1-l.stelmach@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_083229_910775_62EAF0A6 X-CRM114-Status: GOOD ( 16.65 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.11 listed in wl.mailspike.net] -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.11 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: b.zolnierkie@samsung.com, =?utf-8?q?=C5=81ukasz_Stelmach?= , m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Report amount of pending data when a transfer stops due to errors. Report if DMA was used to transfer data and print the status code. Signed-off-by: Ɓukasz Stelmach Reviewed-by: Krzysztof Kozlowski --- drivers/spi/spi-s3c64xx.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 8fe44451d303..4ab68cd1b821 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -122,6 +122,7 @@ struct s3c64xx_spi_dma_data { struct dma_chan *ch; + dma_cookie_t cookie; enum dma_transfer_direction direction; }; @@ -297,7 +298,7 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, desc->callback = s3c64xx_spi_dmacb; desc->callback_param = dma; - dmaengine_submit(desc); + dma->cookie = dmaengine_submit(desc); dma_async_issue_pending(dma->ch); } @@ -692,17 +693,28 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, if (status) { dev_err(&spi->dev, - "I/O Error: rx-%d tx-%d res:rx-%c tx-%c len-%d\n", + "I/O Error: rx-%d tx-%d rx-%c tx-%c len-%d dma-%d res-(%d)\n", xfer->rx_buf ? 1 : 0, xfer->tx_buf ? 1 : 0, (sdd->state & RXBUSY) ? 'f' : 'p', (sdd->state & TXBUSY) ? 'f' : 'p', - xfer->len); + xfer->len, use_dma ? 1 : 0, status); if (use_dma) { - if (xfer->tx_buf && (sdd->state & TXBUSY)) + struct dma_tx_state s; + + if (xfer->tx_buf && (sdd->state & TXBUSY)) { + dmaengine_pause(sdd->tx_dma.ch); + dmaengine_tx_status(sdd->tx_dma.ch, sdd->tx_dma.cookie, &s); dmaengine_terminate_all(sdd->tx_dma.ch); - if (xfer->rx_buf && (sdd->state & RXBUSY)) + dev_err(&spi->dev, "TX residue: %d\n", s.residue); + + } + if (xfer->rx_buf && (sdd->state & RXBUSY)) { + dmaengine_pause(sdd->rx_dma.ch); + dmaengine_tx_status(sdd->rx_dma.ch, sdd->rx_dma.cookie, &s); dmaengine_terminate_all(sdd->rx_dma.ch); + dev_err(&spi->dev, "RX residue: %d\n", s.residue); + } } } else { s3c64xx_flush_fifo(sdd);