summaryrefslogtreecommitdiffstats
path: root/sys/dev/altera
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2013-01-13 15:08:17 +0000
committerrwatson <rwatson@FreeBSD.org>2013-01-13 15:08:17 +0000
commit315df478c379f5026e9f6303847654dc5a4531a4 (patch)
tree916478c7ce7a865834b4fad835b684a2a97aad6a /sys/dev/altera
parenta6c6825b234352007e68fd40dcff69ebd1f960a1 (diff)
downloadFreeBSD-src-315df478c379f5026e9f6303847654dc5a4531a4.zip
FreeBSD-src-315df478c379f5026e9f6303847654dc5a4531a4.tar.gz
Merge Perforce changeset 219918 to head:
Naive first cut at an FDT bus attachment for the Altera JTAG UART. Sponsored by: DARPA, AFRL
Diffstat (limited to 'sys/dev/altera')
-rw-r--r--sys/dev/altera/jtag_uart/altera_jtag_uart_fdt.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/sys/dev/altera/jtag_uart/altera_jtag_uart_fdt.c b/sys/dev/altera/jtag_uart/altera_jtag_uart_fdt.c
index 2592249..2b1e38d 100644
--- a/sys/dev/altera/jtag_uart/altera_jtag_uart_fdt.c
+++ b/sys/dev/altera/jtag_uart/altera_jtag_uart_fdt.c
@@ -52,21 +52,27 @@ __FBSDID("$FreeBSD$");
#include <dev/altera/jtag_uart/altera_jtag_uart.h>
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
/*
- * Nexus bus attachment for Altera JTAG UARTs. Appropriate for most Altera
- * FPGA SoC-style configurations in which the IP core will be exposed to the
- * processor via a memory-mapped Avalon bus.
+ * FDT bus attachment for Altera JTAG UARTs.
*/
static int
-altera_jtag_uart_nexus_probe(device_t dev)
+altera_jtag_uart_fdt_probe(device_t dev)
{
- device_set_desc(dev, "Altera JTAG UART");
- return (BUS_PROBE_DEFAULT);
+ if (ofw_bus_is_compatible(dev, "altera,jtag_uart-11_0")) {
+ device_set_desc(dev, "Altera JTAG UART");
+ return (BUS_PROBE_DEFAULT);
+ }
+ return (ENXIO);
}
static int
-altera_jtag_uart_nexus_attach(device_t dev)
+altera_jtag_uart_fdt_attach(device_t dev)
{
struct altera_jtag_uart_softc *sc;
int error;
@@ -108,7 +114,7 @@ out:
}
static int
-altera_jtag_uart_nexus_detach(device_t dev)
+altera_jtag_uart_fdt_detach(device_t dev)
{
struct altera_jtag_uart_softc *sc;
@@ -124,20 +130,20 @@ altera_jtag_uart_nexus_detach(device_t dev)
return (0);
}
-static device_method_t altera_jtag_uart_nexus_methods[] = {
- DEVMETHOD(device_probe, altera_jtag_uart_nexus_probe),
- DEVMETHOD(device_attach, altera_jtag_uart_nexus_attach),
- DEVMETHOD(device_detach, altera_jtag_uart_nexus_detach),
+static device_method_t altera_jtag_uart_fdt_methods[] = {
+ DEVMETHOD(device_probe, altera_jtag_uart_fdt_probe),
+ DEVMETHOD(device_attach, altera_jtag_uart_fdt_attach),
+ DEVMETHOD(device_detach, altera_jtag_uart_fdt_detach),
{ 0, 0 }
};
-static driver_t altera_jtag_uart_nexus_driver = {
+static driver_t altera_jtag_uart_fdt_driver = {
"altera_jtag_uart",
- altera_jtag_uart_nexus_methods,
+ altera_jtag_uart_fdt_methods,
sizeof(struct altera_jtag_uart_softc),
};
static devclass_t altera_jtag_uart_devclass;
-DRIVER_MODULE(altera_jtag_uart, nexus, altera_jtag_uart_nexus_driver,
+DRIVER_MODULE(altera_jtag_uart, simplebus, altera_jtag_uart_fdt_driver,
altera_jtag_uart_devclass, 0, 0);
OpenPOWER on IntegriCloud