From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E7E7C282C2 for ; Thu, 7 Feb 2019 11:27:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B97321872 for ; Thu, 7 Feb 2019 11:27:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UCBu7OPL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="lpGa0Grw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B97321872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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:Cc:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID: References:Date:Subject:To:From:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=+4zUIOpBH8hrauLt9RO2B9gxhvtu5bRjHw8svJzUR3c=; b=UCBu7OPLo+3Ya6 cKuHIneNgyBSbc7804jt5VzZs8IRbUD6itKDyBBHoyBJ/o92B7zpXiBeMtuNdlR5m7uE4GK1QOoXK 3/Fau2jaRUFijMQz1+i7wbFE4EcGQ9wQ2XLro0wC9QflIu8dyP5gsteodKq/w3JYPdR8dcdenPDra rZriQzmmwbUEQDpyOUx7TBXyv6GYqz1h8xa+hSWZi4ASyV11ZEqjwRaAuyIYcCU6n51FsCVFsaXFL fMFRVrJzheqvppFAtG1l2fazboOcUZ0MSz8DDKpuE7U+F5FQW3wx/ROrfHCpeehEgVEyxggZ8Jst2 RevcllGz2THsDyQXNDXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1grhpr-0005Nf-1w; Thu, 07 Feb 2019 11:27:15 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1grhpd-0005CY-GZ for linux-amlogic@lists.infradead.org; Thu, 07 Feb 2019 11:27:03 +0000 Received: by mail-ed1-x543.google.com with SMTP id y56so8658691edd.11 for ; Thu, 07 Feb 2019 03:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:references:reply-to:message-id:mime-version; bh=obC/o0x/Of+oiYvDNo+3FmUgPGJAQl+NE5x85eXAQHI=; b=lpGa0Grw3h/abtMaXn8NhnwSyAc4gkosLOJN3rQecVmu/PUkG6561GanDZRktd8Nca SmSdGAm7PK7OLr+TV0dpGPi2QnPfRciLmalt04YeQub95QaqfKMzO5nMopKi6EA51LaA HHqzvMmE6uovrowLcZJf0bK4COmQu/hZ+bfPRRyVE9vJ8tJkjSc/LYeRHaFXueQ5Pfov MMFTeIH4v1IvyDhmAIWOIqikUDlDabQZvovVAWtgJ8/qAynFQH1PCB6a7bbSIrfjKWVf 7v2rQY2Z66S9UFvsAue90atnXEAbwYSrw/JY08p1V/2cCbKHOUWq4l0DVZqZdXHKM66c gKzA== 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:references:reply-to :message-id:mime-version; bh=obC/o0x/Of+oiYvDNo+3FmUgPGJAQl+NE5x85eXAQHI=; b=ltRcEVYTYObGo+ZphlmCpxPlZahGy5mOXhEH2iVZ0XhBLQcZOUut943Dqv11AFigwk xiwnywkwp5ZMcQN71BXbyYjft6rqkDKtK36+OPbYVEN1qGucqgY8gS4z74Hq/JdraY4V 8Hs3i6Fyjj1+qfoI83teR/PdykqR16eBiXBLYdKXHLQJKQ9uefC1DkzBimSpywQOKcBG 17azR1yblI4a136S1DHdYHnUtkxCCBVvpeNUwIGFk0DB+vz6BK96RpkiBqXNRZ4gO+5/ jPoDrdweUKLWrZlRhOhTYSsx3O6QkU0o788tkpFpy3BGMm1xbaS6EZ8L5ljEsCa9qkmb kDMg== X-Gm-Message-State: AHQUAubIizP+f48gcYGRMYiWPWzvcJ8p5q/o61NzZfzpIAmL1/0sJkGU Xkin15rygLsP8Pyg0WotEWDYdQ== X-Google-Smtp-Source: AHgI3IaacZRmJNMHtyYLIrXWsYmX+kBY4nCl0BEnTm3g+kmpaGvMP3TR483tFqfu5leYPUmmyCMgkg== X-Received: by 2002:aa7:c0c8:: with SMTP id j8mr4962862edp.94.1549538818755; Thu, 07 Feb 2019 03:26:58 -0800 (PST) Received: from localhost ([2620:10d:c092:180::1:a0f9]) by smtp.gmail.com with ESMTPSA id e26sm3239012eja.9.2019.02.07.03.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Feb 2019 03:26:58 -0800 (PST) From: Julien Masson To: Kevin Hilman , Greg Kroah-Hartman Subject: [PATCH 1/2] tty: serial: meson_uart: Add support for kernel debugger Date: Thu, 7 Feb 2019 12:26:16 +0100 References: <86h8dfx2jv.fsf@gmail.com> Message-ID: <86ftszx2im.fsf@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190207_032701_724610_F7911E20 X-CRM114-Status: GOOD ( 10.11 ) 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: , Reply-To: 86h8dfx2jv.fsf@gmail.com Cc: Julien Masson , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Jiri Slaby , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The kgdb invokes the poll_put_char and poll_get_char when communicating with the host. This patch implement the serial polling hooks for the meson_uart to be used for KGDB debugging over serial line. Signed-off-by: Julien Masson --- drivers/tty/serial/meson_uart.c | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index 8a84259..49b20da 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -426,6 +426,48 @@ static void meson_uart_config_port(struct uart_port *port, int flags) } } +#ifdef CONFIG_CONSOLE_POLL +/* + * Console polling routines for writing and reading from the uart while + * in an interrupt or debug context (i.e. kgdb). + */ + +static int meson_uart_poll_get_char(struct uart_port *port) +{ + u32 c; + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + + if (readl(port->membase + AML_UART_STATUS) & AML_UART_RX_EMPTY) + c = NO_POLL_CHAR; + else + c = readl(port->membase + AML_UART_RFIFO); + + spin_unlock_irqrestore(&port->lock, flags); + + return c; +} + +static void meson_uart_poll_put_char(struct uart_port *port, unsigned char c) +{ + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + + while (!(readl(port->membase + AML_UART_STATUS) & AML_UART_TX_EMPTY)) + cpu_relax(); + + writel(c, port->membase + AML_UART_WFIFO); + + while (!(readl(port->membase + AML_UART_STATUS) & AML_UART_TX_EMPTY)) + cpu_relax(); + + spin_unlock_irqrestore(&port->lock, flags); +} + +#endif /* CONFIG_CONSOLE_POLL */ + static const struct uart_ops meson_uart_ops = { .set_mctrl = meson_uart_set_mctrl, .get_mctrl = meson_uart_get_mctrl, @@ -441,6 +483,10 @@ static const struct uart_ops meson_uart_ops = { .request_port = meson_uart_request_port, .release_port = meson_uart_release_port, .verify_port = meson_uart_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = meson_uart_poll_get_char, + .poll_put_char = meson_uart_poll_put_char, +#endif }; #ifdef CONFIG_SERIAL_MESON_CONSOLE -- 2.7.4 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic