[PATCH] ARM: EXYNOS: autodetect enabled serial port in uncompress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Colin Cross <ccross@xxxxxxxxxxx>

Check the ULCON register of each serial port to determine if
it has been enabled by the bootloader.  If only one serial port
is found enabled, use that one.  Otherwise, use the value from
CONFIG_S3C_LOWLEVEL_UART_PORT.

Signed-off-by: Colin Cross <ccross@xxxxxxxxxxx>
Signed-off-by: Kukjin Kim <kgene.kim@xxxxxxxxxxx>
---
 arch/arm/mach-exynos/include/mach/uncompress.h |   25 ++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h
index 2979995..0d17a43 100644
--- a/arch/arm/mach-exynos/include/mach/uncompress.h
+++ b/arch/arm/mach-exynos/include/mach/uncompress.h
@@ -25,6 +25,25 @@ static unsigned int __raw_readl(unsigned int ptr)
 	return *((volatile unsigned int *)ptr);
 }
 
+static volatile u8 *exynos_autodetect_uart(volatile u8 *base)
+{
+	int i;
+	int found = 0;
+	int port;
+
+	for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++) {
+		if (__raw_readl((unsigned int)base + S3C_UART_OFFSET * i)) {
+			port = i;
+			found++;
+		}
+	}
+
+	if (found != 1)
+		port = CONFIG_S3C_LOWLEVEL_UART_PORT;
+
+	return base + S3C_UART_OFFSET * port;
+}
+
 static void arch_detect_cpu(void)
 {
 	u32 chip_id = __raw_readl(EXYNOS_PA_CHIPID);
@@ -38,9 +57,11 @@ static void arch_detect_cpu(void)
 	chip_id &= 0xf;
 
 	if (chip_id == 0x5)
-		uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
+		uart_base = (volatile u8 *)EXYNOS5_PA_UART;
 	else
-		uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
+		uart_base = (volatile u8 *)EXYNOS4_PA_UART;
+
+	uart_base = exynos_autodetect_uart(uart_base);
 
 	/*
 	 * For preventing FIFO overrun or infinite loop of UART console,
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux