From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_NEOMUTT 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 7CB2FECE561 for ; Thu, 20 Sep 2018 07:55:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42B1920880 for ; Thu, 20 Sep 2018 07:55:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42B1920880 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731595AbeITNhe (ORCPT ); Thu, 20 Sep 2018 09:37:34 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:40439 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeITNhe (ORCPT ); Thu, 20 Sep 2018 09:37:34 -0400 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2tnu-0004fx-RM; Thu, 20 Sep 2018 09:55:14 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1g2tnt-0008Tg-F6; Thu, 20 Sep 2018 09:55:13 +0200 Date: Thu, 20 Sep 2018 09:55:13 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Robin Gong Cc: jslaby@suse.com, fugang.duan@nxp.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de Subject: Re: [PATCH v1] tty: serial: imx: enable IDDMAEN for the last tail data Message-ID: <20180920075513.6jqfbrrjax3sp4cn@pengutronix.de> References: <1537457160-10792-1-git-send-email-yibin.gong@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1537457160-10792-1-git-send-email-yibin.gong@nxp.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Thu, Sep 20, 2018 at 11:26:00PM +0800, Robin Gong wrote: > enable IDDMAEN in UCR4 to let sdma script has the chance to detect > the idle status and transfer the last tail data with the interrupt > notifying uart driver.Otherwise, the last dma done interrupt of the > tail data in rxfifo whose size is less than watermark may never be > received by uart driver. Is this a theoretic issue? Or does it fix a real problem? If the former I'd say UCR1_ATDMAEN being set should prevent this stall. Also I'd say the SDMA scripts I know don't properly handle the IDDMA request. Best regards Uwe > Signed-off-by: Robin Gong > --- > drivers/tty/serial/imx.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 239c0fa..bbb1693 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -1278,7 +1278,7 @@ static int imx_uart_dma_init(struct imx_port *sport) > > static void imx_uart_enable_dma(struct imx_port *sport) > { > - u32 ucr1; > + u32 ucr1, ucr4; > > imx_uart_setup_ufcr(sport, TXTL_DMA, RXTL_DMA); > > @@ -1287,18 +1287,26 @@ static void imx_uart_enable_dma(struct imx_port *sport) > ucr1 |= UCR1_RXDMAEN | UCR1_TXDMAEN | UCR1_ATDMAEN; > imx_uart_writel(sport, ucr1, UCR1); > > + ucr4 = imx_uart_readl(sport, UCR4); > + ucr4 |= UCR4_IDDMAEN; > + imx_uart_writel(sport, ucr4, UCR4); > + > sport->dma_is_enabled = 1; > } > > static void imx_uart_disable_dma(struct imx_port *sport) > { > - u32 ucr1; > + u32 ucr1, ucr4; > > /* clear UCR1 */ > ucr1 = imx_uart_readl(sport, UCR1); > ucr1 &= ~(UCR1_RXDMAEN | UCR1_TXDMAEN | UCR1_ATDMAEN); > imx_uart_writel(sport, ucr1, UCR1); > > + ucr4 = imx_uart_readl(sport, UCR4); > + ucr4 &= ~UCR4_IDDMAEN; > + imx_uart_writel(sport, ucr4, UCR4); > + > imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); > > sport->dma_is_enabled = 0; > -- > 2.7.4 > > -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |