Date: Sun, 30 Dec 2012 17:38:41 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 219918 for review Message-ID: <201212301738.qBUHcfjg000245@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@219918?ac=10 Change 219918 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2012/12/30 17:38:37 Naive first cut at an FDT bus attachment for the Altera JTAG UART. Affected files ... .. //depot/projects/ctsrd/beribsd/src/sys/dev/altera/jtag_uart/altera_jtag_uart_fdt.c#2 edit .. //depot/projects/ctsrd/beribsd/src/sys/mips/beri/files.beri#24 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/sys/dev/altera/jtag_uart/altera_jtag_uart_fdt.c#2 (text+ko) ==== @@ -52,21 +52,27 @@ #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 @@ } 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 @@ 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); ==== //depot/projects/ctsrd/beribsd/src/sys/mips/beri/files.beri#24 (text+ko) ==== @@ -1,6 +1,7 @@ # $FreeBSD: src/sys/mips/beri/files.beri,v 1.4 2012/08/26 09:21:59 rwatson Exp $ 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/cfi/cfi_bus_nexus.c optional cfi dev/terasic/de4led/terasic_de4led.c optional terasic_de4led
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212301738.qBUHcfjg000245>