uart_bus_s3c2410.c revision 205354
1#include <sys/cdefs.h> 2__FBSDID("$FreeBSD: head/sys/arm/s3c2xx0/uart_bus_s3c2410.c 205354 2010-03-20 03:39:35Z imp $"); 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 22static int uart_s3c2410_probe(device_t dev); 23 24static 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 32static driver_t uart_s3c2410_driver = { 33 uart_driver_name, 34 uart_s3c2410_methods, 35 sizeof(struct uart_softc), 36}; 37 38extern struct uart_class uart_s3c2410_class; 39extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; 40static int 41uart_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 59DRIVER_MODULE(uart, s3c24x0, uart_s3c2410_driver, uart_devclass, 0, 0); 60