@@ -95,3 +95,28 @@ bool acpi_console_check(struct uart_port *uport)
return acpi_table_parse_spcr(spcr_table_handler_check, uport) > 0;
}
+
+static int spcr_table_handler_32_bit(struct acpi_table_spcr *table, void *data)
+{
+ return table->interface_type == ACPI_DBG2_ARM_SBSA_32BIT;
+}
+
+/**
+ * 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)
+ return false;
+
+ return acpi_table_parse_spcr(spcr_table_handler_32_bit, NULL) > 0;
+}
+EXPORT_SYMBOL(acpi_console_sbsa_32bit);
@@ -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;
@@ -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*/
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 | 25 +++++++++++++++++++++++++ drivers/tty/serial/amba-pl011.c | 2 ++ include/linux/acpi.h | 5 +++++ 3 files changed, 32 insertions(+)