2 * Copyright (c) 2011 Netlogic Microsystems Inc.
4 * (based on dev/uart/uart_bus_pci.c)
5 * Copyright (c) 2006 Marcel Moolenaar
6 * Copyright (c) 2001 M. Warner Losh
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #include <sys/param.h>
34 #include <sys/systm.h>
37 #include <sys/kernel.h>
38 #include <sys/module.h>
39 #include <machine/bus.h>
41 #include <machine/resource.h>
43 #include <dev/pci/pcivar.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>
52 static int uart_soc_probe(device_t dev);
54 static device_method_t uart_soc_methods[] = {
55 /* Device interface */
56 DEVMETHOD(device_probe, uart_soc_probe),
57 DEVMETHOD(device_attach, uart_bus_attach),
58 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;
74 if (pci_get_vendor(dev) != PCI_VENDOR_NETLOGIC ||
75 pci_get_device(dev) != PCI_DEVICE_ID_NLM_UART)
78 ubase = nlm_get_uart_regbase(0, 0);
79 sc = device_get_softc(dev);
80 sc->sc_class = &uart_ns8250_class;
81 device_set_desc(dev, "Netlogic SoC UART");
82 return (uart_bus_probe(dev, 2, 133000000, 0, 0));
85 DRIVER_MODULE(uart_soc, pci, uart_soc_driver, uart_devclass, 0, 0);