summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-12-06 22:39:33 +0000
committerFlorian Fainelli <florian@openwrt.org>2012-12-06 22:39:33 +0000
commit2dee2133c5d6a3aa87b341c09c8978dd771edb94 (patch)
tree99675ca56b6cc2f0fa23f86426bc89f1957c5592
parentf85115efd8e3ef399f015bbbe9d9468d5a5ba8b4 (diff)
downloadmaster-31e0f0ae-2dee2133c5d6a3aa87b341c09c8978dd771edb94.tar.gz
master-31e0f0ae-2dee2133c5d6a3aa87b341c09c8978dd771edb94.tar.bz2
master-31e0f0ae-2dee2133c5d6a3aa87b341c09c8978dd771edb94.zip
implement early_printk without an early_console
Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 34547
-rw-r--r--target/linux/adm8668/config-3.35
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/Makefile2
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/early_printk.c16
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/prom.c42
-rw-r--r--target/linux/adm8668/patches-3.3/001-adm8668_arch.patch3
5 files changed, 24 insertions, 44 deletions
diff --git a/target/linux/adm8668/config-3.3 b/target/linux/adm8668/config-3.3
index 60fd062a1c..efdab2e0a2 100644
--- a/target/linux/adm8668/config-3.3
+++ b/target/linux/adm8668/config-3.3
@@ -5,6 +5,9 @@ CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_CEVT_R4K=y
CONFIG_CEVT_R4K_LIB=y
+CONFIG_CMDLINE="console=ttyS0 earlyprintk"
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE_OVERRIDE=y
CONFIG_CPU_HAS_PREFETCH=y
CONFIG_CPU_HAS_SYNC=y
CONFIG_CPU_LITTLE_ENDIAN=y
@@ -17,6 +20,7 @@ CONFIG_CSRC_R4K=y
CONFIG_CSRC_R4K_LIB=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
CONFIG_EEPROM_93CX6=m
CONFIG_GENERIC_ATOMIC64=y
CONFIG_GENERIC_CLOCKEVENTS=y
@@ -69,6 +73,7 @@ CONFIG_SERIAL_ADM8668=y
CONFIG_SERIAL_ADM8668_CONSOLE=y
CONFIG_SWAP_IO_SPACE=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
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 <linux/io.h>
+#include <linux/serial_core.h>
+#include <adm8668.h>
+
+#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));
diff --git a/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch b/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch
index c00188cf0d..53a627ecc1 100644
--- a/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch
+++ b/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch
@@ -10,7 +10,7 @@
include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
-@@ -105,6 +105,26 @@ config BCM47XX
+@@ -105,6 +105,27 @@ config BCM47XX
help
Support for BCM47XX based boards
@@ -30,6 +30,7 @@
+ select SWAP_IO_SPACE
+ select SERIAL_ADM8668
+ select SERIAL_ADM8668_CONSOLE
++ select SYS_HAS_EARLY_PRINTK
+ help
+ ADM8668 board support by neutronscott
+ Scott Nicholas <neutronscott@scottn.us>