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/samsung/s3c2xx0/s3c24x0reg.h>
19
20#include "uart_if.h"
21
22extern struct uart_class uart_s3c2410_class;
23
24static int uart_s3c2410_probe(device_t dev);
25
26static device_method_t uart_s3c2410_methods[] = {
27	/* Device interface */
28	DEVMETHOD(device_probe,		uart_s3c2410_probe),
29	DEVMETHOD(device_attach,	uart_bus_attach),
30	DEVMETHOD(device_detach,	uart_bus_detach),
31	{ 0, 0 }
32};
33
34static driver_t uart_s3c2410_driver = {
35	uart_driver_name,
36	uart_s3c2410_methods,
37	sizeof(struct uart_softc),
38};
39
40extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
41static int
42uart_s3c2410_probe(device_t dev)
43{
44	struct uart_devinfo *sysdev;
45	struct uart_softc *sc;
46	int unit;
47
48	sc = device_get_softc(dev);
49	sc->sc_class = &uart_s3c2410_class;
50
51	unit = device_get_unit(dev);
52	sysdev = SLIST_FIRST(&uart_sysdevs);
53	if (S3C24X0_UART_BASE(unit) == sysdev->bas.bsh) {
54		sc->sc_sysdev = sysdev;
55		bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
56	}
57	return(uart_bus_probe(dev, 0, 0, 0, unit));
58}
59
60DRIVER_MODULE(uart, s3c24x0, uart_s3c2410_driver, uart_devclass, 0, 0);
61