uart_cpu_s3c2410.c revision 278727
117680Spst/*
226180Sfenner * Copyright (c) 2003 Marcel Moolenaar
317680Spst * Copyright (c) 2007 Andrew Turner
417680Spst * All rights reserved.
517680Spst *
617680Spst * Redistribution and use in source and binary forms, with or without
717680Spst * modification, are permitted provided that the following conditions
817680Spst * are met:
917680Spst *
1017680Spst * 1. Redistributions of source code must retain the above copyright
1117680Spst *    notice, this list of conditions and the following disclaimer.
1217680Spst * 2. Redistributions in binary form must reproduce the above copyright
1317680Spst *    notice, this list of conditions and the following disclaimer in the
1417680Spst *    documentation and/or other materials provided with the distribution.
1517680Spst *
1617680Spst * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1717680Spst * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1817680Spst * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1917680Spst * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2017680Spst * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2117680Spst * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22127668Sbms * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23127668Sbms * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2417680Spst * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2517680Spst * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2656893Sfenner */
2756893Sfenner
2856893Sfenner#include <sys/cdefs.h>
2956893Sfenner__FBSDID("$FreeBSD: stable/10/sys/arm/samsung/s3c2xx0/uart_cpu_s3c2410.c 278727 2015-02-13 22:32:02Z ian $");
30127668Sbms
3117680Spst#include <sys/param.h>
3217680Spst#include <sys/systm.h>
3317680Spst#include <sys/bus.h>
3417680Spst#include <sys/cons.h>
3517680Spst#include <machine/bus.h>
3617680Spst
3717680Spst#include <dev/uart/uart.h>
3817680Spst#include <dev/uart/uart_cpu.h>
3917680Spst
4017680Spst#include <arm/samsung/s3c2xx0/s3c2xx0var.h>
4117680Spst
4217680Spstbus_space_tag_t uart_bus_space_io;
4317680Spstbus_space_tag_t uart_bus_space_mem;
4417680Spst
4517680Spstextern struct uart_ops uart_s3c2410_ops;
4617680Spst
4717680Spstvm_offset_t s3c2410_uart_vaddr;
4817680Spstunsigned int s3c2410_pclk;
4917680Spst
5017680Spstint
5117680Spstuart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
5217680Spst{
5317680Spst	return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
5417680Spst}
5517680Spst
5617680Spstint
5717680Spstuart_cpu_getdev(int devtype, struct uart_devinfo *di)
5817680Spst{
5917680Spst	if (devtype != UART_DEV_CONSOLE)
6017680Spst		return (ENXIO);
6117680Spst
6217680Spst	di->ops = uart_getops(&uart_s3c2410_class);
6317680Spst	di->bas.chan = 0;
6417680Spst	di->bas.bst = s3c2xx0_bs_tag;
6517680Spst	di->bas.bsh = s3c2410_uart_vaddr;
6617680Spst	di->bas.regshft = 0;
67	di->bas.rclk = s3c2410_pclk;
68	di->baudrate = 115200;
69	di->databits = 8;
70	di->stopbits = 1;
71	di->parity = UART_PARITY_NONE;
72	uart_bus_space_io = s3c2xx0_bs_tag;
73	uart_bus_space_mem = NULL;
74
75	return (0);
76}
77