uart_bus_s3c2410.c revision 272103
1205354Simp#include <sys/cdefs.h> 2205354Simp__FBSDID("$FreeBSD: head/sys/arm/samsung/s3c2xx0/uart_bus_s3c2410.c 272103 2014-09-25 11:38:26Z gavin $"); 3205354Simp 4205354Simp#include <sys/param.h> 5205354Simp#include <sys/systm.h> 6205354Simp#include <sys/bus.h> 7205354Simp#include <sys/conf.h> 8205354Simp#include <sys/kernel.h> 9205354Simp#include <sys/module.h> 10205354Simp#include <machine/bus.h> 11205354Simp#include <sys/rman.h> 12205354Simp#include <machine/resource.h> 13205354Simp 14205354Simp#include <dev/uart/uart.h> 15205354Simp#include <dev/uart/uart_bus.h> 16205354Simp#include <dev/uart/uart_cpu.h> 17205354Simp 18272103Sgavin#include <arm/samsung/s3c2xx0/s3c24x0reg.h> 19205354Simp 20205354Simp#include "uart_if.h" 21205354Simp 22205354Simpstatic int uart_s3c2410_probe(device_t dev); 23205354Simp 24205354Simpstatic device_method_t uart_s3c2410_methods[] = { 25205354Simp /* Device interface */ 26205354Simp DEVMETHOD(device_probe, uart_s3c2410_probe), 27205354Simp DEVMETHOD(device_attach, uart_bus_attach), 28205354Simp DEVMETHOD(device_detach, uart_bus_detach), 29205354Simp { 0, 0 } 30205354Simp}; 31205354Simp 32205354Simpstatic driver_t uart_s3c2410_driver = { 33205354Simp uart_driver_name, 34205354Simp uart_s3c2410_methods, 35205354Simp sizeof(struct uart_softc), 36205354Simp}; 37205354Simp 38205354Simpextern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; 39205354Simpstatic int 40205354Simpuart_s3c2410_probe(device_t dev) 41205354Simp{ 42205354Simp struct uart_devinfo *sysdev; 43205354Simp struct uart_softc *sc; 44205354Simp int unit; 45205354Simp 46205354Simp sc = device_get_softc(dev); 47205354Simp sc->sc_class = &uart_s3c2410_class; 48205354Simp 49205354Simp unit = device_get_unit(dev); 50205354Simp sysdev = SLIST_FIRST(&uart_sysdevs); 51205354Simp if (S3C24X0_UART_BASE(unit) == sysdev->bas.bsh) { 52205354Simp sc->sc_sysdev = sysdev; 53205354Simp bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas)); 54205354Simp } 55205354Simp return(uart_bus_probe(dev, 0, 0, 0, unit)); 56205354Simp} 57205354Simp 58205354SimpDRIVER_MODULE(uart, s3c24x0, uart_s3c2410_driver, uart_devclass, 0, 0); 59