uart_cpu_alchemy.c revision 202032
1213365Smarcel/*- 2214006Smarcel * Copyright (c) 2006 Wojciech A. Koszek <wkoszek@FreeBSD.org> 3213365Smarcel * All rights reserved. 4213365Smarcel * 5213365Smarcel * Redistribution and use in source and binary forms, with or without 6213365Smarcel * modification, are permitted provided that the following conditions 7213365Smarcel * are met: 8213365Smarcel * 1. Redistributions of source code must retain the above copyright 9213365Smarcel * notice, this list of conditions and the following disclaimer. 10213365Smarcel * 2. Redistributions in binary form must reproduce the above copyright 11213365Smarcel * notice, this list of conditions and the following disclaimer in the 12213365Smarcel * documentation and/or other materials provided with the distribution. 13213365Smarcel * 14213365Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15213365Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16213365Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17213365Smarcel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18213365Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19213365Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20213365Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21213365Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22213365Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23213365Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24213365Smarcel * SUCH DAMAGE. 25213365Smarcel * 26213365Smarcel * $Id$ 27213365Smarcel */ 28213365Smarcel/* 29213365Smarcel * Skeleton of this file was based on respective code for ARM 30213365Smarcel * code written by Olivier Houchard. 31213365Smarcel */ 32213365Smarcel 33213365Smarcel#include "opt_uart.h" 34213365Smarcel 35213365Smarcel#include <sys/cdefs.h> 36213365Smarcel__FBSDID("$FreeBSD: head/sys/mips/alchemy/uart_cpu_alchemy.c 191282 2009-04-19 22:02:14Z gonzo $"); 37213365Smarcel 38214006Smarcel#include <sys/param.h> 39214006Smarcel#include <sys/systm.h> 40213365Smarcel#include <sys/bus.h> 41213365Smarcel#include <sys/cons.h> 42213365Smarcel 43213365Smarcel#include <machine/bus.h> 44213365Smarcel 45228634Savg#include <dev/uart/uart.h> 46213365Smarcel#include <dev/uart/uart_cpu.h> 47213365Smarcel 48213365Smarcel#include <mips/alchemy/aureg.h> 49213365Smarcel 50214006Smarcelbus_space_tag_t uart_bus_space_io; 51213365Smarcelbus_space_tag_t uart_bus_space_mem; 52213365Smarcel 53213365Smarcelint 54213365Smarceluart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) 55213365Smarcel{ 56213365Smarcel 57213365Smarcel return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); 58223919Sae} 59214006Smarcel 60213365Smarcelint 61213365Smarceluart_cpu_getdev(int devtype, struct uart_devinfo *di) 62213365Smarcel{ 63213365Smarcel 64213365Smarcel di->ops = uart_getops(&uart_ns8250_class); 65213365Smarcel di->bas.chan = 0; 66213365Smarcel di->bas.bst = mips_bus_space_generic; 67213365Smarcel di->bas.regshft = 0; 68213365Smarcel di->bas.rclk = 0; 69213365Smarcel di->baudrate = 115200; 70213365Smarcel di->databits = 8; 71213365Smarcel di->stopbits = 1; 72213365Smarcel di->parity = UART_PARITY_NONE; 73213365Smarcel 74213365Smarcel uart_bus_space_io = 0; 75213365Smarcel uart_bus_space_mem = mips_bus_space_generic; 76213365Smarcel di->bas.bsh = MIPS_PHYS_TO_KSEG1(UART0_BASE); 77213365Smarcel 78213365Smarcel return (0); 79213365Smarcel} 80213365Smarcel