From 4bcca707cf9d599e225632f9eca159e1064683e6 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 2 Jan 2010 15:07:34 +0000 Subject: adm5120: move early-printk support into a separate file git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19000 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/arch/mips/adm5120/common/Makefile | 2 ++ .../files/arch/mips/adm5120/common/early-printk.c | 29 ++++++++++++++++++++++ .../adm5120/files/arch/mips/adm5120/common/prom.c | 16 ------------ 3 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 target/linux/adm5120/files/arch/mips/adm5120/common/early-printk.c (limited to 'target/linux/adm5120/files') diff --git a/target/linux/adm5120/files/arch/mips/adm5120/common/Makefile b/target/linux/adm5120/files/arch/mips/adm5120/common/Makefile index d24aa0788..8d302c593 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/common/Makefile +++ b/target/linux/adm5120/files/arch/mips/adm5120/common/Makefile @@ -4,3 +4,5 @@ obj-y := adm5120.o setup.o prom.o irq.o memory.o clock.o \ gpio.o platform.o + +obj-$(CONFIG_EARLY_PRINTK) += early-printk.o diff --git a/target/linux/adm5120/files/arch/mips/adm5120/common/early-printk.c b/target/linux/adm5120/files/arch/mips/adm5120/common/early-printk.c new file mode 100644 index 000000000..6aff1475a --- /dev/null +++ b/target/linux/adm5120/files/arch/mips/adm5120/common/early-printk.c @@ -0,0 +1,29 @@ +/* + * ADM5120 specific early printk support + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include + +#include +#include +#include + +#define UART_READ(r) \ + __raw_readl((void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) +#define UART_WRITE(r, v) \ + __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) + +void __init prom_putchar(char ch) +{ + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); + UART_WRITE(UART_REG_DATA, ch); + while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); +} diff --git a/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c b/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c index 5b2e45def..adc9e8c71 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c @@ -13,15 +13,11 @@ #include #include #include -#include -#include #include #include #include -#include -#include #include #include @@ -254,18 +250,6 @@ static void __init prom_init_cmdline(void) static void inline prom_init_cmdline(void) {} #endif /* CONFIG_IMAGE_CMDLINE_HACK */ -#define UART_READ(r) \ - __raw_readl((void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) -#define UART_WRITE(r, v) \ - __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) - -void __init prom_putchar(char ch) -{ - while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); - UART_WRITE(UART_REG_DATA, ch); - while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); -} - void __init prom_init(void) { prom_detect_machtype(); -- cgit v1.2.3