Add quirk for ignoring SPCR AccessWidth values on the PL011 UART

The SPCR table on the Lenovo HR330A Ampere eMAG server indicates 8-bit
access, but 32-bit access is required for the PL011 to work.

PL011 on SBSA platforms always supports 32-bit access (and that was
hardcoded here before my EC2 fix), let's use 32-bit access for PL011
and 32BIT interface types.

Tested by emaste on Ampere eMAG and Cavium/Marvell ThunderX2.

Submitted by:	Greg V <greg@unrelenting.technology>
Reviewed by:	andrew, imp (earlier)
Differential Revision:	https://reviews.freebsd.org/D19507
This commit is contained in:
Ed Maste 2019-04-15 13:41:53 +00:00
parent 760e34772c
commit f89f4898a3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346228
3 changed files with 10 additions and 3 deletions

View File

@ -57,7 +57,8 @@
#define UART_IOCTL_BAUD 4
/* UART quirk flags */
#define UART_F_BUSY_DETECT 0x1
#define UART_F_BUSY_DETECT 0x1
#define UART_F_IGNORE_SPCR_REGSHFT 0x2
/*
* UART class & instance (=softc)

View File

@ -153,6 +153,11 @@ uart_cpu_acpi_probe(struct uart_class **classp, bus_space_tag_t *bst,
*shiftp = spcr->SerialPort.AccessWidth - 1;
*iowidthp = spcr->SerialPort.BitWidth / 8;
if ((cd->cd_quirks & UART_F_IGNORE_SPCR_REGSHFT) ==
UART_F_IGNORE_SPCR_REGSHFT) {
*shiftp = cd->cd_regshft;
}
out:
acpi_unmap_table(spcr);
return (err);

View File

@ -342,8 +342,9 @@ UART_FDT_CLASS_AND_DEVICE(fdt_compat_data);
#ifdef DEV_ACPI
static struct acpi_uart_compat_data acpi_compat_data[] = {
{"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_PL011, 2, 0, 0, 0, "uart plo11"},
{"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC, 2, 0, 0, 0, "uart plo11"},
{"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_PL011, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"},
{"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"},
{"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_32BIT, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"},
{NULL, NULL, 0, 0, 0, 0, 0, NULL},
};
UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data);