MIPS: Loongson: Cleanups of serial port support

This patchs uses a loongson_uart_base variable instead of the
uart_base[] array and adds a new kernel option to avoid to compile
uart_base.c all the time, which will save a little bit of memory for us.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
http://patchwork.linux-mips.org/patch/727/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Wu Zhangjin
2009-11-28 14:21:50 +08:00
committed by Ralf Baechle
parent c47a48d83a
commit c3d8d85019
6 changed files with 51 additions and 26 deletions

View File

@@ -13,24 +13,33 @@
#include <loongson.h>
unsigned long __maybe_unused _loongson_uart_base;
/* ioremapped */
unsigned long _loongson_uart_base;
EXPORT_SYMBOL(_loongson_uart_base);
/* raw */
unsigned long loongson_uart_base;
EXPORT_SYMBOL(loongson_uart_base);
unsigned long __maybe_unused uart8250_base[] = {
[MACH_LOONGSON_UNKNOWN] 0,
[MACH_LEMOTE_FL2E] (LOONGSON_PCIIO_BASE + 0x3f8),
[MACH_LEMOTE_FL2F] (LOONGSON_PCIIO_BASE + 0x2f8),
[MACH_LEMOTE_ML2F7] (LOONGSON_LIO1_BASE + 0x3f8),
[MACH_LEMOTE_YL2F89] (LOONGSON_LIO1_BASE + 0x3f8),
[MACH_DEXXON_GDIUM2F10] (LOONGSON_LIO1_BASE + 0x3f8),
[MACH_LEMOTE_NAS] (LOONGSON_LIO1_BASE + 0x3f8),
[MACH_LEMOTE_LL2F] (LOONGSON_PCIIO_BASE + 0x2f8),
[MACH_LOONGSON_END] 0,
};
EXPORT_SYMBOL(uart8250_base);
void __maybe_unused prom_init_uart_base(void)
void prom_init_loongson_uart_base(void)
{
switch (mips_machtype) {
case MACH_LEMOTE_FL2E:
loongson_uart_base = LOONGSON_PCIIO_BASE + 0x3f8;
break;
case MACH_LEMOTE_FL2F:
case MACH_LEMOTE_LL2F:
loongson_uart_base = LOONGSON_PCIIO_BASE + 0x2f8;
break;
case MACH_LEMOTE_ML2F7:
case MACH_LEMOTE_YL2F89:
case MACH_DEXXON_GDIUM2F10:
case MACH_LEMOTE_NAS:
default:
/* The CPU provided serial port */
loongson_uart_base = LOONGSON_LIO1_BASE + 0x3f8;
break;
}
_loongson_uart_base =
(unsigned long)ioremap_nocache(uart8250_base[mips_machtype], 8);
(unsigned long)ioremap_nocache(loongson_uart_base, 8);
}