Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp689702ybl; Fri, 31 Jan 2020 06:19:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwnOI8Ajb1B46hV85HccBKF/sq5bSQfKcfy/nCOgxL9SMJHWk8HTv8PHA4grUk48x+Z+usl X-Received: by 2002:a9d:6a2:: with SMTP id 31mr7702420otx.313.1580480386831; Fri, 31 Jan 2020 06:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580480386; cv=none; d=google.com; s=arc-20160816; b=rftokqtKhZlH6vPhNizDvc/jetKoC99Ot+xOee/EMIr47cPb6RnWjNlcpI9dWb1Gli jBR1VVyzPkHat9lBA1fEwBGvg+i6yz+7BpYuo4tS/VnOj2Py8L+AagC8d2hJueIVMzGy J/QsquegC2D2G1gZt+o2oN6QVSCNqopjnZQv4E4IpfmA+JTdgyOp0zDmGeeXAMj3ZAGm ZWkZxAwFteR+NZErCyvXvN4Cuq6TbVIRwK7qNplKQHg+Oxkiw3AGtqL2Iqx1orN6KVG6 vtVRcNQSog9Li/93717MG/xEud711Q5lclH8MlQjkqG0fy/AqcaEObSgyFowmiOI+01e VKbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=RRvjvKaIDcznORWD7pzM9Yuu5rDxm6DZTIai7ItMTCY=; b=pbTK+WJsu/H5H9MuQPF/p/mryLxvPm1uIxL13ir6jBo8JJ+erpg2QrHodozCisuyia KEkFtglYErDRkSrmFcGemJ3kdJLO+wR15ef6xBrFUJnHAueLNl8jelPROhSdzMMDM/BA s2aEI79oNRkVC3BL5q3A3HD9FNLQpdlry+FRSbyoz7Kmh0DBYQBsZr/64w7PRI79qwqF 8RM1gyhH1bccXhZb5UBL7iTCCsJ/i07jG21rTOFw7NYeiQjM2GH9Lfhh4Pt+sIQdpLEb S50UzAbZAxuMO9AO6Uzl5ddsUqFc5TY8WEZtyKSzXvXuTftfBzQoCAkq3ZeZproio77e 5PTA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si4689202otq.21.2020.01.31.06.19.33; Fri, 31 Jan 2020 06:19:46 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728837AbgAaOSe (ORCPT + 99 others); Fri, 31 Jan 2020 09:18:34 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41966 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728659AbgAaOSe (ORCPT ); Fri, 31 Jan 2020 09:18:34 -0500 Received: by mail-lf1-f67.google.com with SMTP id m30so4970052lfp.8; Fri, 31 Jan 2020 06:18:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RRvjvKaIDcznORWD7pzM9Yuu5rDxm6DZTIai7ItMTCY=; b=T6jG415nP1mUBd8wNeHqU+QhT6oZqvkSw/eXeNsmYrbshiseOUc1RGqBUTl6/uxiuj W/MV0BNqFPe2HU44C/nv+vBF+EPlVgGK3K9bF11acTq0y1CrISeOUXYiBAKAI72edYRq aYXeaW12Mn6L+Rceg6BnOYEnMAOjWYa1mBrbyXu1w8Zc2HM57qY6aoemus1Y6PcSwzxx XBA03yNuJOcI6JMIpl8c+Pf2aV9lJhPoRonaCvNNpFwe/CQ9LlRN6eAInQDmuywZx7BU TkL3cqTQQfrqig/6qAZ3tLbOzHVDpfeI8E4ePmaCPMQ9jr59j1+xzfK8w3gNuqzhWhpH 3q8w== X-Gm-Message-State: APjAAAWN7x9uFf9spSka204+Kzt0cQo4sJ38F0D076KLmDiaMu8HIA5r z/1mUkv/LqhANKbei2GZNXA= X-Received: by 2002:ac2:5499:: with SMTP id t25mr5514058lfk.194.1580480311842; Fri, 31 Jan 2020 06:18:31 -0800 (PST) Received: from xi.terra (c-12aae455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.170.18]) by smtp.gmail.com with ESMTPSA id g25sm4679595ljn.107.2020.01.31.06.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 06:18:31 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1ixX80-0005ok-51; Fri, 31 Jan 2020 15:18:36 +0100 Date: Fri, 31 Jan 2020 15:18:36 +0100 From: Johan Hovold To: Shubhrajyoti Datta Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jslaby@suse.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, Raviteja Narayanam Subject: Re: [PATCH v3] serial: uartps: Add TACTIVE bit in cdns_uart_tx_empty function Message-ID: <20200131141836.GG10381@localhost> References: <1580468685-11373-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1580468685-11373-1-git-send-email-shubhrajyoti.datta@xilinx.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 04:34:45PM +0530, Shubhrajyoti Datta wrote: > From: Raviteja Narayanam > > Make sure that all the bytes are transmitted out of Uart by monitoring > TACTIVE bit as well. > Before setting up baud rate in set termios function, do not wait for > Tx empty as it is taken care by the tty layer if user specified. Since this is two logical changes I suggest you split it in two patches; the first removing the wait from set_termios, and the second adding the TCACTIVE check. > Signed-off-by: Raviteja Narayanam > Signed-off-by: Shubhrajyoti Datta > --- > v3: > removed the wait from the set_termios and added the TACTIVE to cdns_uart_tx_empty > As suggested by Johan. > > drivers/tty/serial/xilinx_uartps.c | 22 +++++----------------- > 1 file changed, 5 insertions(+), 17 deletions(-) > > diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c > index ed2f325..ebd0a74 100644 > --- a/drivers/tty/serial/xilinx_uartps.c > +++ b/drivers/tty/serial/xilinx_uartps.c > @@ -32,7 +32,6 @@ > #define CDNS_UART_NAME "xuartps" > #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */ > #define CDNS_UART_REGISTER_SPACE 0x1000 > -#define TX_TIMEOUT 500000 > > /* Rx Trigger level */ > static int rx_trigger_level = 56; > @@ -656,8 +655,9 @@ static unsigned int cdns_uart_tx_empty(struct uart_port *port) > { > unsigned int status; > > - status = readl(port->membase + CDNS_UART_SR) & > - CDNS_UART_SR_TXEMPTY; > + status = ((readl(port->membase + CDNS_UART_SR) & > + (CDNS_UART_SR_TXEMPTY | > + CDNS_UART_SR_TACTIVE)) == CDNS_UART_SR_TXEMPTY); > return status ? TIOCSER_TEMT : 0; Please rewrite this to avoid some of the line breaks (e.g. split readl() from the test). Johan