From patchwork Tue Nov 16 11:20:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12692740 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C1E2C433F5 for ; Tue, 16 Nov 2021 11:24:07 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 12D39619E8 for ; Tue, 16 Nov 2021 11:24:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 12D39619E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References: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=VrAeWhvLuz1nerTXdAAuvAJn3hUCxHpR0kzrF0TD3n4=; b=WabsL2/wAifzb/ dQdPJpLnIxOLdrGq+zO6X3slwQ0PZrP6ajg35/akNgAcdmmEVzGBMmAXXNu1Rv4zSkaznxo1wakWA ZRky4I1YTdmYysuvkGx4yQKNwH9fHBLzqe/k3+4z38fy/pFbtklPxPZ3KYsf6l/OjoY1qwWBPEd2q RKMM4BgnXDf5LB1GHt5tzl+unD59DNqpxkxiSCcVFY+2SCJ58S0nRpNJYfYaqLIK1QBb93UOwwQQs xMamA8//xr5lWoyJ+wHfMYXIEv45vNY8h6yyoOohPV3BF3gz0nTtlEjLAhYU61F5qEY5xrEUR++Ef T/bdJHvMdzFgo7reR5Ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmwXu-001OYU-DD; Tue, 16 Nov 2021 11:22:38 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmwWE-001O1Z-2B for linux-arm-kernel@lists.infradead.org; Tue, 16 Nov 2021 11:20:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1637061654; x=1668597654; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7030hvhk+GyvGFoZdT8hEUR+asnDYZB5TD3r6ASNYf8=; b=mphiBJUYtn6A5QqN4jYb4cvxrOwqR9tOYC8HTQMp+SxEUXvXxe6+zOqV USlYyrVV2RPdLdm78AzFRe/QFq4GR5oZJ0PCsqQO4+T0Hgwpuq4v1pDqO 31YWleFvVpaPXBsC4W/nczPKC6M2cvA5qxgZ4p+Dbmkm6LAwkFmo5aSSK SKG+jeAlbZfer7OcGr7xLB90lpe1q2n9juLcujDaQ54228dbFeEE3m6u8 R/xg6bNS0AgS8MRfmrecPykJJx1lMHBoHige7JcOSt9e78U+2WUOMdIF/ OTj4QTTYj+tBGDnPI7/MHgAuL7tUZ1ZSohpAWbDTBuFxcN67PIldFOjpW w==; IronPort-SDR: vP4IylrDmpr41BZ0h9LqOX4oYD4f/RLAgj6VzjZ+gMpavYHlc81Un63nhcsYlM2XPxcEvKsbMK i4v68XL3MUM1NfObDxUdnJoEPOBCmc/UgFYJ6paBjsxfvE7+qGuZfa51udfG+SwkaVaOU9Ff74 LlicIewnJGYIf76z2Ppjb3SYiVdDqP5DDKNlLCSjAMmBmTPf4zBr/P2METbN4Lh9MRkieXgbBh pXOYt5JhC6PT9/HxNVNkyNzn8/aCmSQME9qQqpWyIspUgJi1mZGm8hZj49GbCcfheuDceiXEt3 SWqBAexBtnZJgKADTUStv431 X-IronPort-AV: E=Sophos;i="5.87,239,1631602800"; d="scan'208";a="139277971" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Nov 2021 04:20:53 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 16 Nov 2021 04:20:52 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 16 Nov 2021 04:20:49 -0700 From: Tudor Ambarus To: , , , , Subject: [PATCH 03/13] tty: serial: atmel: Call dma_async_issue_pending() Date: Tue, 16 Nov 2021 13:20:26 +0200 Message-ID: <20211116112036.96349-4-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116112036.96349-1-tudor.ambarus@microchip.com> References: <20211116112036.96349-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_032054_222057_38BCC230 X-CRM114-Status: GOOD ( 12.56 ) 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: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , mripard@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver wrongly assummed that tx_submit() will start the transfer, which is not the case, now that the at_xdmac driver is fixed. tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending to be called. issue_pending must start the transfer, not tx_submit. While touching atmel_prepare_rx_dma(), introduce a local variable for the RX dma channel. Fixes: 34df42f59a60 ("serial: at91: add rx dma support") Fixes: 08f738be88bb ("serial: at91: add tx dma support") Signed-off-by: Tudor Ambarus --- drivers/tty/serial/atmel_serial.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 376f7a9c2868..b3e593f3c17f 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1009,6 +1009,8 @@ static void atmel_tx_dma(struct uart_port *port) atmel_port->cookie_tx); return; } + + dma_async_issue_pending(chan); } if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -1191,6 +1193,7 @@ static void atmel_rx_from_dma(struct uart_port *port) static int atmel_prepare_rx_dma(struct uart_port *port) { struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); + struct dma_chan *chan_rx; struct device *mfd_dev = port->dev->parent; struct dma_async_tx_descriptor *desc; dma_cap_mask_t mask; @@ -1203,11 +1206,13 @@ static int atmel_prepare_rx_dma(struct uart_port *port) dma_cap_zero(mask); dma_cap_set(DMA_CYCLIC, mask); - atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx"); - if (atmel_port->chan_rx == NULL) + chan_rx = dma_request_slave_channel(mfd_dev, "rx"); + if (chan_rx == NULL) goto chan_err; + atmel_port->chan_rx = chan_rx; + dev_info(port->dev, "using %s for rx DMA transfers\n", - dma_chan_name(atmel_port->chan_rx)); + dma_chan_name(chan_rx)); spin_lock_init(&atmel_port->lock_rx); sg_init_table(&atmel_port->sg_rx, 1); @@ -1239,8 +1244,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port) config.src_addr = port->mapbase + ATMEL_US_RHR; config.src_maxburst = 1; - ret = dmaengine_slave_config(atmel_port->chan_rx, - &config); + ret = dmaengine_slave_config(chan_rx, &config); if (ret) { dev_err(port->dev, "DMA rx slave configuration failed\n"); goto chan_err; @@ -1249,7 +1253,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port) * Prepare a cyclic dma transfer, assign 2 descriptors, * each one is half ring buffer size */ - desc = dmaengine_prep_dma_cyclic(atmel_port->chan_rx, + desc = dmaengine_prep_dma_cyclic(chan_rx, sg_dma_address(&atmel_port->sg_rx), sg_dma_len(&atmel_port->sg_rx), sg_dma_len(&atmel_port->sg_rx)/2, @@ -1269,12 +1273,14 @@ static int atmel_prepare_rx_dma(struct uart_port *port) goto chan_err; } + dma_async_issue_pending(chan_rx); + return 0; chan_err: dev_err(port->dev, "RX channel not available, switch to pio\n"); atmel_port->use_dma_rx = false; - if (atmel_port->chan_rx) + if (chan_rx) atmel_release_rx_dma(port); return -EINVAL; }