Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da5784d1 authored by Stepan Moskovchenko's avatar Stepan Moskovchenko
Browse files

arm64: add support for MSM HSL earlyprintk



Add support for arm64 earlyprintk using the MSM UARTDM
hardware block. Such support can be enabled by passing
something like "earlyprintk=msm_hsl_uart,0xf991e000" (or
the appropriate equivalent) on the kernel command line.

Change-Id: Ia43ad430e8bdcb0fd724c60949b82b256e2611a8
Signed-off-by: default avatarStepan Moskovchenko <stepanm@codeaurora.org>
parent f9e5104e
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -72,6 +72,28 @@ static void uart8250_32bit_printch(char ch)
	writel_relaxed(ch, early_base + (UART_TX << 2));
}

#define MSM_HSL_UART_SR			0xa4
#define MSM_HSL_UART_ISR		0xb4
#define MSM_HSL_UART_TF			0x100
#define MSM_HSL_UART_CR			0xa8
#define MSM_HSL_UART_NCF_TX		0x40
#define MSM_HSL_UART_SR_TXEMT		BIT(3)
#define MSM_HSL_UART_ISR_TXREADY	BIT(7)

void msm_hsl_uart_printch(char ch)
{
	while (!(readl_relaxed(early_base + MSM_HSL_UART_SR) &
						       MSM_HSL_UART_SR_TXEMT) &&
	       !(readl_relaxed(early_base + MSM_HSL_UART_ISR) &
						     MSM_HSL_UART_ISR_TXREADY))
		;

	writel_relaxed(0x300, early_base + MSM_HSL_UART_CR);
	writel_relaxed(1, early_base + MSM_HSL_UART_NCF_TX);
	readl_relaxed(early_base + MSM_HSL_UART_NCF_TX);
	writel_relaxed(ch, early_base + MSM_HSL_UART_TF);
}

struct earlycon_match {
	const char *name;
	void (*printch)(char ch);
@@ -82,6 +104,7 @@ static const struct earlycon_match earlycon_match[] __initconst = {
	{ .name = "smh", .printch = smh_printch, },
	{ .name = "uart8250-8bit", .printch = uart8250_8bit_printch, },
	{ .name = "uart8250-32bit", .printch = uart8250_32bit_printch, },
	{ .name = "msm_hsl_uart", .printch = msm_hsl_uart_printch, },
	{}
};