From: Kevin Hao <kexin....@windriver.com>

When using udbg on acpx1, we must be sure that all the IO accesses
are in AS1 because the tlb we create for early debug is set with AS1.
This is also compatible with other 4xx device.

Signed-off-by: Kevin Hao <kexin....@windriver.com>
---
 arch/powerpc/kernel/udbg_16550.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index c214a96..e7baf51 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -223,32 +223,34 @@ void udbg_init_pas_realmode(void)
 #include <asm/io.h>
 #include <asm/udbg.h>
 #include <linux/amba/serial.h>
+#include <platforms/44x/44x.h>
 
 static void *uart_base;
 
 static void
-acp_putc(char c)
+acp_putc_as1(char c)
 {
-       while (0 != (in_le32(uart_base + UART01x_FR) & UART01x_FR_TXFF))
+
+       while (0 != (as1_readb(uart_base + UART01x_FR) & UART01x_FR_TXFF))
                ;
 
        if ('\n' == c) {
-               out_le32(uart_base + UART01x_DR, '\r');
-               while (0 != (in_le32(uart_base + UART01x_FR) & UART01x_FR_TXFF))
+               as1_writeb('\r', uart_base + UART01x_DR);
+               while (0 != (as1_readb(uart_base + UART01x_FR) & 
UART01x_FR_TXFF))
                        ;
        }
 
-       out_le32(uart_base + UART01x_DR, c);
+       as1_writeb(c, uart_base + UART01x_DR);
 
        return;
 }
 
 static int
-acp_getc(void)
+acp_getc_as1(void)
 {
-       while (0 != (in_le32(uart_base + UART01x_FR) & UART01x_FR_RXFE))
+       while (0 != (as1_readb(uart_base + UART01x_FR) & UART01x_FR_RXFE))
                ;
-       return in_le32(uart_base + UART01x_DR);
+       return as1_readb(uart_base + UART01x_DR);
 }
 
 void __init
@@ -256,13 +258,13 @@ udbg_init_44x_as1(void)
 {
        uart_base = (void *)0xf0004000; /* 34xx UART0 address... */
 
-       if (0x11 != in_le32(uart_base + 0xfe0) ||
-           0x10 != in_le32(uart_base + 0xfe4) ||
-           0x24 != in_le32(uart_base + 0xfe8) ||
-           0x00 != in_le32(uart_base + 0xfec))
+       if (0x11 != as1_readb(uart_base + 0xfe0) ||
+           0x10 != as1_readb(uart_base + 0xfe4) ||
+           0x24 != as1_readb(uart_base + 0xfe8) ||
+           0x00 != as1_readb(uart_base + 0xfec))
                uart_base = (void *)0xf0024000; /* 25xx UART0 address... */
-       udbg_putc = acp_putc;
-       udbg_getc = acp_getc;
+       udbg_putc = acp_putc_as1;
+       udbg_getc = acp_getc_as1;
 
        return;
 }
-- 
1.8.3

_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to