1178173Simp/*- 2178173Simp * Copyright (c) 2006 Wojciech A. Koszek <wkoszek@FreeBSD.org> 3178173Simp * All rights reserved. 4178173Simp * 5178173Simp * Redistribution and use in source and binary forms, with or without 6178173Simp * modification, are permitted provided that the following conditions 7178173Simp * are met: 8178173Simp * 1. Redistributions of source code must retain the above copyright 9178173Simp * notice, this list of conditions and the following disclaimer. 10178173Simp * 2. Redistributions in binary form must reproduce the above copyright 11178173Simp * notice, this list of conditions and the following disclaimer in the 12178173Simp * documentation and/or other materials provided with the distribution. 13178173Simp * 14178173Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15178173Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16178173Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17178173Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18178173Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19178173Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20178173Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21178173Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22178173Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23178173Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24178173Simp * SUCH DAMAGE. 25178173Simp * 26178173Simp * $Id$ 27178173Simp */ 28178173Simp/* 29178173Simp * Skeleton of this file was based on respective code for ARM 30178173Simp * code written by Olivier Houchard. 31178173Simp */ 32178173Simp/* 33178173Simp * XXXMIPS: This file is hacked from arm/... . XXXMIPS here means this file is 34178173Simp * experimental and was written for MIPS32 port. 35178173Simp */ 36178173Simp#include "opt_uart.h" 37178173Simp 38178173Simp#include <sys/cdefs.h> 39178173Simp__FBSDID("$FreeBSD$"); 40178173Simp 41178173Simp#include <sys/param.h> 42178173Simp#include <sys/systm.h> 43178173Simp#include <sys/bus.h> 44178173Simp#include <sys/cons.h> 45178173Simp 46178173Simp#include <machine/bus.h> 47178173Simp 48178173Simp#include <dev/uart/uart.h> 49178173Simp#include <dev/uart/uart_cpu.h> 50178173Simp 51182901Sgonzo#include <mips/sentry5/sentry5reg.h> 52178173Simp 53178173Simpbus_space_tag_t uart_bus_space_io; 54178173Simpbus_space_tag_t uart_bus_space_mem; 55178173Simp 56178173Simpextern struct uart_ops malta_usart_ops; 57178173Simpextern struct bus_space malta_bs_tag; 58178173Simp 59178173Simpint 60178173Simpuart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) 61178173Simp{ 62178173Simp return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); 63178173Simp} 64178173Simp 65178173Simpint 66178173Simpuart_cpu_getdev(int devtype, struct uart_devinfo *di) 67178173Simp{ 68178173Simp di->ops = uart_getops(&uart_ns8250_class); 69178173Simp di->bas.chan = 0; 70178173Simp di->bas.bst = 0; 71178173Simp di->bas.regshft = 0; 72178173Simp di->bas.rclk = 0; 73178173Simp di->baudrate = 115200; 74178173Simp di->databits = 8; 75178173Simp di->stopbits = 1; 76178173Simp di->parity = UART_PARITY_NONE; 77178173Simp 78178173Simp uart_bus_space_io = MIPS_PHYS_TO_KSEG1(SENTRY5_UART1ADR); 79202036Simp uart_bus_space_mem = mips_bus_space_generic; 80178173Simp di->bas.bsh = MIPS_PHYS_TO_KSEG1(SENTRY5_UART1ADR); 81178173Simp return (0); 82178173Simp} 83