]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/arm/s3c2xx0/uart_bus_s3c2410.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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 struct uart_class uart_s3c2410_class;
39 extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
40 static int
41 uart_s3c2410_probe(device_t dev)
42 {
43         struct uart_devinfo *sysdev;
44         struct uart_softc *sc;
45         int unit;
46
47         sc = device_get_softc(dev);
48         sc->sc_class = &uart_s3c2410_class;
49
50         unit = device_get_unit(dev);
51         sysdev = SLIST_FIRST(&uart_sysdevs);
52         if (S3C24X0_UART_BASE(unit) == sysdev->bas.bsh) {
53                 sc->sc_sysdev = sysdev;
54                 bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
55         }
56         return(uart_bus_probe(dev, 0, 0, 0, unit));
57 }
58
59 DRIVER_MODULE(uart, s3c24x0, uart_s3c2410_driver, uart_devclass, 0, 0);