From patchwork Tue May 16 07:45:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yixun Lan X-Patchwork-Id: 9728473 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 3C30C6028A for ; Tue, 16 May 2017 07:46:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BA6928A05 for ; Tue, 16 May 2017 07:46:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EEFA28A09; Tue, 16 May 2017 07:46:16 +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=-0.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 B917C28A05 for ; Tue, 16 May 2017 07:46:15 +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=7kCkVBF1WhXmEWyO5owyPtdT4RJpDooMYOhR1GP2alI=; b=g2N jI7GtKzC0yVHMrNP85QsvjZmQ2SqNsRsVj9SD+i7QhJiv1EOk2UTx8VoPrMEapGNNnBdAMz+W+Lyg p8GZ+ADzqOqUePfAMBoHzaMb1gyNThnrqy+Cm0Bx6yp6GqyS00S5vl6V4qRDra4dEXYa5GLFu8CSZ 2IK1jNmGzf/fOZ6ee3Fg8M+l9txzdfpr+MJJj5PbaL32U8byvSupuQNkPclxR1CUn98W7qcUqzR3c 5ib4d5ZH/hKDT0av99bSc+weem4JJmlxRWtY+PdrSxN9gL9rw/rbrWn4+/mdHrf35OqTh3lFpC4ud 8qmcF+TuIyT44+Hw2CDw7NOMlUUFm5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dAXBO-0006mE-M8; Tue, 16 May 2017 07:46:14 +0000 Received: from mail.gentoo.org ([2001:470:ea4a:1:5054:ff:fec7:86e4] helo=smtp.gentoo.org) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dAXBL-0006jk-4q; Tue, 16 May 2017 07:46:12 +0000 Received: from localhost.localdomain (unknown [58.246.136.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dlan) by smtp.gentoo.org (Postfix) with ESMTPSA id 59CFB3416D8; Tue, 16 May 2017 07:45:46 +0000 (UTC) From: Yixun Lan To: Kevin Hilman , Greg Kroah-Hartman Subject: [PATCH] serial: meson: add Magic SysRq support Date: Tue, 16 May 2017 15:45:29 +0800 Message-Id: <20170516074529.10086-1-dlan@gentoo.org> X-Mailer: git-send-email 2.12.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170516_004611_229136_EA1E86A6 X-CRM114-Status: UNSURE ( 8.44 ) X-CRM114-Notice: Please train this message. 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: Yixun Lan , linux-kernel@vger.kernel.org, Ben Dooks , linux-serial@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org 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 Signed-off-by: Yixun Lan --- 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 60f16795d16b..f0d9222db82f 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);