xref: /openbmc/linux/arch/mips/rb532/serial.c (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
173b4390fSRalf Baechle /*
273b4390fSRalf Baechle  *  BRIEF MODULE DESCRIPTION
373b4390fSRalf Baechle  *     Serial port initialisation.
473b4390fSRalf Baechle  *
573b4390fSRalf Baechle  *  Copyright 2004 IDT Inc. (rischelp@idt.com)
673b4390fSRalf Baechle  *
773b4390fSRalf Baechle  *  This program is free software; you can redistribute  it and/or modify it
873b4390fSRalf Baechle  *  under  the terms of  the GNU General  Public License as published by the
973b4390fSRalf Baechle  *  Free Software Foundation;  either version 2 of the  License, or (at your
1073b4390fSRalf Baechle  *  option) any later version.
1173b4390fSRalf Baechle  *
1273b4390fSRalf Baechle  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1373b4390fSRalf Baechle  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1473b4390fSRalf Baechle  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1573b4390fSRalf Baechle  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1673b4390fSRalf Baechle  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1773b4390fSRalf Baechle  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1873b4390fSRalf Baechle  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1973b4390fSRalf Baechle  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
2073b4390fSRalf Baechle  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2173b4390fSRalf Baechle  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2273b4390fSRalf Baechle  *
2373b4390fSRalf Baechle  *  You should have received a copy of the  GNU General Public License along
2473b4390fSRalf Baechle  *  with this program; if not, write  to the Free Software Foundation, Inc.,
2573b4390fSRalf Baechle  *  675 Mass Ave, Cambridge, MA 02139, USA.
2673b4390fSRalf Baechle  */
2773b4390fSRalf Baechle 
2873b4390fSRalf Baechle #include <linux/init.h>
2973b4390fSRalf Baechle #include <linux/tty.h>
3073b4390fSRalf Baechle #include <linux/serial_core.h>
3173b4390fSRalf Baechle #include <linux/serial_8250.h>
32*ca4d3e67SDavid Howells #include <linux/irq.h>
3373b4390fSRalf Baechle 
3473b4390fSRalf Baechle #include <asm/serial.h>
35606a083bSFlorian Fainelli #include <asm/mach-rc32434/rb.h>
3673b4390fSRalf Baechle 
3773b4390fSRalf Baechle extern unsigned int idt_cpu_freq;
3873b4390fSRalf Baechle 
3973b4390fSRalf Baechle static struct uart_port rb532_uart = {
401452fc7dSPhil Sutter 	.flags = UPF_BOOT_AUTOCONF,
4173b4390fSRalf Baechle 	.line = 0,
42606a083bSFlorian Fainelli 	.irq = UART0_IRQ,
4373b4390fSRalf Baechle 	.iotype = UPIO_MEM,
44606a083bSFlorian Fainelli 	.membase = (char *)KSEG1ADDR(REGBASE + UART0BASE),
4573b4390fSRalf Baechle 	.regshift = 2
4673b4390fSRalf Baechle };
4773b4390fSRalf Baechle 
setup_serial_port(void)4873b4390fSRalf Baechle int __init setup_serial_port(void)
4973b4390fSRalf Baechle {
5073b4390fSRalf Baechle 	rb532_uart.uartclk = idt_cpu_freq;
5173b4390fSRalf Baechle 
5273b4390fSRalf Baechle 	return early_serial_setup(&rb532_uart);
5373b4390fSRalf Baechle }
5473b4390fSRalf Baechle arch_initcall(setup_serial_port);
55