uart_cpu_sa1110.c revision 159371
1199482Srdivacky/*-
2199482Srdivacky * Copyright (c) 2003 Marcel Moolenaar
3199482Srdivacky * All rights reserved.
4199482Srdivacky *
5199482Srdivacky * Redistribution and use in source and binary forms, with or without
6199482Srdivacky * modification, are permitted provided that the following conditions
7199482Srdivacky * are met:
8199482Srdivacky *
9199482Srdivacky * 1. Redistributions of source code must retain the above copyright
10199482Srdivacky *    notice, this list of conditions and the following disclaimer.
11199482Srdivacky * 2. Redistributions in binary form must reproduce the above copyright
12199482Srdivacky *    notice, this list of conditions and the following disclaimer in the
13199482Srdivacky *    documentation and/or other materials provided with the distribution.
14199482Srdivacky *
15199482Srdivacky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16199482Srdivacky * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17288943Sdim * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18199482Srdivacky * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19249423Sdim * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20249423Sdim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21249423Sdim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22249423Sdim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23249423Sdim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24212904Sdim * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25234353Sdim */
26212904Sdim
27199482Srdivacky#include <sys/cdefs.h>
28276479Sdim__FBSDID("$FreeBSD: head/sys/arm/sa11x0/uart_cpu_sa1110.c 159371 2006-06-07 11:28:17Z cognet $");
29276479Sdim
30226633Sdim#include <sys/param.h>
31199482Srdivacky#include <sys/systm.h>
32199482Srdivacky#include <sys/bus.h>
33199482Srdivacky#include <sys/cons.h>
34205408Srdivacky#include <machine/bus.h>
35205408Srdivacky
36205408Srdivacky#include <dev/uart/uart.h>
37280031Sdim#include <dev/uart/uart_cpu.h>
38280031Sdim
39280031Sdim#include <arm/sa11x0/sa11x0_reg.h>
40205408Srdivacky#include <arm/sa11x0/sa11x0_var.h>
41205408Srdivacky
42205408Srdivackybus_space_tag_t uart_bus_space_io;
43205408Srdivackybus_space_tag_t uart_bus_space_mem;
44205408Srdivacky
45205408Srdivackyextern struct uart_ops uart_sa1110_ops;
46199482Srdivacky
47199482Srdivackyint
48199482Srdivackyuart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
49280031Sdim{
50280031Sdim	return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
51226633Sdim}
52239462Sdim
53276479Sdimint
54199482Srdivackyuart_cpu_getdev(int devtype, struct uart_devinfo *di)
55199482Srdivacky{
56280031Sdim	di->ops = uart_sa1110_ops;
57280031Sdim	di->bas.chan = 0;
58261991Sdim	di->bas.bst = &sa11x0_bs_tag;
59280031Sdim	di->bas.bsh = sa1110_uart_vaddr;
60261991Sdim	di->bas.regshft = 0;
61199482Srdivacky	di->bas.rclk = 0;
62199482Srdivacky	di->baudrate = 9600;
63280031Sdim	di->databits = 8;
64280031Sdim	di->stopbits = 1;
65239462Sdim	di->parity = UART_PARITY_NONE;
66239462Sdim	uart_bus_space_io = &sa11x0_bs_tag;
67239462Sdim	uart_bus_space_mem = NULL;
68280031Sdim
69280031Sdim	return (0);
70199482Srdivacky}
71199482Srdivacky