From patchwork Thu Aug 14 02:42:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Rowand X-Patchwork-Id: 4722011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 637E49F319 for ; Thu, 14 Aug 2014 02:44:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A476201D5 for ; Thu, 14 Aug 2014 02:44:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A8EA201CD for ; Thu, 14 Aug 2014 02:44:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHkzm-0001Bi-M0; Thu, 14 Aug 2014 02:42:30 +0000 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHkzk-00014b-B7 for linux-arm-kernel@lists.infradead.org; Thu, 14 Aug 2014 02:42:28 +0000 Received: by mail-pd0-f170.google.com with SMTP id g10so732204pdj.15 for ; Wed, 13 Aug 2014 19:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=tIfvFpD1ZAlNRppAyqD2mUi0mzdQc1PqUvsMqKIuoLk=; b=oloaO4esTUKf0rQusoczKFWuuMKgFDdv1KCzVuA/IoZtKf5VPoskqAfRQOlnp46K24 i6FrfB4+V7C6HDKTvthmXFE/UjPmlOhGmH+0wYXQLlgTZRtPqH3hpqHx0/Al7gmE3k5h FoU7KPNZU9a8tRPL58fe6fOfm7/UkU2LwLjCZysaEaq75/HBYd3OamYLhYbjdKbrbCnr PVREpEslxRD7Nm+hqJXHMM4/sthpxK8eyU0ull6gzI0TfH8DqLz2kankMqUpz8rIEvkW IefgDL3tf68v/ffWUmVbCom/eo/82IBtrlXRCdNCrvgljAJBL3KlHyALDzL4EvqvW0hF NIOQ== X-Received: by 10.70.43.206 with SMTP id y14mr7550359pdl.11.1407984127353; Wed, 13 Aug 2014 19:42:07 -0700 (PDT) Received: from [172.26.77.103] ([64.211.224.253]) by mx.google.com with ESMTPSA id fy1sm5332628pdb.66.2014.08.13.19.42.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Aug 2014 19:42:06 -0700 (PDT) Message-ID: <53EC21FC.4000204@gmail.com> Date: Wed, 13 Aug 2014 19:42:04 -0700 From: Frank Rowand User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: frowand.list@gmail.com Subject: Re: [PATCH to be tested] serial: msm_serial: add missing sysrq handling References: <53E2C573.7090709@gmail.com> <53EAB01B.5030102@codeaurora.org> <53EC1FEA.5070907@gmail.com> In-Reply-To: <53EC1FEA.5070907@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140813_194228_403771_E6446CFA X-CRM114-Status: GOOD ( 19.33 ) X-Spam-Score: -0.8 (/) Cc: Greg Kroah-Hartman , Stephen Boyd , Linux Kernel list , linux-arm-kernel@lists.infradead.org, "linux-arm-msm@vger.kernel.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: frowand.list@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 8/13/2014 7:33 PM, Frank Rowand wrote: > On 8/12/2014 5:23 PM, Stephen Boyd wrote: >> On 08/06/14 17:16, Frank Rowand wrote: < snip > > The patches you sent are a little hard to read since they modify further code > that my patch modified. So I have redone your patches, as if my patch was > not previously applied. Hopefully I did not make any mistakes there. I will > reply to this email with each of your redone patches. < snip > Stephen's patch alternative number 1: --- drivers/tty/serial/msm_serial.c | 44 ++++++++++++++++++++++++++++------------ drivers/tty/serial/msm_serial.h | 8 +++++++ 2 files changed, 39 insertions(+), 13 deletions(-) Index: b/drivers/tty/serial/msm_serial.c =================================================================== --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -125,25 +125,28 @@ static void handle_rx_dm(struct uart_por port->icount.rx += count; while (count > 0) { - unsigned int c; + unsigned char buf[4]; + unsigned char *p = buf; + int sysrq, r_count; sr = msm_read(port, UART_SR); if ((sr & UART_SR_RX_READY) == 0) { msm_port->old_snap_state -= count; break; } - c = msm_read(port, UARTDM_RF); - if (sr & UART_SR_RX_BREAK) { - port->icount.brk++; - if (uart_handle_break(port)) - continue; - } else if (sr & UART_SR_PAR_FRAME_ERR) - port->icount.frame++; + readsl(port->membase + UARTDM_RF, p, 1); - /* TODO: handle sysrq */ - tty_insert_flip_string(tport, (char *)&c, - (count > 4) ? 4 : count); - count -= 4; + spin_unlock(&port->lock); + sysrq = uart_handle_sysrq_char(port, buf[0]); + spin_lock(&port->lock); + if (sysrq) { + p++; + count--; + } + r_count = min_t(int, count, sizeof(buf) - sysrq); + if (r_count) + tty_insert_flip_string(tport, p, r_count); + count -= r_count; } spin_unlock(&port->lock); @@ -285,6 +288,17 @@ static irqreturn_t msm_irq(int irq, void misr = msm_read(port, UART_MISR); msm_write(port, 0, UART_IMR); /* disable interrupt */ + if (misr & UART_IMR_RXBREAK_END) { + uart_handle_break(port); + port->icount.brk++; + msm_write(port, UART_CR_CMD_RESET_RXBREAK_END, UART_CR); + } + + if (misr & UART_IMR_PAR_FRAME_ERR) { + port->icount.frame++; + msm_write(port, UART_CR_CMD_RESET_PAR_FRAME_ERR, UART_CR); + } + if (misr & (UART_IMR_RXLEV | UART_IMR_RXSTALE)) { if (msm_port->is_uartdm) handle_rx_dm(port, misr); @@ -491,7 +505,8 @@ static int msm_startup(struct uart_port /* turn on RX and CTS interrupts */ msm_port->imr = UART_IMR_RXLEV | UART_IMR_RXSTALE | - UART_IMR_CURRENT_CTS; + UART_IMR_CURRENT_CTS | UART_IMR_RXBREAK_END | + UART_IMR_PAR_FRAME_ERR; if (msm_port->is_uartdm) { msm_write(port, 0xFFFFFF, UARTDM_DMRX); @@ -566,6 +581,9 @@ static void msm_set_termios(struct uart_ else mr |= UART_MR2_STOP_BIT_LEN_ONE; + mr |= UART_MR2_RX_BREAK_ZERO_CHAR_OFF; + mr |= UART_MR2_RX_ERROR_CHAR_OFF; + /* set parity, bits per char, and stop bit */ msm_write(port, mr, UART_MR2); Index: b/drivers/tty/serial/msm_serial.h =================================================================== --- a/drivers/tty/serial/msm_serial.h +++ b/drivers/tty/serial/msm_serial.h @@ -24,6 +24,8 @@ #define UART_MR1_CTS_CTL (1 << 6) #define UART_MR2 0x0004 +#define UART_MR2_RX_ERROR_CHAR_OFF (1 << 9) +#define UART_MR2_RX_BREAK_ZERO_CHAR_OFF (1 << 8) #define UART_MR2_ERROR_MODE (1 << 6) #define UART_MR2_BITS_PER_CHAR 0x30 #define UART_MR2_BITS_PER_CHAR_5 (0x0 << 4) @@ -65,6 +67,9 @@ #define UART_CR_TX_ENABLE (1 << 2) #define UART_CR_RX_DISABLE (1 << 1) #define UART_CR_RX_ENABLE (1 << 0) +#define UART_CR_CMD_RESET_RXBREAK_START ((1 << 11) | (2 << 4)) +#define UART_CR_CMD_RESET_RXBREAK_END ((1 << 11) | (3 << 4)) +#define UART_CR_CMD_RESET_PAR_FRAME_ERR ((1 << 11) | (4 << 4)) #define UART_IMR 0x0014 #define UART_IMR_TXLEV (1 << 0) @@ -72,6 +77,9 @@ #define UART_IMR_RXLEV (1 << 4) #define UART_IMR_DELTA_CTS (1 << 5) #define UART_IMR_CURRENT_CTS (1 << 6) +#define UART_IMR_RXBREAK_START (1 << 10) +#define UART_IMR_RXBREAK_END (1 << 11) +#define UART_IMR_PAR_FRAME_ERR (1 << 12) #define UART_IPR_RXSTALE_LAST 0x20 #define UART_IPR_STALE_LSB 0x1F