1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (C) 2009 Lemote Inc. 4 * Author: Wu Zhangjin, wuzhangjin@gmail.com 5 */ 6 7 #include <linux/export.h> 8 #include <asm/bootinfo.h> 9 #include <asm/setup.h> 10 11 #include <loongson.h> 12 13 /* raw */ 14 unsigned long loongson_uart_base; 15 /* ioremapped */ 16 unsigned long _loongson_uart_base; 17 18 EXPORT_SYMBOL(loongson_uart_base); 19 EXPORT_SYMBOL(_loongson_uart_base); 20 prom_init_loongson_uart_base(void)21void prom_init_loongson_uart_base(void) 22 { 23 switch (mips_machtype) { 24 case MACH_LEMOTE_FL2E: 25 loongson_uart_base = LOONGSON_PCIIO_BASE + 0x3f8; 26 break; 27 case MACH_LEMOTE_FL2F: 28 case MACH_LEMOTE_LL2F: 29 loongson_uart_base = LOONGSON_PCIIO_BASE + 0x2f8; 30 break; 31 case MACH_LEMOTE_ML2F7: 32 case MACH_LEMOTE_YL2F89: 33 case MACH_DEXXON_GDIUM2F10: 34 case MACH_LEMOTE_NAS: 35 default: 36 /* The CPU provided serial port (LPC) */ 37 loongson_uart_base = LOONGSON_LIO1_BASE + 0x3f8; 38 break; 39 } 40 41 _loongson_uart_base = TO_UNCAC(loongson_uart_base); 42 setup_8250_early_printk_port(_loongson_uart_base, 0, 1024); 43 } 44