From e0fb3b63965109c9ae459e7316b4956cfdd61296 Mon Sep 17 00:00:00 2001 From: blogic Date: Wed, 25 Jun 2008 23:05:50 +0000 Subject: cleanup ifxmips and add support for both ttyS git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11578 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/ifxmips/files/arch/mips/ifxmips/prom.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'target/linux/ifxmips/files/arch/mips') diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c index 010d488ae..95630ae36 100644 --- a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c +++ b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c @@ -26,6 +26,18 @@ static char buf[1024]; unsigned int *prom_cp1_base = NULL; unsigned int prom_cp1_size = 0; +static inline u32 +asc_r32(unsigned long r) +{ + return ifxmips_r32((u32*)(IFXMIPS_ASC_BASE_ADDR + IFXMIPS_ASC_BASE_DIFF + r)); +} + +static inline void +asc_w32(u32 v, unsigned long r) +{ + ifxmips_w32(v, (u32*)(IFXMIPS_ASC_BASE_ADDR + IFXMIPS_ASC_BASE_DIFF + r)); +} + void prom_free_prom_memory(void) { @@ -34,11 +46,15 @@ prom_free_prom_memory(void) void prom_putchar(char c) { - while((ifxmips_r32(IFXMIPS_ASC1_FSTAT) & ASCFSTAT_TXFFLMASK) >> ASCFSTAT_TXFFLOFF); + unsigned long flags; + + local_irq_save(flags); + while((asc_r32(IFXMIPS_ASC_FSTAT) & ASCFSTAT_TXFFLMASK) >> ASCFSTAT_TXFFLOFF); if(c == '\n') - ifxmips_w32('\r', IFXMIPS_ASC1_TBUF); - ifxmips_w32(c, IFXMIPS_ASC1_TBUF); + asc_w32('\r', IFXMIPS_ASC_TBUF); + asc_w32(c, IFXMIPS_ASC_TBUF); + local_irq_restore(flags); } void -- cgit v1.2.3