Page MenuHomeFreeBSD

D14515.id39826.diff
No OneTemporary

D14515.id39826.diff

Index: head/sys/dev/uart/uart_dev_pl011.c
===================================================================
--- head/sys/dev/uart/uart_dev_pl011.c
+++ head/sys/dev/uart/uart_dev_pl011.c
@@ -36,7 +36,9 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
+
#include <machine/bus.h>
+#include <machine/machdep.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_cpu.h>
@@ -56,6 +58,14 @@
#include <sys/kdb.h>
+#ifdef __aarch64__
+#define IS_FDT (arm64_bus_method == ARM64_BUS_FDT)
+#elif defined(FDT)
+#define IS_FDT 1
+#else
+#error Unsupported configuration
+#endif
+
/* PL011 UART registers and masks*/
#define UART_DR 0x00 /* Data register */
#define DR_FE (1 << 8) /* Framing error */
@@ -447,11 +457,10 @@
return (0);
}
+#ifdef FDT
static int
-uart_pl011_bus_probe(struct uart_softc *sc)
+uart_pl011_bus_hwrev_fdt(struct uart_softc *sc)
{
- uint8_t hwrev;
-#ifdef FDT
pcell_t node;
uint32_t periphid;
@@ -467,19 +476,32 @@
*/
if (ofw_bus_is_compatible(sc->sc_dev, "brcm,bcm2835-pl011") ||
ofw_bus_is_compatible(sc->sc_dev, "broadcom,bcm2835-uart")) {
- hwrev = 2;
+ return (2);
} else {
node = ofw_bus_get_node(sc->sc_dev);
if (OF_getencprop(node, "arm,primecell-periphid", &periphid,
sizeof(periphid)) > 0) {
- hwrev = (periphid >> 20) & 0x0f;
- } else {
- hwrev = __uart_getreg(&sc->sc_bas, UART_PIDREG_2) >> 4;
+ return ((periphid >> 20) & 0x0f);
}
}
-#else
- hwrev = __uart_getreg(&sc->sc_bas, UART_PIDREG_2) >> 4;
+
+ return (-1);
+}
#endif
+
+static int
+uart_pl011_bus_probe(struct uart_softc *sc)
+{
+ int hwrev;
+
+ hwrev = -1;
+#ifdef FDT
+ if (IS_FDT)
+ hwrev = uart_pl011_bus_hwrev_fdt(sc);
+#endif
+ if (hwrev < 0)
+ hwrev = __uart_getreg(&sc->sc_bas, UART_PIDREG_2) >> 4;
+
if (hwrev <= 2) {
sc->sc_rxfifosz = FIFO_RX_SIZE_R2;
sc->sc_txfifosz = FIFO_TX_SIZE_R2;

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 11, 1:22 PM (10 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31293086
Default Alt Text
D14515.id39826.diff (1 KB)

Event Timeline