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#include "opt_uart.h" 33178173Simp 34178173Simp#include <sys/cdefs.h> 35178173Simp__FBSDID("$FreeBSD$"); 36178173Simp 37178173Simp#include <sys/param.h> 38178173Simp#include <sys/systm.h> 39178173Simp#include <sys/bus.h> 40178173Simp#include <sys/cons.h> 41178173Simp 42178173Simp#include <machine/bus.h> 43178173Simp 44178173Simp#include <dev/uart/uart.h> 45178173Simp#include <dev/uart/uart_cpu.h> 46178173Simp 47182901Sgonzo#include <mips/malta/maltareg.h> 48178173Simp 49178173Simpbus_space_tag_t uart_bus_space_io; 50178173Simpbus_space_tag_t uart_bus_space_mem; 51178173Simp 52178173Simpextern struct uart_ops malta_usart_ops; 53178173Simpextern struct bus_space malta_bs_tag; 54178173Simp 55178173Simpint 56178173Simpuart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) 57178173Simp{ 58178173Simp return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); 59178173Simp} 60178173Simp 61178173Simpint 62178173Simpuart_cpu_getdev(int devtype, struct uart_devinfo *di) 63178173Simp{ 64178173Simp di->ops = uart_getops(&uart_ns8250_class); 65178173Simp di->bas.chan = 0; 66202035Simp di->bas.bst = mips_bus_space_generic; 67202035Simp di->bas.bsh = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR); 68178173Simp di->bas.regshft = 0; 69178173Simp di->bas.rclk = 0; 70202035Simp di->baudrate = 0; /* retain the baudrate configured by YAMON */ 71178173Simp di->databits = 8; 72178173Simp di->stopbits = 1; 73178173Simp di->parity = UART_PARITY_NONE; 74178173Simp 75202035Simp uart_bus_space_io = NULL; 76202035Simp uart_bus_space_mem = mips_bus_space_generic; 77178173Simp return (0); 78178173Simp} 79