linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kurtz <djkurtz@chromium.org>
To: unlisted-recipients:; (no To-header on input)
Cc: adurbin@chromium.org, Daniel Kurtz <djkurtz@chromium.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org (open list:ACPI),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 2/3] ACPI: SPCR: Add support for AMD CT/SZ
Date: Tue, 13 Mar 2018 18:36:54 -0600	[thread overview]
Message-ID: <20180314003655.12141-3-djkurtz@chromium.org> (raw)
In-Reply-To: <20180314003655.12141-1-djkurtz@chromium.org>

AMD Carrizo / Stoneyridge use a DesignWare 8250 UART that uses a special
earlycon setup handler to configure its input clock in order to compute
baud rate divisor registers.
Detect them by examining the OEMID field in the SPCR header, and pass
then pass uart type amdcz to earlycon.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
 drivers/acpi/spcr.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 9d52743080a4..52d840d0e05b 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -73,6 +73,24 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
 	return xgene_8250;
 }
 
+/*
+ * AMD Carrizo / Stoneyridge use a DesignWare 8250 UART that uses a special
+ * earlycon setup handler to configure its input clock in order to compute
+ * baud rate divisor registers.
+ * Detect them by examining the OEM fields in the SPCR header.
+ */
+static bool amdcz_present(struct acpi_table_spcr *tb)
+{
+	if (memcmp(tb->header.oem_id, "AMDCZ ", ACPI_OEM_ID_SIZE))
+		return false;
+
+	if (memcmp(tb->header.oem_table_id, "AMDCZ   ",
+		    ACPI_OEM_TABLE_ID_SIZE))
+		return false;
+
+	return true;
+}
+
 /**
  * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
  *
@@ -189,6 +207,11 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
 			uart = "qdf2400_e44";
 	}
 
+	if (amdcz_present(table)) {
+		if (enable_earlycon)
+			uart = "amdcz";
+	}
+
 	if (xgene_8250_erratum_present(table)) {
 		iotype = "mmio32";
 
-- 
2.16.2.804.g6dcf76e118-goog

  parent reply	other threads:[~2018-03-14  0:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180314003655.12141-1-djkurtz@chromium.org>
2018-03-14  0:36 ` [PATCH 1/3] serial: 8250_early: Add earlycon support for AMD Carrizo / Stoneyridge Daniel Kurtz
2018-03-14 10:35   ` Andy Shevchenko
2018-03-14 10:53   ` Ricardo Ribalda Delgado
2018-03-14 16:29     ` Daniel Kurtz
2018-03-14 16:38       ` Andy Shevchenko
2018-03-14 17:09         ` Aaron Durbin
2018-03-14 17:12         ` Aaron Durbin
2018-03-14 17:31           ` Andy Shevchenko
2018-03-26 18:24           ` Alan Cox
2018-03-27  2:56             ` Aaron Durbin
2018-03-29 13:34               ` Alan Cox
2018-04-01 18:54                 ` Aaron Durbin
2018-04-06 13:47                   ` Alan Cox
2018-04-09 16:00                     ` Aaron Durbin
2018-03-14  0:36 ` Daniel Kurtz [this message]
2018-03-14 10:36   ` [PATCH 2/3] ACPI: SPCR: Add support for AMD CT/SZ Andy Shevchenko
2018-04-17  0:43   ` Jon Masters
2018-03-14  0:36 ` [PATCH 3/3] serial: core: Allow skipping old serial port initialization Daniel Kurtz

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=20180314003655.12141-3-djkurtz@chromium.org \
    --to=djkurtz@chromium.org \
    --cc=adurbin@chromium.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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).