1187498Simp/*-
2187498Simp * Copyright (c) 2006 Wojciech A. Koszek <wkoszek@FreeBSD.org>
3187498Simp * All rights reserved.
4187498Simp *
5187498Simp * Redistribution and use in source and binary forms, with or without
6187498Simp * modification, are permitted provided that the following conditions
7187498Simp * are met:
8187498Simp * 1. Redistributions of source code must retain the above copyright
9187498Simp *    notice, this list of conditions and the following disclaimer.
10187498Simp * 2. Redistributions in binary form must reproduce the above copyright
11187498Simp *    notice, this list of conditions and the following disclaimer in the
12187498Simp *    documentation and/or other materials provided with the distribution.
13187498Simp *
14187498Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15187498Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16187498Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17187498Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18187498Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19187498Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20187498Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21187498Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22187498Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23187498Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24187498Simp * SUCH DAMAGE.
25187498Simp *
26187498Simp * $Id$
27187498Simp */
28187498Simp/*
29187498Simp * Skeleton of this file was based on respective code for ARM
30187498Simp * code written by Olivier Houchard.
31187498Simp */
32187498Simp
33187498Simp#include "opt_uart.h"
34187498Simp
35187498Simp#include <sys/cdefs.h>
36187498Simp__FBSDID("$FreeBSD$");
37187498Simp
38187498Simp#include <sys/param.h>
39187498Simp#include <sys/systm.h>
40187498Simp#include <sys/bus.h>
41187498Simp#include <sys/cons.h>
42187498Simp
43187498Simp#include <machine/bus.h>
44187498Simp
45187498Simp#include <dev/uart/uart.h>
46187498Simp#include <dev/uart/uart_cpu.h>
47187498Simp
48187498Simp#include <mips/alchemy/aureg.h>
49187498Simp
50187498Simpbus_space_tag_t uart_bus_space_io;
51187498Simpbus_space_tag_t uart_bus_space_mem;
52187498Simp
53187498Simpint
54187498Simpuart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
55187498Simp{
56187498Simp
57187498Simp	return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
58187498Simp}
59187498Simp
60187498Simpint
61187498Simpuart_cpu_getdev(int devtype, struct uart_devinfo *di)
62187498Simp{
63187498Simp
64187498Simp	di->ops = uart_getops(&uart_ns8250_class);
65187498Simp	di->bas.chan = 0;
66191282Sgonzo	di->bas.bst = mips_bus_space_generic;
67187498Simp	di->bas.regshft = 0;
68187498Simp	di->bas.rclk = 0;
69187498Simp	di->baudrate = 115200;
70187498Simp	di->databits = 8;
71187498Simp	di->stopbits = 1;
72187498Simp	di->parity = UART_PARITY_NONE;
73187498Simp
74187498Simp	uart_bus_space_io = 0;
75191282Sgonzo	uart_bus_space_mem = mips_bus_space_generic;
76187498Simp	di->bas.bsh = MIPS_PHYS_TO_KSEG1(UART0_BASE);
77187498Simp
78187498Simp	return (0);
79187498Simp}
80