]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sys/arm/s3c2xx0/uart_bus_s3c2410.c
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / sys / arm / s3c2xx0 / uart_bus_s3c2410.c
1 #include <sys/cdefs.h>
2 __FBSDID("$FreeBSD$");
3
4 #include <sys/param.h>
5 #include <sys/systm.h>
6 #include <sys/bus.h>
7 #include <sys/conf.h>
8 #include <sys/kernel.h>
9 #include <sys/module.h>
10 #include <machine/bus.h>
11 #include <sys/rman.h>
12 #include <machine/resource.h>
13
14 #include <dev/uart/uart.h>
15 #include <dev/uart/uart_bus.h>
16 #include <dev/uart/uart_cpu.h>
17
18 #include <arm/s3c2xx0/s3c24x0reg.h>
19
20 #include "uart_if.h"
21
22 static int uart_s3c2410_probe(device_t dev);
23
24 static device_method_t uart_s3c2410_methods[] = {
25         /* Device interface */
26         DEVMETHOD(device_probe,         uart_s3c2410_probe),
27         DEVMETHOD(device_attach,        uart_bus_attach),
28         DEVMETHOD(device_detach,        uart_bus_detach),
29         { 0, 0 }
30 };
31
32 static driver_t uart_s3c2410_driver = {
33         uart_driver_name,
34         uart_s3c2410_methods,
35         sizeof(struct uart_softc),
36 };
37
38 extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
39 static int
40 uart_s3c2410_probe(device_t dev)
41 {
42         struct uart_devinfo *sysdev;
43         struct uart_softc *sc;
44         int unit;
45
46         sc = device_get_softc(dev);
47         sc->sc_class = &uart_s3c2410_class;
48
49         unit = device_get_unit(dev);
50         sysdev = SLIST_FIRST(&uart_sysdevs);
51         if (S3C24X0_UART_BASE(unit) == sysdev->bas.bsh) {
52                 sc->sc_sysdev = sysdev;
53                 bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
54         }
55         return(uart_bus_probe(dev, 0, 0, 0, unit));
56 }
57
58 DRIVER_MODULE(uart, s3c24x0, uart_s3c2410_driver, uart_devclass, 0, 0);