2 * Copyright (c) 2003-2012 Broadcom Corporation
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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 BROADCOM ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
20 * 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
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
32 #include <sys/param.h>
33 #include <sys/systm.h>
36 #include <sys/kernel.h>
37 #include <sys/module.h>
38 #include <machine/bus.h>
40 #include <machine/resource.h>
42 #include <dev/pci/pcivar.h>
44 #include <mips/nlm/hal/haldefs.h>
45 #include <mips/nlm/hal/iomap.h>
46 #include <mips/nlm/hal/uart.h>
48 #include <dev/uart/uart.h>
49 #include <dev/uart/uart_bus.h>
51 static int uart_soc_probe(device_t dev);
53 static device_method_t uart_soc_methods[] = {
54 /* Device interface */
55 DEVMETHOD(device_probe, uart_soc_probe),
56 DEVMETHOD(device_attach, uart_bus_attach),
57 DEVMETHOD(device_detach, uart_bus_detach),
62 static driver_t uart_soc_driver = {
65 sizeof(struct uart_softc),
69 uart_soc_probe(device_t dev)
71 struct uart_softc *sc;
73 if (pci_get_vendor(dev) != PCI_VENDOR_NETLOGIC ||
74 pci_get_device(dev) != PCI_DEVICE_ID_NLM_UART)
77 sc = device_get_softc(dev);
78 sc->sc_class = &uart_ns8250_class;
79 device_set_desc(dev, "Netlogic SoC UART");
80 return (uart_bus_probe(dev, 2, XLP_IO_CLK, 0, 0));
83 DRIVER_MODULE(uart_soc, pci, uart_soc_driver, uart_devclass, 0, 0);