Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 Lemote Inc. |
Wu Zhangjin | f7a904d | 2010-01-04 17:16:51 +0800 | [diff] [blame] | 3 | * Author: Wu Zhangjin, wuzhangjin@gmail.com |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 4 | * |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 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 |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 7 | * 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 Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 16 | /* raw */ |
Huacai Chen | 3adeb25 | 2014-11-04 14:13:27 +0800 | [diff] [blame] | 17 | unsigned long loongson_uart_base[MAX_UARTS] = {}; |
| 18 | /* ioremapped */ |
| 19 | unsigned long _loongson_uart_base[MAX_UARTS] = {}; |
| 20 | |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 21 | EXPORT_SYMBOL(loongson_uart_base); |
Huacai Chen | 3adeb25 | 2014-11-04 14:13:27 +0800 | [diff] [blame] | 22 | EXPORT_SYMBOL(_loongson_uart_base); |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 23 | |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 24 | void prom_init_loongson_uart_base(void) |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 25 | { |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 26 | switch (mips_machtype) { |
Huacai Chen | 3adeb25 | 2014-11-04 14:13:27 +0800 | [diff] [blame] | 27 | case MACH_LOONGSON_GENERIC: |
| 28 | /* The CPU provided serial port (CPU) */ |
| 29 | loongson_uart_base[0] = LOONGSON_REG_BASE + 0x1e0; |
| 30 | break; |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 31 | case MACH_LEMOTE_FL2E: |
Huacai Chen | 3adeb25 | 2014-11-04 14:13:27 +0800 | [diff] [blame] | 32 | loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x3f8; |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 33 | break; |
| 34 | case MACH_LEMOTE_FL2F: |
| 35 | case MACH_LEMOTE_LL2F: |
Huacai Chen | 3adeb25 | 2014-11-04 14:13:27 +0800 | [diff] [blame] | 36 | loongson_uart_base[0] = LOONGSON_PCIIO_BASE + 0x2f8; |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 37 | break; |
| 38 | case MACH_LEMOTE_ML2F7: |
| 39 | case MACH_LEMOTE_YL2F89: |
| 40 | case MACH_DEXXON_GDIUM2F10: |
| 41 | case MACH_LEMOTE_NAS: |
| 42 | default: |
Huacai Chen | 7546d2f | 2014-03-21 18:44:05 +0800 | [diff] [blame] | 43 | /* The CPU provided serial port (LPC) */ |
Huacai Chen | 3adeb25 | 2014-11-04 14:13:27 +0800 | [diff] [blame] | 44 | loongson_uart_base[0] = LOONGSON_LIO1_BASE + 0x3f8; |
Huacai Chen | 7546d2f | 2014-03-21 18:44:05 +0800 | [diff] [blame] | 45 | break; |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 46 | } |
| 47 | |
Huacai Chen | 3adeb25 | 2014-11-04 14:13:27 +0800 | [diff] [blame] | 48 | _loongson_uart_base[0] = |
| 49 | (unsigned long)ioremap_nocache(loongson_uart_base[0], 8); |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 50 | } |