blob: 9de559d58e1fc6d0aee540185dc22e0c87d8ad2c [file] [log] [blame]
Wu Zhangjina3ed4952009-11-06 18:35:34 +08001/*
2 * Copyright (C) 2009 Lemote Inc.
Wu Zhangjinf7a904d2010-01-04 17:16:51 +08003 * Author: Wu Zhangjin, wuzhangjin@gmail.com
Wu Zhangjina3ed4952009-11-06 18:35:34 +08004 *
Ralf Baechle70342282013-01-22 12:59:30 +01005 * 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
Wu Zhangjina3ed4952009-11-06 18:35:34 +08007 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/module.h>
12#include <asm/bootinfo.h>
13
14#include <loongson.h>
15
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080016/* raw */
Huacai Chen3adeb252014-11-04 14:13:27 +080017unsigned long loongson_uart_base[MAX_UARTS] = {};
18/* ioremapped */
19unsigned long _loongson_uart_base[MAX_UARTS] = {};
20
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080021EXPORT_SYMBOL(loongson_uart_base);
Huacai Chen3adeb252014-11-04 14:13:27 +080022EXPORT_SYMBOL(_loongson_uart_base);
Wu Zhangjina3ed4952009-11-06 18:35:34 +080023
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080024void prom_init_loongson_uart_base(void)
Wu Zhangjina3ed4952009-11-06 18:35:34 +080025{
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080026 switch (mips_machtype) {
Huacai Chen3adeb252014-11-04 14:13:27 +080027 case MACH_LOONGSON_GENERIC:
28 /* The CPU provided serial port (CPU) */
29 loongson_uart_base[0] = LOONGSON_REG_BASE + 0x1e0;
30 break;
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080031 case MACH_LEMOTE_FL2E:
Huacai Chen3adeb252014-11-04 14:13:27 +080032 loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x3f8;
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080033 break;
34 case MACH_LEMOTE_FL2F:
35 case MACH_LEMOTE_LL2F:
Huacai Chen3adeb252014-11-04 14:13:27 +080036 loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x2f8;
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080037 break;
38 case MACH_LEMOTE_ML2F7:
39 case MACH_LEMOTE_YL2F89:
40 case MACH_DEXXON_GDIUM2F10:
41 case MACH_LEMOTE_NAS:
42 default:
Huacai Chen7546d2f2014-03-21 18:44:05 +080043 /* The CPU provided serial port (LPC) */
Huacai Chen3adeb252014-11-04 14:13:27 +080044 loongson_uart_base[0] = LOONGSON_LIO1_BASE + 0x3f8;
Huacai Chen7546d2f2014-03-21 18:44:05 +080045 break;
Wu Zhangjinc3d8d852009-11-28 14:21:50 +080046 }
47
Huacai Chen3adeb252014-11-04 14:13:27 +080048 _loongson_uart_base[0] =
49 (unsigned long)ioremap_nocache(loongson_uart_base[0], 8);
Wu Zhangjina3ed4952009-11-06 18:35:34 +080050}