Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:54 -0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r346228 - head/sys/dev/uart
Message-ID:  <201904151341.x3FDfslJ051685@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Mon Apr 15 13:41:53 2019
New Revision: 346228
URL: https://svnweb.freebsd.org/changeset/base/346228

Log:
  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

Modified:
  head/sys/dev/uart/uart_bus.h
  head/sys/dev/uart/uart_cpu_arm64.c
  head/sys/dev/uart/uart_dev_pl011.c

Modified: head/sys/dev/uart/uart_bus.h
==============================================================================
--- head/sys/dev/uart/uart_bus.h	Mon Apr 15 13:12:54 2019	(r346227)
+++ head/sys/dev/uart/uart_bus.h	Mon Apr 15 13:41:53 2019	(r346228)
@@ -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)

Modified: head/sys/dev/uart/uart_cpu_arm64.c
==============================================================================
--- head/sys/dev/uart/uart_cpu_arm64.c	Mon Apr 15 13:12:54 2019	(r346227)
+++ head/sys/dev/uart/uart_cpu_arm64.c	Mon Apr 15 13:41:53 2019	(r346228)
@@ -153,6 +153,11 @@ uart_cpu_acpi_probe(struct uart_class **classp, bus_sp
 	*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);

Modified: head/sys/dev/uart/uart_dev_pl011.c
==============================================================================
--- head/sys/dev/uart/uart_dev_pl011.c	Mon Apr 15 13:12:54 2019	(r346227)
+++ head/sys/dev/uart/uart_dev_pl011.c	Mon Apr 15 13:41:53 2019	(r346228)
@@ -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);





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904151341.x3FDfslJ051685>