From dd2f7669138d4f8dd9753cade49659e6e1158240 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 6 Dec 2012 22:39:33 +0000 Subject: [adm8668] implement early_printk without an early_console Signed-off-by: Florian Fainelli git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34547 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/adm8668/files/arch/mips/adm8668/Makefile | 2 +- .../adm8668/files/arch/mips/adm8668/early_printk.c | 16 +++++++++ .../linux/adm8668/files/arch/mips/adm8668/prom.c | 42 ---------------------- 3 files changed, 17 insertions(+), 43 deletions(-) create mode 100644 target/linux/adm8668/files/arch/mips/adm8668/early_printk.c (limited to 'target/linux/adm8668/files/arch') diff --git a/target/linux/adm8668/files/arch/mips/adm8668/Makefile b/target/linux/adm8668/files/arch/mips/adm8668/Makefile index c69864d164..dbd3f12d11 100644 --- a/target/linux/adm8668/files/arch/mips/adm8668/Makefile +++ b/target/linux/adm8668/files/arch/mips/adm8668/Makefile @@ -3,5 +3,5 @@ # obj-y := irq.o pci.o prom.o platform.o serial.o proc.o \ - setup.o time.o \ + setup.o time.o early_printk.o \ net_core.o net_intr.o diff --git a/target/linux/adm8668/files/arch/mips/adm8668/early_printk.c b/target/linux/adm8668/files/arch/mips/adm8668/early_printk.c new file mode 100644 index 0000000000..2a3e87148a --- /dev/null +++ b/target/linux/adm8668/files/arch/mips/adm8668/early_printk.c @@ -0,0 +1,16 @@ +#include +#include +#include + +#define UART_READ(r) \ + __raw_readl((void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r))) + +#define UART_WRITE(v, r) \ + __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r))) + +void prom_putchar(char c) +{ + UART_WRITE(c, UART_DR_REG); + while ((UART_READ(UART_FR_REG) & UART_TX_FIFO_FULL) != 0) + ; +} diff --git a/target/linux/adm8668/files/arch/mips/adm8668/prom.c b/target/linux/adm8668/files/arch/mips/adm8668/prom.c index 7187f29825..24b77f8b9d 100644 --- a/target/linux/adm8668/files/arch/mips/adm8668/prom.c +++ b/target/linux/adm8668/files/arch/mips/adm8668/prom.c @@ -25,44 +25,6 @@ register volatile struct global_data *gd asm ("k0"); -#ifdef CONFIG_SERIAL_ADM8668_CONSOLE -static inline unsigned int adm_uart_readl(unsigned int offset) -{ - return (*(volatile unsigned int *)(0xbe400000 + offset)); -} - -static inline void adm_uart_writel(unsigned int value, unsigned int offset) -{ - (*((volatile unsigned int *)(0xbe400000 + offset))) = value; -} - -static void prom_putchar(char c) -{ - adm_uart_writel(c, UART_DR_REG); - while ((adm_uart_readl(UART_FR_REG) & UART_TX_FIFO_FULL) != 0) - ; -} - -static void __init -early_console_write(struct console *con, const char *s, unsigned n) -{ - while (n-- && *s) { - if (*s == '\n') - prom_putchar('\r'); - prom_putchar(*s); - s++; - } -} - -static struct console early_console __initdata = { - .name = "early", - .write = early_console_write, - .flags = CON_BOOT, - .index = -1 -}; - -#endif - void __init prom_free_prom_memory(void) { /* No prom memory to free */ @@ -122,10 +84,6 @@ void __init prom_init(void) bd_t *bd = gd->bd; int memsize; -#ifdef CONFIG_SERIAL_ADM8668_CONSOLE - register_console(&early_console); -#endif - memsize = bd->bi_memsize; printk("Board info:\n"); printk(" RAM size: %d MB\n", (int)memsize/(1024*1024)); -- cgit v1.2.3