Merge Perforce changeset 219918 to head:

Naive first cut at an FDT bus attachment for the Altera JTAG UART.

Sponsored by:	DARPA, AFRL
This commit is contained in:
Robert Watson 2013-01-13 15:08:17 +00:00
parent 9d995792df
commit 100bfa3f87
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245365
2 changed files with 22 additions and 15 deletions

View File

@ -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 @@ altera_jtag_uart_nexus_attach(device_t dev)
}
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);

View File

@ -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