From 100bfa3f87451703c4b566036ace27d96485e083 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sun, 13 Jan 2013 15:08:17 +0000 Subject: [PATCH] Merge Perforce changeset 219918 to head: Naive first cut at an FDT bus attachment for the Altera JTAG UART. Sponsored by: DARPA, AFRL --- .../altera/jtag_uart/altera_jtag_uart_fdt.c | 36 +++++++++++-------- sys/mips/beri/files.beri | 1 + 2 files changed, 22 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 25922499058..2b1e38d72fc 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 +#include +#include +#include +#include + /* - * 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); diff --git a/sys/mips/beri/files.beri b/sys/mips/beri/files.beri index 02a27f8e0c5..41bf7d5e317 100644 --- a/sys/mips/beri/files.beri +++ b/sys/mips/beri/files.beri @@ -1,6 +1,7 @@ # $FreeBSD$ dev/altera/jtag_uart/altera_jtag_uart_cons.c optional altera_jtag_uart dev/altera/jtag_uart/altera_jtag_uart_tty.c optional altera_jtag_uart +dev/altera/jtag_uart/altera_jtag_uart_fdt.c optional altera_jtag_uart fdt dev/altera/jtag_uart/altera_jtag_uart_nexus.c optional altera_jtag_uart dev/terasic/de4led/terasic_de4led.c optional terasic_de4led dev/terasic/de4led/terasic_de4led_nexus.c optional terasic_de4led