1139735Simp/*-
2129212Scognet * Copyright (c) 2003 Marcel Moolenaar
3129212Scognet * All rights reserved.
4129212Scognet *
5129212Scognet * Redistribution and use in source and binary forms, with or without
6129212Scognet * modification, are permitted provided that the following conditions
7129212Scognet * are met:
8129212Scognet *
9129212Scognet * 1. Redistributions of source code must retain the above copyright
10129212Scognet *    notice, this list of conditions and the following disclaimer.
11129212Scognet * 2. Redistributions in binary form must reproduce the above copyright
12129212Scognet *    notice, this list of conditions and the following disclaimer in the
13129212Scognet *    documentation and/or other materials provided with the distribution.
14129212Scognet *
15129212Scognet * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16129212Scognet * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17129212Scognet * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18129212Scognet * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19129212Scognet * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20129212Scognet * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21129212Scognet * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22129212Scognet * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23129212Scognet * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24129212Scognet * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25129212Scognet */
26129212Scognet
27129212Scognet#include <sys/cdefs.h>
28129212Scognet__FBSDID("$FreeBSD$");
29129212Scognet
30129212Scognet#include <sys/param.h>
31129212Scognet#include <sys/systm.h>
32129212Scognet#include <sys/bus.h>
33129212Scognet#include <sys/cons.h>
34129212Scognet#include <machine/bus.h>
35129212Scognet
36129212Scognet#include <dev/uart/uart.h>
37129212Scognet#include <dev/uart/uart_cpu.h>
38129212Scognet
39158854Scognet#include <arm/sa11x0/sa11x0_reg.h>
40129212Scognet#include <arm/sa11x0/sa11x0_var.h>
41129212Scognet
42129212Scognetbus_space_tag_t uart_bus_space_io;
43129212Scognetbus_space_tag_t uart_bus_space_mem;
44129220Scognet
45168281Smarcelextern struct uart_class uart_sa1110_class;
46129220Scognet
47159834Scognetvm_offset_t sa1110_uart_vaddr;
48159834Scognet
49129212Scognetint
50129212Scognetuart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
51129212Scognet{
52129212Scognet	return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
53129212Scognet}
54129212Scognet
55129212Scognetint
56129212Scognetuart_cpu_getdev(int devtype, struct uart_devinfo *di)
57129212Scognet{
58168281Smarcel
59168281Smarcel	di->ops = uart_getops(&uart_sa1110_class);
60129212Scognet	di->bas.chan = 0;
61129212Scognet	di->bas.bst = &sa11x0_bs_tag;
62159371Scognet	di->bas.bsh = sa1110_uart_vaddr;
63129212Scognet	di->bas.regshft = 0;
64129212Scognet	di->bas.rclk = 0;
65129212Scognet	di->baudrate = 9600;
66129212Scognet	di->databits = 8;
67129212Scognet	di->stopbits = 1;
68129212Scognet	di->parity = UART_PARITY_NONE;
69129212Scognet	uart_bus_space_io = &sa11x0_bs_tag;
70129212Scognet	uart_bus_space_mem = NULL;
71129212Scognet
72129212Scognet	return (0);
73129212Scognet}
74