summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2013-12-13 22:48:01 +0000
committerian <ian@FreeBSD.org>2013-12-13 22:48:01 +0000
commitcee3a0f503a32d67b6552bc3b75fa3049844e0b4 (patch)
tree9c27a65dba1875f58bf32c17fba457c2382f805d
parent2b338fd3cf33e292a21262c8da8e5f3025a8eb79 (diff)
downloadFreeBSD-src-cee3a0f503a32d67b6552bc3b75fa3049844e0b4.zip
FreeBSD-src-cee3a0f503a32d67b6552bc3b75fa3049844e0b4.tar.gz
MFC r257556:
Arrange for uart_cpu_fdt's probe() routine to use the same table of compat strings as uart_bus_fdt's probe().
-rw-r--r--sys/dev/uart/uart.h5
-rw-r--r--sys/dev/uart/uart_bus_fdt.c5
-rw-r--r--sys/dev/uart/uart_cpu_fdt.c26
3 files changed, 20 insertions, 16 deletions
diff --git a/sys/dev/uart/uart.h b/sys/dev/uart/uart.h
index 840d783..095d368 100644
--- a/sys/dev/uart/uart.h
+++ b/sys/dev/uart/uart.h
@@ -76,6 +76,11 @@ extern struct uart_class uart_pl011_class __attribute__((weak));
extern struct uart_class uart_cdnc_class __attribute__((weak));
extern struct uart_class uart_ti8250_class __attribute__((weak));
+#ifdef FDT
+struct ofw_compat_data;
+extern const struct ofw_compat_data *uart_fdt_compat_data;
+#endif
+
#ifdef PC98
struct uart_class *uart_pc98_getdev(u_long port);
#endif
diff --git a/sys/dev/uart/uart_bus_fdt.c b/sys/dev/uart/uart_bus_fdt.c
index cb2ce06..39a6a1c 100644
--- a/sys/dev/uart/uart_bus_fdt.c
+++ b/sys/dev/uart/uart_bus_fdt.c
@@ -30,6 +30,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_platform.h"
+
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
@@ -85,6 +87,9 @@ static struct ofw_compat_data compat_data[] = {
{NULL, (uintptr_t)NULL},
};
+/* Export the compat_data table for use by the uart_cpu_fdt.c probe routine. */
+const struct ofw_compat_data *uart_fdt_compat_data = compat_data;
+
static int
uart_fdt_get_clock(phandle_t node, pcell_t *cell)
{
diff --git a/sys/dev/uart/uart_cpu_fdt.c b/sys/dev/uart/uart_cpu_fdt.c
index 230c363..112593f 100644
--- a/sys/dev/uart/uart_cpu_fdt.c
+++ b/sys/dev/uart/uart_cpu_fdt.c
@@ -30,6 +30,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_platform.h"
+
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
@@ -93,6 +95,7 @@ int
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
{
char buf[64];
+ const struct ofw_compat_data *cd;
struct uart_class *class;
phandle_t node, chosen;
pcell_t shift, br, rclk;
@@ -139,22 +142,13 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
/*
* Finalize configuration.
*/
- if (fdt_is_compatible(node, "fsl,imx-uart"))
- class = &uart_imx_class;
- else if (fdt_is_compatible(node, "quicc"))
- class = &uart_quicc_class;
- else if (fdt_is_compatible(node, "lpc"))
- class = &uart_lpc_class;
- else if (fdt_is_compatible(node, "arm,pl011"))
- class = &uart_pl011_class;
- else if (fdt_is_compatible(node, "exynos"))
- class = &uart_s3c2410_class;
- else if (fdt_is_compatible(node, "cadence,uart"))
- class = &uart_cdnc_class;
- else if (fdt_is_compatible(node, "ti,ns16550"))
- class = &uart_ti8250_class;
- else if (fdt_is_compatible(node, "ns16550"))
- class = &uart_ns8250_class;
+ for (cd = uart_fdt_compat_data; cd->ocd_str != NULL; ++cd) {
+ if (fdt_is_compatible(node, cd->ocd_str))
+ break;
+ }
+ if (cd->ocd_str == NULL)
+ return (ENXIO);
+ class = (struct uart_class *)cd->ocd_data;
di->bas.chan = 0;
di->bas.regshft = (u_int)shift;
OpenPOWER on IntegriCloud