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 | * |
| 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/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 | /* ioremapped */ |
| 17 | unsigned long _loongson_uart_base; |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 18 | EXPORT_SYMBOL(_loongson_uart_base); |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 19 | /* raw */ |
| 20 | unsigned long loongson_uart_base; |
| 21 | EXPORT_SYMBOL(loongson_uart_base); |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 22 | |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 23 | void prom_init_loongson_uart_base(void) |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 24 | { |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 25 | switch (mips_machtype) { |
| 26 | case MACH_LEMOTE_FL2E: |
| 27 | loongson_uart_base = LOONGSON_PCIIO_BASE + 0x3f8; |
| 28 | break; |
| 29 | case MACH_LEMOTE_FL2F: |
| 30 | case MACH_LEMOTE_LL2F: |
| 31 | loongson_uart_base = LOONGSON_PCIIO_BASE + 0x2f8; |
| 32 | break; |
| 33 | case MACH_LEMOTE_ML2F7: |
| 34 | case MACH_LEMOTE_YL2F89: |
| 35 | case MACH_DEXXON_GDIUM2F10: |
| 36 | case MACH_LEMOTE_NAS: |
| 37 | default: |
| 38 | /* The CPU provided serial port */ |
| 39 | loongson_uart_base = LOONGSON_LIO1_BASE + 0x3f8; |
| 40 | break; |
| 41 | } |
| 42 | |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 43 | _loongson_uart_base = |
Wu Zhangjin | c3d8d85 | 2009-11-28 14:21:50 +0800 | [diff] [blame] | 44 | (unsigned long)ioremap_nocache(loongson_uart_base, 8); |
Wu Zhangjin | a3ed495 | 2009-11-06 18:35:34 +0800 | [diff] [blame] | 45 | } |