From patchwork Sat Feb 24 02:27:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 10240167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BEE7960390 for ; Sat, 24 Feb 2018 02:28:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACF9829ABD for ; Sat, 24 Feb 2018 02:28:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0FA529B43; Sat, 24 Feb 2018 02:28:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 05DC429ABD for ; Sat, 24 Feb 2018 02:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=admCEWyYZ1gtU1xX17h+ZMisP1yoWpzMSJtKSP/eHa8=; b=cCS QIf86sa6Ve3IYeKZwo0XfSCaUzXLEStEvfWRjG6LE1hCD/gmDj8qkLAJMzltr07Hs7UPwnnrOdP23 47fOqtLfBSONnVQhaUDkDjEzvDwmU3am6c2K+dLK4ZUD8zaoKpetoCUKv3SmSrzCpW4IglYoG6NoS q0gNBFvoyEIoVhne1iIQ2ITPryvZ9oBBq5So+UDVHcdrA73fvaNyiyFWQSAok78OBRlnF9lpUlw8T 56IMj78XG0JEIN4V2dXx6XJ9kgN091BGVmxszfdS5Sn6jIEu7izw5lPlneVsqz/GBOobIH3GpBJxd kC6KzriuyPvXrtJdz34ZHQ5jvKL+T9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1epPZY-00049q-NR; Sat, 24 Feb 2018 02:28:24 +0000 Received: from mail-ot0-x241.google.com ([2607:f8b0:4003:c0f::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1epPZV-000482-1j for linux-arm-kernel@lists.infradead.org; Sat, 24 Feb 2018 02:28:22 +0000 Received: by mail-ot0-x241.google.com with SMTP id 108so3069044otv.3 for ; Fri, 23 Feb 2018 18:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Tgau+H5+Z7RasTIq/om7WpoC4X9id5QHUW5+T9uYxX8=; b=fp7uI3GpC11g211mTjitjfCQrOtEu1R/ngMTW7S2IcyhU1hnNDCD59OqyUkVMmns9E pZancXe6ymO0v0QK50gVIyvz4Cy6+JK1z0s/BfEfXHdYBVn+eXkfDzzFLOzcL3j7x9e+ hcE0UTybgm2iadvsXoulqbEK/X2dGrTeImLNKBLxMxi7gPIUjI2o5sH2MOsgPHxNhyXd kV/roefUJcowhLopOkjxy6vt8H9F4Lh/mQ3BXYYu7eHIJf0tx1Qqs8Y7Od7l7LbVPCW4 xlO2ju21J1UKl7hVp6cLjTJObxVHGSKabM2NBov0rvUlmriXjOAIicFpo1z/Vc9F6qoQ 7NWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Tgau+H5+Z7RasTIq/om7WpoC4X9id5QHUW5+T9uYxX8=; b=nB89Nesa8YgCN1GV30QZZp595SpWvk4WeSIFG87uuUE7MJu/n40UdL+VyMoZM2Q/jp 7WH+oZ4BDp4comx9l9bfoyaehnkFMy1/0TBYJ4n1hQ+JVRLsALEPjx3y9fAIN1zOyYZy 7R8Aq1K4PtxYHlwefOm+9u7R22IEdtU0xi/Jx41CLzgyVkCl4N5sd96W/R66814H90/8 PpsCMnft+Po1V7zdlU7MwShB1OuDggj02g6GC4lZ3K+2Y8PG4h6FCwl0/gIxUY9n6PuE E9rpY4oXkOvVJcD2CnnNVjpYNJ9gz+U9qYlfmUamHvV10U903wMDj5fp5aD7wcHzTbz1 o9gA== X-Gm-Message-State: APf1xPAwd6WaHqdt9TX/SpPNiHEU1P56Fb0+tB2aijJWpQDY9Us9BjNR BtkIUW4OdycXD/2VSRg9be2qCw== X-Google-Smtp-Source: AG47ELvydBp37s9ORnPdt4EMbiF2J8VExVwx0yElPWVtfXpQJrNTHFnZRo/Pt17xoqgVRyDvu7FRcw== X-Received: by 10.157.15.167 with SMTP id d36mr2642056otd.361.1519439288214; Fri, 23 Feb 2018 18:28:08 -0800 (PST) Received: from localhost.localdomain (wsip-98-189-142-135.oc.oc.cox.net. [98.189.142.135]) by smtp.googlemail.com with ESMTPSA id d45sm2043782otf.72.2018.02.23.18.28.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 18:28:07 -0800 (PST) From: Troy Kisky To: gregkh@linuxfoundation.org Subject: [PATCH v4 1/1] tty: serial: imx: allow breaks to be received when using dma Date: Fri, 23 Feb 2018 18:27:50 -0800 Message-Id: <20180224022750.20942-1-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180223_182821_333709_215DFB4E X-CRM114-Status: GOOD ( 13.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mort@bork.org, Troy Kisky , linux-serial@vger.kernel.org, u.kleine-koenig@pengutronix.de, fabio.estevam@nxp.com, linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This allows me to login after sending a break when service serial-getty@ttymxc0.service is running The "tty_insert_flip_char(port, 0, TTY_BREAK)" in clear_rx_errors fixes this by allowing the higher layers to see a break. Also, call uart_handle_break to handle possible "secure attention key." FYI: Martin said the ROM sdma firmware works with this patch, but external sdma firmware still does not send breaks on a i.mx6UL Signed-off-by: Troy Kisky Tested-by: Martin Hicks Reviewed-by: Fabio Estevam Acked-by: Uwe Kleine-König --- v2: rebase only v3: change commit message as requested by Fabio, add tested-by v4: add uart_handle_break as Uwe requested add Reviewed-by added to commit message --- drivers/tty/serial/imx.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 1d7ca382bc12..ace96283bdb8 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -927,7 +927,6 @@ static void dma_rx_callback(void *data) status = dmaengine_tx_status(chan, (dma_cookie_t)0, &state); if (status == DMA_ERROR) { - dev_err(sport->port.dev, "DMA transaction error.\n"); clear_rx_errors(sport); return; } @@ -1028,6 +1027,7 @@ static int start_rx_dma(struct imx_port *sport) static void clear_rx_errors(struct imx_port *sport) { + struct tty_port *port = &sport->port.state->port; unsigned int status_usr1, status_usr2; status_usr1 = readl(sport->port.membase + USR1); @@ -1036,12 +1036,19 @@ static void clear_rx_errors(struct imx_port *sport) if (status_usr2 & USR2_BRCD) { sport->port.icount.brk++; writel(USR2_BRCD, sport->port.membase + USR2); - } else if (status_usr1 & USR1_FRAMERR) { - sport->port.icount.frame++; - writel(USR1_FRAMERR, sport->port.membase + USR1); - } else if (status_usr1 & USR1_PARITYERR) { - sport->port.icount.parity++; - writel(USR1_PARITYERR, sport->port.membase + USR1); + uart_handle_break(&sport->port); + if (tty_insert_flip_char(port, 0, TTY_BREAK) == 0) + sport->port.icount.buf_overrun++; + tty_flip_buffer_push(port); + } else { + dev_err(sport->port.dev, "DMA transaction error.\n"); + if (status_usr1 & USR1_FRAMERR) { + sport->port.icount.frame++; + writel(USR1_FRAMERR, sport->port.membase + USR1); + } else if (status_usr1 & USR1_PARITYERR) { + sport->port.icount.parity++; + writel(USR1_PARITYERR, sport->port.membase + USR1); + } } if (status_usr2 & USR2_ORE) {