uart_cpu_maltausart.c revision 302408
119304Speter/*- 219304Speter * Copyright (c) 2006 Wojciech A. Koszek <wkoszek@FreeBSD.org> 319304Speter * All rights reserved. 419304Speter * 519304Speter * Redistribution and use in source and binary forms, with or without 619304Speter * modification, are permitted provided that the following conditions 719304Speter * are met: 819304Speter * 1. Redistributions of source code must retain the above copyright 919304Speter * notice, this list of conditions and the following disclaimer. 1019304Speter * 2. Redistributions in binary form must reproduce the above copyright 1119304Speter * notice, this list of conditions and the following disclaimer in the 1219304Speter * documentation and/or other materials provided with the distribution. 1319304Speter * 1419304Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1519304Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1619304Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1719304Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1819304Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1919304Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2019304Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2119304Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2219304Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2319304Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2419304Speter * SUCH DAMAGE. 2519304Speter * 2619304Speter * $Id$ 2719304Speter */ 2819304Speter/* 2919304Speter * Skeleton of this file was based on respective code for ARM 3019304Speter * code written by Olivier Houchard. 3119304Speter */ 3219304Speter#include "opt_uart.h" 3319304Speter 3419304Speter#include <sys/cdefs.h> 3519304Speter__FBSDID("$FreeBSD: stable/11/sys/mips/malta/uart_cpu_maltausart.c 202175 2010-01-12 21:36:08Z imp $"); 3619304Speter 3719304Speter#include <sys/param.h> 3819304Speter#include <sys/systm.h> 3919304Speter#include <sys/bus.h> 4019304Speter#include <sys/cons.h> 4119304Speter 4219304Speter#include <machine/bus.h> 4319304Speter 4419304Speter#include <dev/uart/uart.h> 4519304Speter#include <dev/uart/uart_cpu.h> 4619304Speter 4719304Speter#include <mips/malta/maltareg.h> 4819304Speter 4919304Speterbus_space_tag_t uart_bus_space_io; 5019304Speterbus_space_tag_t uart_bus_space_mem; 5119304Speter 5219304Speterextern struct uart_ops malta_usart_ops; 5319304Speterextern struct bus_space malta_bs_tag; 5419304Speter 5519304Speterint 5619304Speteruart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) 5719304Speter{ 5819304Speter return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); 5919304Speter} 6019304Speter 6119304Speterint 6219304Speteruart_cpu_getdev(int devtype, struct uart_devinfo *di) 6319304Speter{ 6419304Speter di->ops = uart_getops(&uart_ns8250_class); 6519304Speter di->bas.chan = 0; 6619304Speter di->bas.bst = mips_bus_space_generic; 6719304Speter di->bas.bsh = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR); 6819304Speter di->bas.regshft = 0; 6919304Speter di->bas.rclk = 0; 7019304Speter di->baudrate = 0; /* retain the baudrate configured by YAMON */ 7119304Speter di->databits = 8; 7219304Speter di->stopbits = 1; 7319304Speter di->parity = UART_PARITY_NONE; 7419304Speter 7519304Speter uart_bus_space_io = NULL; 7619304Speter uart_bus_space_mem = mips_bus_space_generic; 7719304Speter return (0); 7819304Speter} 7919304Speter