mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-26 14:59:34 +02:00
18a076fccd
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24526 3c298f89-4303-0410-b956-a3cf2f4a3e73
94 lines
1.9 KiB
Diff
94 lines
1.9 KiB
Diff
--- 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);
|
|
+}
|