From: Mark A. Greer <[email protected]>

The davinci pre-kernel boot code assumes that all platforms use the
same UART base address for the console.  That assumption is not longer
valid with some newer SoCs so determine the console UART base address
from the machine number passed in from u-boot.

Signed-off-by: Mark A. Greer <[email protected]>
Signed-off-by: Kevin Hilman <[email protected]>
---
 arch/arm/boot/compressed/Makefile               |    4 ++++
 arch/arm/boot/compressed/head-davinci.S         |   19 +++++++++++++++++++
 arch/arm/mach-davinci/include/mach/uncompress.h |   19 +++++++++++++++++--
 3 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boot/compressed/head-davinci.S

diff --git a/arch/arm/boot/compressed/Makefile 
b/arch/arm/boot/compressed/Makefile
index fbe5eef..af1b23b 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -48,6 +48,10 @@ else
 endif
 endif
 
+ifeq ($(CONFIG_ARCH_DAVINCI),y)
+OBJS           += head-davinci.o
+endif
+
 #
 # We now have a PIC decompressor implementation.  Decompressors running
 # from RAM should not define ZTEXTADDR.  Decompressors running directly
diff --git a/arch/arm/boot/compressed/head-davinci.S 
b/arch/arm/boot/compressed/head-davinci.S
new file mode 100644
index 0000000..4a269e9
--- /dev/null
+++ b/arch/arm/boot/compressed/head-davinci.S
@@ -0,0 +1,19 @@
+/*
+ * DaVinci (and relatives) specific tweaks.
+ * This is merged into head.S by the linker.
+ */
+
+#include <linux/linkage.h>
+#include <asm/mach-types.h>
+
+               .section        ".start", "ax"
+
+__davinci_start:
+               /* Save machine number for later conditional code */
+               adr     r0, davinci_machine_no
+               str     r7, [r0]
+
+               .text
+               .globl  davinci_machine_no
+davinci_machine_no:
+               .word   0x00000000
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h 
b/arch/arm/mach-davinci/include/mach/uncompress.h
index 8c165de..95bb814 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -13,11 +13,24 @@
 #include <linux/serial_reg.h>
 #include <mach/serial.h>
 
+#include <asm/mach-types.h>
+
+extern u32 davinci_machine_no;
+
+static u32 *uart;
+
+static u32 *get_uart_base(void)
+{
+       /* Add logic here for new platforms */
+       return (u32 *)DAVINCI_UART0_BASE;
+}
+
 /* PORT_16C550A, in polled non-fifo mode */
 
 static void putc(char c)
 {
-       volatile u32 *uart = (volatile void *) DAVINCI_UART0_BASE;
+       if (!uart)
+               uart = get_uart_base();
 
        while (!(uart[UART_LSR] & UART_LSR_THRE))
                barrier();
@@ -26,7 +39,9 @@ static void putc(char c)
 
 static inline void flush(void)
 {
-       volatile u32 *uart = (volatile void *) DAVINCI_UART0_BASE;
+       if (!uart)
+               uart = get_uart_base();
+
        while (!(uart[UART_LSR] & UART_LSR_THRE))
                barrier();
 }
-- 
1.6.2.2


_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to