d8284c781dfe720b3d74d21b3185cc78f7c06e5a
[openwrt.git] / target / linux / lantiq / patches-3.2 / 0011-MIPS-lantiq-fix-early-printk.patch
1 From 993160b530efe9b0d3f0bc4551954a4c3344beeb Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sat, 20 Aug 2011 18:55:13 +0200
4 Subject: [PATCH 11/73] MIPS: lantiq: fix early printk
5
6 The code was using a 32bit write operations in the early_printk code. This
7 resulted in 3 zero bytes also being written to the serial port. This patch
8 changes the memory access to 8bit.
9
10 Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
11 Signed-off-by: John Crispin <blogic@openwrt.org>
12 ---
13  .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h |    6 ++++++
14  arch/mips/lantiq/early_printk.c                    |   14 ++++++++------
15  2 files changed, 14 insertions(+), 6 deletions(-)
16
17 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
18 +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
19 @@ -34,6 +34,12 @@
20  #define LTQ_ASC1_BASE_ADDR     0x1E100C00
21  #define LTQ_ASC_SIZE           0x400
22  
23 +/*
24 + * during early_printk no ioremap is possible
25 + * lets use KSEG1 instead
26 + */
27 +#define LTQ_EARLY_ASC          KSEG1ADDR(LTQ_ASC1_BASE_ADDR)
28 +
29  /* RCU - reset control unit */
30  #define LTQ_RCU_BASE_ADDR      0x1F203000
31  #define LTQ_RCU_SIZE           0x1000
32 --- a/arch/mips/lantiq/early_printk.c
33 +++ b/arch/mips/lantiq/early_printk.c
34 @@ -12,11 +12,13 @@
35  #include <lantiq.h>
36  #include <lantiq_soc.h>
37  
38 -/* no ioremap possible at this early stage, lets use KSEG1 instead  */
39 -#define LTQ_ASC_BASE   KSEG1ADDR(LTQ_ASC1_BASE_ADDR)
40  #define ASC_BUF                1024
41 -#define LTQ_ASC_FSTAT  ((u32 *)(LTQ_ASC_BASE + 0x0048))
42 -#define LTQ_ASC_TBUF   ((u32 *)(LTQ_ASC_BASE + 0x0020))
43 +#define LTQ_ASC_FSTAT  ((u32 *)(LTQ_EARLY_ASC + 0x0048))
44 +#ifdef __BIG_ENDIAN
45 +#define LTQ_ASC_TBUF   ((u32 *)(LTQ_EARLY_ASC + 0x0020 + 3))
46 +#else
47 +#define LTQ_ASC_TBUF   ((u32 *)(LTQ_EARLY_ASC + 0x0020))
48 +#endif
49  #define TXMASK         0x3F00
50  #define TXOFFSET       8
51  
52 @@ -27,7 +29,7 @@ void prom_putchar(char c)
53         local_irq_save(flags);
54         do { } while ((ltq_r32(LTQ_ASC_FSTAT) & TXMASK) >> TXOFFSET);
55         if (c == '\n')
56 -               ltq_w32('\r', LTQ_ASC_TBUF);
57 -       ltq_w32(c, LTQ_ASC_TBUF);
58 +               ltq_w8('\r', LTQ_ASC_TBUF);
59 +       ltq_w8(c, LTQ_ASC_TBUF);
60         local_irq_restore(flags);
61  }