From patchwork Fri Sep 17 07:46:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ville Baillie X-Patchwork-Id: 12501325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAAFFC433EF for ; Fri, 17 Sep 2021 07:46:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8EA976113A for ; Fri, 17 Sep 2021 07:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239283AbhIQHre convert rfc822-to-8bit (ORCPT ); Fri, 17 Sep 2021 03:47:34 -0400 Received: from mail.bytesnap.co.uk ([94.198.185.106]:45239 "EHLO mail.bytesnap.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231263AbhIQHre (ORCPT ); Fri, 17 Sep 2021 03:47:34 -0400 Received: from exch2016.ByteSnap.local (10.0.28.253) by exch2016.ByteSnap.local (10.0.28.253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Fri, 17 Sep 2021 08:46:11 +0100 Received: from exch2016.ByteSnap.local ([fe80::fccc:6d14:b55e:d5a0]) by exch2016.ByteSnap.local ([fe80::fccc:6d14:b55e:d5a0%8]) with mapi id 15.01.2308.014; Fri, 17 Sep 2021 08:46:11 +0100 From: Ville Baillie To: "tudor.ambarus@microchip.com" , "broonie@kernel.org" , "nicolas.ferre@microchip.com" , "alexandre.belloni@bootlin.com" , "ludovic.desroches@microchip.com" CC: "linux-spi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "dan.sneddon@microchip.com" , Ville Baillie Subject: [PATCH v2] spi: atmel: Fix PDC transfer setup bug Thread-Topic: [PATCH v2] spi: atmel: Fix PDC transfer setup bug Thread-Index: Aderl75ZSZUU23/3QUKqzWSAzGD4lQ== Date: Fri, 17 Sep 2021 07:46:11 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.27.202] MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org From 7f796c2004407f848f9ed97f406e24b9eadd74be Mon Sep 17 00:00:00 2001 From: Ville Baillie Date: Thu, 16 Sep 2021 14:16:46 +0000 Subject: [PATCH v2] spi: atmel: Fix PDC transfer setup bug Commit 5fa5e6dec762 ("spi: atmel: Switch to transfer_one transfer method") refactored the code and changed a conditional causing atmel_spi_dma_map_xfer to never be called in PDC mode. This causes the driver to silently fail. This patch changes the conditional to match the behaviour of the previous commit before the refactor. Signed-off-by: Ville Baillie Reviewed-by: Dan Sneddon --- drivers/spi/spi-atmel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 788dcdf25f00..f872cf196c2f 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1301,7 +1301,7 @@ static int atmel_spi_one_transfer(struct spi_master *master, * DMA map early, for performance (empties dcache ASAP) and * better fault reporting. */ - if ((!master->cur_msg_mapped) + if ((!master->cur_msg->is_dma_mapped) && as->use_pdc) { if (atmel_spi_dma_map_xfer(as, xfer) < 0) return -ENOMEM; @@ -1381,7 +1381,7 @@ static int atmel_spi_one_transfer(struct spi_master *master, } } - if (!master->cur_msg_mapped + if (!master->cur_msg->is_dma_mapped && as->use_pdc) atmel_spi_dma_unmap_xfer(master, xfer);