xref: /linux/arch/mips/loongson2ef/common/uart_base.c (revision c95baf12f5077419db01313ab61c2aac007d40cd)
171e2f4ddSJiaxun Yang // SPDX-License-Identifier: GPL-2.0-or-later
271e2f4ddSJiaxun Yang /*
371e2f4ddSJiaxun Yang  * Copyright (C) 2009 Lemote Inc.
471e2f4ddSJiaxun Yang  * Author: Wu Zhangjin, wuzhangjin@gmail.com
571e2f4ddSJiaxun Yang  */
671e2f4ddSJiaxun Yang 
771e2f4ddSJiaxun Yang #include <linux/export.h>
871e2f4ddSJiaxun Yang #include <asm/bootinfo.h>
9*574b9a04SJiaxun Yang #include <asm/setup.h>
1071e2f4ddSJiaxun Yang 
1171e2f4ddSJiaxun Yang #include <loongson.h>
1271e2f4ddSJiaxun Yang 
1371e2f4ddSJiaxun Yang /* raw */
145831fdb0SJiaxun Yang unsigned long loongson_uart_base;
1571e2f4ddSJiaxun Yang /* ioremapped */
165831fdb0SJiaxun Yang unsigned long _loongson_uart_base;
1771e2f4ddSJiaxun Yang 
1871e2f4ddSJiaxun Yang EXPORT_SYMBOL(loongson_uart_base);
1971e2f4ddSJiaxun Yang EXPORT_SYMBOL(_loongson_uart_base);
2071e2f4ddSJiaxun Yang 
prom_init_loongson_uart_base(void)2171e2f4ddSJiaxun Yang void prom_init_loongson_uart_base(void)
2271e2f4ddSJiaxun Yang {
2371e2f4ddSJiaxun Yang 	switch (mips_machtype) {
2471e2f4ddSJiaxun Yang 	case MACH_LEMOTE_FL2E:
255831fdb0SJiaxun Yang 		loongson_uart_base = LOONGSON_PCIIO_BASE + 0x3f8;
2671e2f4ddSJiaxun Yang 		break;
2771e2f4ddSJiaxun Yang 	case MACH_LEMOTE_FL2F:
2871e2f4ddSJiaxun Yang 	case MACH_LEMOTE_LL2F:
295831fdb0SJiaxun Yang 		loongson_uart_base = LOONGSON_PCIIO_BASE + 0x2f8;
3071e2f4ddSJiaxun Yang 		break;
3171e2f4ddSJiaxun Yang 	case MACH_LEMOTE_ML2F7:
3271e2f4ddSJiaxun Yang 	case MACH_LEMOTE_YL2F89:
3371e2f4ddSJiaxun Yang 	case MACH_DEXXON_GDIUM2F10:
3471e2f4ddSJiaxun Yang 	case MACH_LEMOTE_NAS:
3571e2f4ddSJiaxun Yang 	default:
3671e2f4ddSJiaxun Yang 		/* The CPU provided serial port (LPC) */
375831fdb0SJiaxun Yang 		loongson_uart_base = LOONGSON_LIO1_BASE + 0x3f8;
3871e2f4ddSJiaxun Yang 		break;
3971e2f4ddSJiaxun Yang 	}
4071e2f4ddSJiaxun Yang 
415831fdb0SJiaxun Yang 	_loongson_uart_base = TO_UNCAC(loongson_uart_base);
42*574b9a04SJiaxun Yang 	setup_8250_early_printk_port(_loongson_uart_base, 0, 1024);
4371e2f4ddSJiaxun Yang }
44