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: 9728475 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 3DB086028A for ; Tue, 16 May 2017 07:46:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E73828A05 for ; Tue, 16 May 2017 07:46:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22DA428A09; Tue, 16 May 2017 07:46:31 +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 D8EA228A05 for ; Tue, 16 May 2017 07:46:30 +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=xNAGy9bGlNs9j9s9KJGFq/xywva1bIHQMoU1QOoPkQg=; b=og3 QoTjSMhEhnqpxeh2vEPeOlLxm9A8CJEQvtyolrIgm/agHcOsyrttAqDIsR91NjUNcWZg0N2ebtNjj Qs6iP0FDfx2vIVGy4+BZrfsIZo4Kc+DiK/BxxO+RwAb+E7sHK9DkYLjiThMnhJ6TI4XfwyhN9dT9o MMWs3dgrqn4pKQn529xBbOKohC6Iwl5aGcXO8hIZNYc2q9uCwZR6jhtir+AukYZWdW29oIZ89qY1v 6Clc7FQw0wXdhYtYZ+J9TxqppLvVJ19UAeWpEkM5ebaI+CfaUbbw64DMh82w5xdH0rvgAPeA108kV 5WJgGuQ2zZMWHdfaZgNlAEC3AZc/1VA==; 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 1dAXBN-0006lk-JY; Tue, 16 May 2017 07:46:13 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=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);