Commit d30c74a0 authored by Sascha Hauer's avatar Sascha Hauer

MXC uncompress macros: determine uart base by machine type

Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent abae6130
......@@ -26,8 +26,11 @@
#define __MXC_BOOT_UNCOMPRESS
#include <mach/hardware.h>
#include <asm/mach-types.h>
#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
static unsigned long uart_base;
#define UART(x) (*(volatile unsigned long *)(uart_base + (x)))
#define USR2 0x98
#define USR2_TXFE (1<<14)
......@@ -46,19 +49,10 @@
static void putc(int ch)
{
static unsigned long serial_port = 0;
if (unlikely(serial_port == 0)) {
do {
serial_port = UART1_BASE_ADDR;
if (UART(UCR1) & UCR1_UARTEN)
break;
serial_port = UART2_BASE_ADDR;
if (UART(UCR1) & UCR1_UARTEN)
break;
return;
} while (0);
}
if (!uart_base)
return;
if (!(UART(UCR1) & UCR1_UARTEN))
return;
while (!(UART(USR2) & USR2_TXFE))
barrier();
......@@ -68,11 +62,41 @@ static void putc(int ch)
#define flush() do { } while (0)
/*
* nothing to do
*/
#define arch_decomp_setup()
#define MX1_UART1_BASE_ADDR 0x00206000
#define MX2X_UART1_BASE_ADDR 0x1000a000
#define MX3X_UART1_BASE_ADDR 0x43F90000
static __inline__ void __arch_decomp_setup(unsigned long arch_id)
{
switch (arch_id) {
case MACH_TYPE_MX1ADS:
case MACH_TYPE_SCB9328:
uart_base = MX1_UART1_BASE_ADDR;
break;
case MACH_TYPE_IMX27LITE:
case MACH_TYPE_MX27_3DS:
case MACH_TYPE_MX27ADS:
case MACH_TYPE_PCM038:
case MACH_TYPE_MX21ADS:
uart_base = MX2X_UART1_BASE_ADDR;
break;
case MACH_TYPE_MX31LITE:
case MACH_TYPE_ARMADILLO5X0:
case MACH_TYPE_MX31MOBOARD:
case MACH_TYPE_QONG:
case MACH_TYPE_MX31_3DS:
case MACH_TYPE_PCM037:
case MACH_TYPE_MX31ADS:
case MACH_TYPE_MX35_3DS:
case MACH_TYPE_PCM043:
uart_base = MX3X_UART1_BASE_ADDR;
break;
default:
break;
}
}
#define arch_decomp_setup() __arch_decomp_setup(arch_id)
#define arch_decomp_wdog()
#endif /* __ASM_ARCH_MXC_UNCOMPRESS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment