linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksey Makarov <aleksey.makarov@linaro.org>
To: linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org,
	Aleksey Makarov <aleksey.makarov@linaro.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Russell King <linux@arm.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Jiri Slaby <jslaby@suse.com>,
	Robert Moore <robert.moore@intel.com>,
	Lv Zheng <lv.zheng@intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <lenb@kernel.org>,
	devel@acpica.org
Subject: [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c
Date: Mon, 25 Jan 2016 17:45:23 +0600	[thread overview]
Message-ID: <1453722324-22407-4-git-send-email-aleksey.makarov@linaro.org> (raw)
In-Reply-To: <1453722324-22407-1-git-send-email-aleksey.makarov@linaro.org>

Add an implementation of acpi_match() to the pl011 driver.
It allows to check if the console matches one specified with
ACPI SPCR table.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/tty/serial/amba-pl011.c | 14 ++++++++++++++
 include/acpi/actbl2.h           |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 899a771..3f4aa1b 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2189,12 +2189,26 @@ static int __init pl011_console_setup(struct console *co, char *options)
 	return uart_set_options(&uap->port, co, baud, parity, bits, flow);
 }
 
+static int __init pl011_console_acpi_match(struct console *co,
+					   struct acpi_table_spcr *spcr)
+{
+	struct uart_amba_port *uap = amba_ports[co->index];
+
+	if (spcr->interface_type == ACPI_DBG2_ARM_PL011 &&
+	    spcr->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY &&
+	    spcr->serial_port.address == (u64)uap->port.mapbase)
+		return 0;
+
+	return -ENODEV;
+}
+
 static struct uart_driver amba_reg;
 static struct console amba_console = {
 	.name		= "ttyAMA",
 	.write		= pl011_console_write,
 	.device		= uart_console_device,
 	.setup		= pl011_console_setup,
+	.acpi_match	= pl011_console_acpi_match,
 	.flags		= CON_PRINTBUFFER,
 	.index		= -1,
 	.data		= &amba_reg,
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 6e28f54..ce4cb37 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -371,6 +371,10 @@ struct acpi_dbg2_device {
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_ARM_PL011         0x0003
+#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000e
+#define ACPI_DBG2_ARM_DCC           0x000f
+#define ACPI_DBG2_DCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000
 
-- 
2.7.0


  parent reply	other threads:[~2016-01-25 11:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 11:45 [PATCH 0/3] ACPI: parse the SPCR table Aleksey Makarov
2016-01-25 11:45 ` [PATCH 1/3] printk: make preferred_console local static bool Aleksey Makarov
2016-01-25 12:45   ` Joe Perches
2016-01-25 12:51     ` Aleksey Makarov
2016-01-25 13:23       ` Joe Perches
2016-01-25 13:28         ` Aleksey Makarov
2016-01-25 16:14           ` Peter Hurley
2016-01-25 14:24   ` Andy Shevchenko
2016-01-25 14:55     ` Aleksey Makarov
2016-01-25 11:45 ` [PATCH 2/3] ACPI: parse SPCR and enable matching console Aleksey Makarov
2016-01-25 14:14   ` Andy Shevchenko
2016-01-25 15:07     ` Aleksey Makarov
2016-01-25 16:32   ` Peter Hurley
2016-01-27 13:57     ` Aleksey Makarov
2016-01-28  0:45       ` Peter Hurley
2016-01-28 13:23         ` Aleksey Makarov
2016-01-28 19:40           ` Peter Hurley
2016-02-01  9:01   ` Graeme Gregory
2016-02-01  9:13     ` Graeme Gregory
2016-01-25 11:45 ` Aleksey Makarov [this message]
2016-01-25 14:21   ` [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c Andy Shevchenko
2016-01-25 14:22     ` Andy Shevchenko
2016-01-25 15:08       ` Aleksey Makarov
2016-01-25 16:11 ` [PATCH 0/3] ACPI: parse the SPCR table Peter Hurley
2016-01-27 12:17   ` Aleksey Makarov
2016-01-27 13:45     ` One Thousand Gnomes
2016-02-01  5:46       ` Jon Masters
2016-02-10 23:39     ` Al Stone
2016-03-03 20:08       ` Peter Hurley
     [not found]         ` <67709E22-E82E-40BA-A271-2107608F4EF3@redhat.com>
2016-03-04 19:34           ` Peter Hurley
2016-03-04 20:03             ` Peter Hurley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453722324-22407-4-git-send-email-aleksey.makarov@linaro.org \
    --to=aleksey.makarov@linaro.org \
    --cc=devel@acpica.org \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=leif.lindholm@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=lv.zheng@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).