diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-12-12 22:57:16 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-12-12 22:57:16 +0000 |
commit | 18a076fccdba90cd7bea1dd4cff1b6b0559b75f0 (patch) | |
tree | 24f859f8849a0d5180c1bef85c758ce70aa43c80 /target/linux/lantiq/patches/106-early_printk.patch | |
parent | 8d8d887cb0eb75aed9192aadf2000308292548d1 (diff) |
[lantiq] adds new lantiq kernel. once the codebase is fully tested and know to be working on all the devices previously supported by ifxmips, we will drop ifxmips support.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24526 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/lantiq/patches/106-early_printk.patch')
-rw-r--r-- | target/linux/lantiq/patches/106-early_printk.patch | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/target/linux/lantiq/patches/106-early_printk.patch b/target/linux/lantiq/patches/106-early_printk.patch new file mode 100644 index 0000000000..34e0bdf4d2 --- /dev/null +++ b/target/linux/lantiq/patches/106-early_printk.patch @@ -0,0 +1,93 @@ +--- a/arch/mips/lantiq/Kconfig ++++ b/arch/mips/lantiq/Kconfig +@@ -33,4 +33,19 @@ endchoice + source "arch/mips/lantiq/falcon/Kconfig" + source "arch/mips/lantiq/xway/Kconfig" + ++if EARLY_PRINTK ++choice ++ prompt "Early printk port" ++ default LANTIQ_PROM_ASC1 ++ help ++ Choose which serial port is used, until the console driver is loaded ++ ++config LANTIQ_PROM_ASC0 ++ bool "ASC0" ++ ++config LANTIQ_PROM_ASC1 ++ bool "ASC1" ++endchoice ++endif ++ + endif +--- /dev/null ++++ b/arch/mips/lantiq/early_printk.c +@@ -0,0 +1,68 @@ ++/* ++ * 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. ++ * ++ * Copyright (C) 2010 John Crispin <blogic@openwrt.org> ++ */ ++ ++#include <linux/init.h> ++#include <linux/cpu.h> ++ ++#include <lantiq.h> ++ ++#ifdef CONFIG_SOC_LANTIQ_XWAY ++#include <xway.h> ++#ifdef CONFIG_LANTIQ_PROM_ASC0 ++#define LQ_ASC_BASE KSEG1ADDR(LQ_ASC0_BASE) ++#else ++#define LQ_ASC_BASE KSEG1ADDR(LQ_ASC1_BASE) ++#endif ++ ++#elif CONFIG_SOC_LANTIQ_FALCON ++#include <falcon/gpon_reg_base.h> ++#ifdef CONFIG_LANTIQ_PROM_ASC0 ++#define LQ_ASC_BASE GPON_ASC0_BASE ++#else ++#define LQ_ASC_BASE GPON_ASC1_BASE ++#endif ++ ++#endif ++ ++#define ASC_BUF 1024 ++#define LQ_ASC_FSTAT 0x0048 ++#define LQ_ASC_TBUF 0x0020 ++#define TXMASK 0x3F00 ++#define TXOFFSET 8 ++ ++static char buf[ASC_BUF]; ++ ++void ++prom_putchar(char c) ++{ ++ unsigned long flags; ++ ++ local_irq_save(flags); ++ while ((lq_r32((u32 *)(LQ_ASC_BASE + LQ_ASC_FSTAT)) & TXMASK) >> TXOFFSET); ++ ++ if (c == '\n') ++ lq_w32('\r', (u32 *)(LQ_ASC_BASE + LQ_ASC_TBUF)); ++ lq_w32(c, (u32 *)(LQ_ASC_BASE + LQ_ASC_TBUF)); ++ local_irq_restore(flags); ++} ++ ++void ++early_printf(const char *fmt, ...) ++{ ++ va_list args; ++ int l; ++ char *p, *buf_end; ++ ++ va_start(args, fmt); ++ l = vsnprintf(buf, ASC_BUF, fmt, args); ++ va_end(args); ++ buf_end = buf + l; ++ ++ for (p = buf; p < buf_end; p++) ++ prom_putchar(*p); ++} |