From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752388AbdJTIKt (ORCPT ); Fri, 20 Oct 2017 04:10:49 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:51231 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751927AbdJTIKo (ORCPT ); Fri, 20 Oct 2017 04:10:44 -0400 X-Google-Smtp-Source: ABhQp+SJ0ydlAL4dMsfGxAhiBCS/is2ZiSanA8v9Zc/uMakks5pPAZVUve4WAww5oFcHZZk+nPcqBw== Subject: Re: [PATCH v2] serial: meson: add Magic SysRq support To: Yixun Lan , Kevin Hilman , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Ben Dooks , linux-serial@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20170906135239.29531-1-dlan@gentoo.org> From: Neil Armstrong Organization: Baylibre Message-ID: Date: Fri, 20 Oct 2017 10:10:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20170906135239.29531-1-dlan@gentoo.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yixun, On 06/09/2017 15:52, Yixun Lan wrote: > This dirver try to implement the Magic SysRq support[1] for > Amlogic Inc's meson platfo Please fix these typos. > From the hardware perspective, the UART IP can't detect the 'BREAK' command > clearly via the status register. Instead, we rely on the combination of > 'FRAME_ERR bit && ch == 0', and it works fine. > > [1] Documentation/admin-guide/sysrq.rst > > Signed-off-by: Yixun Lan > > --- > Changes since v1 at [0]: > - add changelog & a few more comments > > [0] https://patchwork.kernel.org/patch/9728475/ > --- > drivers/tty/serial/meson_uart.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c > index 42e4a4c7597f..3fea24bafd80 100644 > --- a/drivers/tty/serial/meson_uart.c > +++ b/drivers/tty/serial/meson_uart.c > @@ -14,6 +14,10 @@ > * > */ > > +#if defined(CONFIG_SERIAL_MESON_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) > +#define SUPPORT_SYSRQ > +#endif > + > #include > #include > #include > @@ -183,12 +187,12 @@ static void meson_receive_chars(struct uart_port *port) > { > struct tty_port *tport = &port->state->port; > char flag; > - u32 status, ch, mode; > + u32 ostatus, status, ch, mode; > > do { > flag = TTY_NORMAL; > port->icount.rx++; > - status = readl(port->membase + AML_UART_STATUS); > + ostatus = status = readl(port->membase + AML_UART_STATUS); > > if (status & AML_UART_ERR) { > if (status & AML_UART_TX_FIFO_WERR) > @@ -216,6 +220,16 @@ static void meson_receive_chars(struct uart_port *port) > ch = readl(port->membase + AML_UART_RFIFO); > ch &= 0xff; > > + if ((ostatus & AML_UART_FRAME_ERR) && (ch == 0)) { > + port->icount.brk++; > + flag = TTY_BREAK; > + if (uart_handle_break(port)) > + continue; > + } > + > + if (uart_handle_sysrq_char(port, ch)) > + continue; > + > if ((status & port->ignore_status_mask) == 0) > tty_insert_flip_char(tport, ch, flag); > > Reviewed-by: Neil Armstrong