2 * Copyright 2003-2011 Netlogic Microsystems (Netlogic). All rights
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * THIS SOFTWARE IS PROVIDED BY Netlogic Microsystems ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26 * THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #include <sys/param.h>
34 #include <sys/systm.h>
36 #include <sys/kernel.h>
37 #include <sys/module.h>
39 #include <sys/mutex.h>
42 #include <machine/bus.h>
43 #include <machine/resource.h>
45 #include <mips/nlm/hal/haldefs.h>
46 #include <mips/nlm/hal/iomap.h>
47 #include <mips/nlm/hal/uart.h>
49 #include <dev/uart/uart.h>
50 #include <dev/uart/uart_bus.h>
51 #include <dev/uart/uart_cpu.h>
53 static int uart_iodi_probe(device_t dev);
55 static device_method_t uart_iodi_methods[] = {
56 /* Device interface */
57 DEVMETHOD(device_probe, uart_iodi_probe),
58 DEVMETHOD(device_attach, uart_bus_attach),
59 DEVMETHOD(device_detach, uart_bus_detach),
63 static driver_t uart_iodi_driver = {
66 sizeof(struct uart_softc),
69 extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
72 uart_iodi_probe(device_t dev)
74 struct uart_softc *sc;
76 sc = device_get_softc(dev);
77 sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs);
78 sc->sc_class = &uart_ns8250_class;
79 bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
80 sc->sc_sysdev->bas.bst = rmi_bus_space;
81 sc->sc_sysdev->bas.bsh = nlm_get_uart_regbase(0, 0);
82 sc->sc_bas.bst = rmi_bus_space;
83 sc->sc_bas.bsh = nlm_get_uart_regbase(0, 0);
84 /* regshft = 2, rclk = 66000000, rid = 0, chan = 0 */
85 return (uart_bus_probe(dev, 2, 133000000, 0, 0));
88 DRIVER_MODULE(uart, iodi, uart_iodi_driver, uart_devclass, 0, 0);