All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksey Makarov <aleksey.makarov@linaro.org>
To: linux-acpi@vger.kernel.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Aleksey Makarov <aleksey.makarov@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>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Al Stone <ahs3@redhat.com>,
	Christopher Covington <cov@codeaurora.org>,
	Yury Norov <ynorov@caviumnetworks.com>,
	Peter Hurley <peter@hurleysoftware.com>,
	"Zheng, Lv" <lv.zheng@intel.com>, Len Brown <lenb@kernel.org>,
	Jiri Slaby <jslaby@suse.com>
Subject: [PATCH v4 4/4] serial: pl011: use ACPI SPCR to setup 32-bit access
Date: Mon, 29 Feb 2016 15:02:32 +0300	[thread overview]
Message-ID: <1456747355-15692-5-git-send-email-aleksey.makarov@linaro.org> (raw)
In-Reply-To: <1456747355-15692-1-git-send-email-aleksey.makarov@linaro.org>

Some implementations of ARM SBSA serial port hardware require that access
to the registers should be 32-bit.  Unfortunately, the only way for
the driver to tell if it's the case is to use the data from ACPI SPCR/DBG2
tables.  In this case the value of the 'Interface Type' field of the SPCR
table is ACPI_DBG2_ARM_SBSA_32BIT.

How this value is described in the DBG2 spec:
"(deprecated) ARM SBSA (2.x only) Generic UART supporting only
32-bit accesses"

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/acpi/spcr.c             | 22 ++++++++++++++++++++++
 drivers/tty/serial/amba-pl011.c |  2 ++
 include/linux/acpi.h            |  5 +++++
 3 files changed, 29 insertions(+)

diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index c460cb1..f2e81af 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -18,6 +18,7 @@
 
 static char *options;
 static struct acpi_generic_address address;
+static bool sbsa_32_bit;
 
 static int __init parse_spcr_init(void)
 {
@@ -60,6 +61,7 @@ static int __init parse_spcr_init(void)
 	}
 
 	address = table->serial_port;
+	sbsa_32_bit = table->interface_type == ACPI_DBG2_ARM_SBSA_32BIT;
 
 done:
 	early_acpi_os_unmap_memory((void __iomem *)table, table_size);
@@ -114,3 +116,23 @@ bool acpi_console_check(struct uart_port *uport)
 
 	return false;
 }
+
+/**
+ * acpi_console_sbsa_32bit - Tell if SPCR specifies 32-bit SBSA.
+ *
+ * Some implementations of ARM SBSA serial port hardware require that access
+ * to the registers should be 32-bit.  Unfortunately, the only way for
+ * the driver to tell if it's the case is to use the data from ACPI SPCR/DBG2
+ * tables.  In this case the value of the 'Interface Type' field of the SPCR
+ * table is ACPI_DBG2_ARM_SBSA_32BIT.
+ *
+ * Return: true if access should be 32-bit wide.
+ */
+bool acpi_console_sbsa_32bit(void)
+{
+	if (acpi_disabled || parse_spcr() < 0)
+		return false;
+
+	return sbsa_32_bit;
+}
+EXPORT_SYMBOL(acpi_console_sbsa_32bit);
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 500232a..d9ca3a4 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2541,6 +2541,8 @@ static int sbsa_uart_probe(struct platform_device *pdev)
 		baudrate = 115200;
 	}
 
+	vendor_sbsa.access_32b = acpi_console_sbsa_32bit();
+
 	portnr = pl011_find_free_port();
 	if (portnr < 0)
 		return portnr;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ea0c297..da1eb23 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1007,11 +1007,16 @@ static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
 struct uart_port;
 #ifdef CONFIG_ACPI_SPCR_TABLE
 bool acpi_console_check(struct uart_port *uport);
+bool acpi_console_sbsa_32bit(void);
 #else
 static inline bool acpi_console_check(struct uart_port *uport)
 {
 	return FALSE;
 }
+static inline bool acpi_console_sbsa_32bit(void)
+{
+	return false;
+}
 #endif
 
 #endif	/*_LINUX_ACPI_H*/
-- 
2.7.1

WARNING: multiple messages have this Message-ID (diff)
From: aleksey.makarov@linaro.org (Aleksey Makarov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 4/4] serial: pl011: use ACPI SPCR to setup 32-bit access
Date: Mon, 29 Feb 2016 15:02:32 +0300	[thread overview]
Message-ID: <1456747355-15692-5-git-send-email-aleksey.makarov@linaro.org> (raw)
In-Reply-To: <1456747355-15692-1-git-send-email-aleksey.makarov@linaro.org>

Some implementations of ARM SBSA serial port hardware require that access
to the registers should be 32-bit.  Unfortunately, the only way for
the driver to tell if it's the case is to use the data from ACPI SPCR/DBG2
tables.  In this case the value of the 'Interface Type' field of the SPCR
table is ACPI_DBG2_ARM_SBSA_32BIT.

How this value is described in the DBG2 spec:
"(deprecated) ARM SBSA (2.x only) Generic UART supporting only
32-bit accesses"

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/acpi/spcr.c             | 22 ++++++++++++++++++++++
 drivers/tty/serial/amba-pl011.c |  2 ++
 include/linux/acpi.h            |  5 +++++
 3 files changed, 29 insertions(+)

diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index c460cb1..f2e81af 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -18,6 +18,7 @@
 
 static char *options;
 static struct acpi_generic_address address;
+static bool sbsa_32_bit;
 
 static int __init parse_spcr_init(void)
 {
@@ -60,6 +61,7 @@ static int __init parse_spcr_init(void)
 	}
 
 	address = table->serial_port;
+	sbsa_32_bit = table->interface_type == ACPI_DBG2_ARM_SBSA_32BIT;
 
 done:
 	early_acpi_os_unmap_memory((void __iomem *)table, table_size);
@@ -114,3 +116,23 @@ bool acpi_console_check(struct uart_port *uport)
 
 	return false;
 }
+
+/**
+ * acpi_console_sbsa_32bit - Tell if SPCR specifies 32-bit SBSA.
+ *
+ * Some implementations of ARM SBSA serial port hardware require that access
+ * to the registers should be 32-bit.  Unfortunately, the only way for
+ * the driver to tell if it's the case is to use the data from ACPI SPCR/DBG2
+ * tables.  In this case the value of the 'Interface Type' field of the SPCR
+ * table is ACPI_DBG2_ARM_SBSA_32BIT.
+ *
+ * Return: true if access should be 32-bit wide.
+ */
+bool acpi_console_sbsa_32bit(void)
+{
+	if (acpi_disabled || parse_spcr() < 0)
+		return false;
+
+	return sbsa_32_bit;
+}
+EXPORT_SYMBOL(acpi_console_sbsa_32bit);
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 500232a..d9ca3a4 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2541,6 +2541,8 @@ static int sbsa_uart_probe(struct platform_device *pdev)
 		baudrate = 115200;
 	}
 
+	vendor_sbsa.access_32b = acpi_console_sbsa_32bit();
+
 	portnr = pl011_find_free_port();
 	if (portnr < 0)
 		return portnr;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ea0c297..da1eb23 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1007,11 +1007,16 @@ static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
 struct uart_port;
 #ifdef CONFIG_ACPI_SPCR_TABLE
 bool acpi_console_check(struct uart_port *uport);
+bool acpi_console_sbsa_32bit(void);
 #else
 static inline bool acpi_console_check(struct uart_port *uport)
 {
 	return FALSE;
 }
+static inline bool acpi_console_sbsa_32bit(void)
+{
+	return false;
+}
 #endif
 
 #endif	/*_LINUX_ACPI_H*/
-- 
2.7.1

  parent reply	other threads:[~2016-02-29 12:02 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 12:02 [PATCH v4 0/4] ACPI: parse the SPCR table Aleksey Makarov
2016-02-29 12:02 ` Aleksey Makarov
2016-02-29 12:02 ` [PATCH v4 1/4] ACPI: parse SPCR and enable matching console Aleksey Makarov
2016-02-29 12:02   ` Aleksey Makarov
2016-02-29 13:29   ` Andy Shevchenko
2016-02-29 13:29     ` Andy Shevchenko
2016-02-29 13:47     ` Aleksey Makarov
2016-02-29 13:47       ` Aleksey Makarov
2016-03-17 17:20   ` Timur Tabi
2016-03-17 17:20     ` Timur Tabi
2016-02-29 12:02 ` [PATCH v4 2/4] ACPI: enable ACPI_SPCR_TABLE on ARM64 Aleksey Makarov
2016-02-29 12:02   ` Aleksey Makarov
2016-03-01 15:27   ` Peter Hurley
2016-03-01 15:27     ` Peter Hurley
2016-03-01 17:35     ` Aleksey Makarov
2016-03-01 17:35       ` Aleksey Makarov
2016-03-17 17:20   ` Timur Tabi
2016-03-17 17:20     ` Timur Tabi
2016-03-17 17:20     ` Timur Tabi
2016-02-29 12:02 ` [PATCH v4 3/4] ACPI: add definitions of DBG2 subtypes Aleksey Makarov
2016-02-29 12:02   ` Aleksey Makarov
2016-02-29 12:02 ` Aleksey Makarov [this message]
2016-02-29 12:02   ` [PATCH v4 4/4] serial: pl011: use ACPI SPCR to setup 32-bit access Aleksey Makarov
2016-03-01 15:27 ` [PATCH v4 0/4] ACPI: parse the SPCR table Peter Hurley
2016-03-01 15:27   ` Peter Hurley
2016-03-01 15:31 ` Peter Hurley
2016-03-01 15:31   ` Peter Hurley
2016-03-03 11:59   ` Aleksey Makarov
2016-03-03 11:59     ` Aleksey Makarov
2016-03-03 15:35     ` Peter Hurley
2016-03-03 15:35       ` Peter Hurley
2016-03-04 11:53       ` Aleksey Makarov
2016-03-04 11:53         ` Aleksey Makarov
2016-03-04 15:47         ` Peter Hurley
2016-03-04 15:47           ` Peter Hurley
2016-03-11 16:25           ` Aleksey Makarov
2016-03-11 16:25             ` Aleksey Makarov

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=1456747355-15692-5-git-send-email-aleksey.makarov@linaro.org \
    --to=aleksey.makarov@linaro.org \
    --cc=ahs3@redhat.com \
    --cc=cov@codeaurora.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=peter@hurleysoftware.com \
    --cc=rjw@rjwysocki.net \
    --cc=ynorov@caviumnetworks.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.