1 /*
2  * Copyright (C) 2009 Lemote Inc.
3  * Author: Wu Zhangjin, wuzhangjin@gmail.com
4  *
5  * This program is free software; you can redistribute	it and/or modify it
6  * under  the terms of	the GNU General	 Public License as published by the
7  * Free Software Foundation;  either version 2 of the  License, or (at your
8  * option) any later version.
9  */
10 
11 #include <linux/export.h>
12 #include <asm/bootinfo.h>
13 
14 #include <loongson.h>
15 
16 /* raw */
17 unsigned long loongson_uart_base[MAX_UARTS] = {};
18 /* ioremapped */
19 unsigned long _loongson_uart_base[MAX_UARTS] = {};
20 
21 EXPORT_SYMBOL(loongson_uart_base);
22 EXPORT_SYMBOL(_loongson_uart_base);
23 
prom_init_loongson_uart_base(void)24 void prom_init_loongson_uart_base(void)
25 {
26 	switch (mips_machtype) {
27 	case MACH_LOONGSON_GENERIC:
28 		/* The CPU provided serial port (CPU) */
29 		loongson_uart_base[0] = LOONGSON_REG_BASE + 0x1e0;
30 		break;
31 	case MACH_LEMOTE_FL2E:
32 		loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x3f8;
33 		break;
34 	case MACH_LEMOTE_FL2F:
35 	case MACH_LEMOTE_LL2F:
36 		loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x2f8;
37 		break;
38 	case MACH_LEMOTE_ML2F7:
39 	case MACH_LEMOTE_YL2F89:
40 	case MACH_DEXXON_GDIUM2F10:
41 	case MACH_LEMOTE_NAS:
42 	default:
43 		/* The CPU provided serial port (LPC) */
44 		loongson_uart_base[0] = LOONGSON_LIO1_BASE + 0x3f8;
45 		break;
46 	}
47 
48 	_loongson_uart_base[0] =
49 		(unsigned long)ioremap_nocache(loongson_uart_base[0], 8);
50 }
51