1205354Simp/* 2205354Simp * Copyright (c) 2003 Marcel Moolenaar 3205354Simp * Copyright (c) 2007 Andrew Turner 4205354Simp * All rights reserved. 5205354Simp * 6205354Simp * Redistribution and use in source and binary forms, with or without 7205354Simp * modification, are permitted provided that the following conditions 8205354Simp * are met: 9205354Simp * 10205354Simp * 1. Redistributions of source code must retain the above copyright 11205354Simp * notice, this list of conditions and the following disclaimer. 12205354Simp * 2. Redistributions in binary form must reproduce the above copyright 13205354Simp * notice, this list of conditions and the following disclaimer in the 14205354Simp * documentation and/or other materials provided with the distribution. 15205354Simp * 16205354Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17205354Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18205354Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19205354Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20205354Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21205354Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22205354Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23205354Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24205354Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25205354Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26205354Simp */ 27205354Simp 28205354Simp#include <sys/cdefs.h> 29205354Simp__FBSDID("$FreeBSD$"); 30205354Simp 31205354Simp#include <sys/param.h> 32205354Simp#include <sys/systm.h> 33205354Simp#include <sys/bus.h> 34205354Simp#include <sys/cons.h> 35205354Simp#include <machine/bus.h> 36205354Simp 37205354Simp#include <dev/uart/uart.h> 38205354Simp#include <dev/uart/uart_cpu.h> 39205354Simp 40205354Simp#include <arm/s3c2xx0/s3c2xx0var.h> 41205354Simp 42205354Simpbus_space_tag_t uart_bus_space_io; 43205354Simpbus_space_tag_t uart_bus_space_mem; 44205354Simp 45205354Simpextern struct uart_ops uart_s3c2410_ops; 46205354Simp 47205354Simpvm_offset_t s3c2410_uart_vaddr; 48205354Simpunsigned int s3c2410_pclk; 49205354Simp 50205354Simpextern struct uart_class uart_s3c2410_class; 51205354Simp 52205354Simpint 53205354Simpuart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) 54205354Simp{ 55205354Simp return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); 56205354Simp} 57205354Simp 58205354Simpint 59205354Simpuart_cpu_getdev(int devtype, struct uart_devinfo *di) 60205354Simp{ 61205354Simp if (devtype != UART_DEV_CONSOLE) 62205354Simp return (ENXIO); 63205354Simp 64205354Simp di->ops = uart_getops(&uart_s3c2410_class); 65205354Simp di->bas.chan = 0; 66205354Simp di->bas.bst = &s3c2xx0_bs_tag; 67205354Simp di->bas.bsh = s3c2410_uart_vaddr; 68205354Simp di->bas.regshft = 0; 69205354Simp di->bas.rclk = s3c2410_pclk; 70205354Simp di->baudrate = 115200; 71205354Simp di->databits = 8; 72205354Simp di->stopbits = 1; 73205354Simp di->parity = UART_PARITY_NONE; 74205354Simp uart_bus_space_io = &s3c2xx0_bs_tag; 75205354Simp uart_bus_space_mem = NULL; 76205354Simp 77205354Simp return (0); 78205354Simp} 79