Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177917
b: refs/heads/master
c: c3d8d85
h: refs/heads/master
i:
  177915: 1859f32
v: v3
  • Loading branch information
Wu Zhangjin authored and Ralf Baechle committed Dec 17, 2009
1 parent 517fb30 commit f4abdd5
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c47a48d83a7a82c86ff3e74bdcabeee8f6e6b730
refs/heads/master: c3d8d85019c9e4f6e4f23d194b6432a2c2464372
14 changes: 11 additions & 3 deletions trunk/arch/mips/include/asm/mach-loongson/loongson.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ extern void __init prom_init_memory(void);
extern void __init prom_init_cmdline(void);
extern void __init prom_init_machtype(void);
extern void __init prom_init_env(void);
extern unsigned long _loongson_uart_base;
extern unsigned long uart8250_base[];
extern void prom_init_uart_base(void);
#ifdef CONFIG_LOONGSON_UART_BASE
extern unsigned long _loongson_uart_base, loongson_uart_base;
extern void prom_init_loongson_uart_base(void);
#endif

static inline void prom_init_uart_base(void)
{
#ifdef CONFIG_LOONGSON_UART_BASE
prom_init_loongson_uart_base();
#endif
}

/* irq operation functions */
extern void bonito_irqdispatch(void);
Expand Down
5 changes: 5 additions & 0 deletions trunk/arch/mips/loongson/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@ config LOONGSON_SUSPEND
bool
default y
depends on CPU_SUPPORTS_CPUFREQ && SUSPEND

config LOONGSON_UART_BASE
bool
default y
depends on EARLY_PRINTK || SERIAL_8250
5 changes: 3 additions & 2 deletions trunk/arch/mips/loongson/common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
#

obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \
pci.o bonito-irq.o mem.o machtype.o platform.o uart_base.o
pci.o bonito-irq.o mem.o machtype.o platform.o

#
# Early printk support
# Serial port support
#
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_SERIAL_8250) += serial.o
obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o

#
# Enable CS5536 Virtual Support Module(VSM) to virtulize the PCI configure
Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/mips/loongson/common/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ void __init prom_init(void)
prom_init_memory();

/*init the uart base address */
#if defined(CONFIG_EARLY_PRINTK) || defined(CONFIG_SERIAL_8250)
prom_init_uart_base();
#endif
}

void __init prom_free_prom_memory(void)
Expand Down
10 changes: 7 additions & 3 deletions trunk/arch/mips/loongson/common/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ static struct platform_device uart8250_device = {

static int __init serial_init(void)
{
if (uart8250_data[mips_machtype][0].iotype == UPIO_MEM)
unsigned char iotype;

iotype = uart8250_data[mips_machtype][0].iotype;

if (UPIO_MEM == iotype)
uart8250_data[mips_machtype][0].membase =
(void __iomem *)_loongson_uart_base;
else if (uart8250_data[mips_machtype][0].iotype == UPIO_PORT)
else if (UPIO_PORT == iotype)
uart8250_data[mips_machtype][0].iobase =
uart8250_base[mips_machtype] - LOONGSON_PCIIO_BASE;
loongson_uart_base - LOONGSON_PCIIO_BASE;

uart8250_device.dev.platform_data = uart8250_data[mips_machtype];

Expand Down
41 changes: 25 additions & 16 deletions trunk/arch/mips/loongson/common/uart_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit f4abdd5

Please sign in to comment.