From be3b046ce89493d52c33fb83d03f9e0ae88a44a1 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Tue, 7 Apr 2015 15:12:03 +0000 Subject: [PATCH] Get the fdt uart driver working on arm64, there is no machine/fdt.h, and the default shift should be 2 for the SoCs we support. Sponsored by: The FreeBSD Foundation --- sys/dev/uart/uart_bus_fdt.c | 8 +++++++- sys/dev/uart/uart_cpu_fdt.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_bus_fdt.c b/sys/dev/uart/uart_bus_fdt.c index 918c892976b2..5f0bb24ccfb5 100644 --- a/sys/dev/uart/uart_bus_fdt.c +++ b/sys/dev/uart/uart_bus_fdt.c @@ -83,10 +83,16 @@ uart_fdt_get_clock(phandle_t node, pcell_t *cell) int uart_fdt_get_shift(phandle_t node, pcell_t *cell) { +#ifdef __aarch64__ +#define DEFAULT_SHIFT 2 +#else +#define DEFAULT_SHIFT 0 +#endif if ((OF_getencprop(node, "reg-shift", cell, sizeof(*cell))) <= 0) - *cell = 0; + *cell = DEFAULT_SHIFT; return (0); +#undef DEFAULT_SHIFT } static uintptr_t diff --git a/sys/dev/uart/uart_cpu_fdt.c b/sys/dev/uart/uart_cpu_fdt.c index 6f6ebda3873e..dc00fe8a70e6 100644 --- a/sys/dev/uart/uart_cpu_fdt.c +++ b/sys/dev/uart/uart_cpu_fdt.c @@ -42,7 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef __aarch64__ #include +#endif #include #include @@ -52,6 +54,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __aarch64__ +extern bus_space_tag_t fdtbus_bs_tag; +#endif + /* * UART console routines. */