Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1686172imm; Thu, 20 Sep 2018 00:56:21 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYg7u9um4lm9G8TznEklA5AlmmdXEO3jVZN8A6RtQC1uaulW0lQKiiWDLONOY1J0+Q9oH9D X-Received: by 2002:a17:902:be07:: with SMTP id r7-v6mr37530759pls.275.1537430181006; Thu, 20 Sep 2018 00:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537430180; cv=none; d=google.com; s=arc-20160816; b=AIKqY8OvAs+rGvmCFl9N8OYBG/5PkLVf/gFTexzvDpprbzeI4A4cu8fVXdcnu+RuEn 9oDjortRJXvzFCA+bJER3qUBo2ezQ+iCLFtlfiB605RncP2411VXUH26eEmFqZkdf/nb S3Ep3dVwQ5q393iGxpkHxcA+cqFEqg7Ejx7THrEbKONEGlGijVuqDsLSceFpk15GQliL kid6f4ObyjZqLEtO6vAlc2tveKiyOvUid79aEgrUOmVXA0A9LfbBuMx+W5JVBJwq61BE nngCEYIqCb8PZhaBcKS7fxl7et35RTa1S/fO9WlA1Tc95kFhD/CUOCAeq+Hthrt5SZZF et5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=b6i9hYX9iGjTYVZB7XmHpkr+hjt326cdnCcQ90NTg4E=; b=O5X11gmOjmWvKLOeT4ZpQJ4ELt8ddSVGXE2jiZHtRkSTkEMajKngtdsNWRi9A9gT/8 iq5/23flxzdLYu6s4y09U793YWRQM1nqsd6NJd0d8EIMA423WMd2ZONPG9tOyDd2yD2i iYTUMDWhIZOcS8e7xGrc2kuEYODNcgGeD3yl+wc52DuyWteZszap1j3YdY6vid8IOfho Qq1xNLizA6GxY/A9yuGGJacFfrSCFuXMtJJ7U1zPZOQPOcwA6UqEV5cTti0Kt3fOR9v0 Mke8Q4vY014C1TOb7NRIFKuYYpXclN7AajUbBCpXPHFodwwlcx+GLSvLV2hNLVN+mhDK fM8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si22674381plb.249.2018.09.20.00.56.05; Thu, 20 Sep 2018 00:56:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731552AbeITNhe (ORCPT + 99 others); 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/ |