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]> --- Many thanks to Kevin who essentially wrote this for me. arch/arm/boot/compressed/Makefile | 4 +++ arch/arm/boot/compressed/head-davinci.S | 19 ++++++++++++++++++ arch/arm/mach-davinci/include/mach/uncompress.h | 24 +++++++++++++++++++++- 3 files changed, 45 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 b0d7771..dc73717 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -48,6 +48,10 @@ else endif endif +ifeq ($(CONFIG_MACH_DAVINCI_EVM),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..28198f9 100644 --- a/arch/arm/mach-davinci/include/mach/uncompress.h +++ b/arch/arm/mach-davinci/include/mach/uncompress.h @@ -13,11 +13,27 @@ #include <linux/serial_reg.h> #include <mach/serial.h> +#include <asm/mach-types.h> + +extern u32 davinci_machine_no; + +static u8 first_time = 1; +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 (first_time) { + uart = get_uart_base(); + first_time = 0; + } while (!(uart[UART_LSR] & UART_LSR_THRE)) barrier(); @@ -26,7 +42,11 @@ static void putc(char c) static inline void flush(void) { - volatile u32 *uart = (volatile void *) DAVINCI_UART0_BASE; + if (first_time) { + uart = get_uart_base(); + first_time = 0; + } + while (!(uart[UART_LSR] & UART_LSR_THRE)) barrier(); } -- 1.6.0.3 _______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
