diff options
Diffstat (limited to 'arch/arm/mach-uniphier/debug-uart/debug-uart.c')
-rw-r--r-- | arch/arm/mach-uniphier/debug-uart/debug-uart.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/arch/arm/mach-uniphier/debug-uart/debug-uart.c b/arch/arm/mach-uniphier/debug-uart/debug-uart.c index 992b4a9857..bc96b2e7be 100644 --- a/arch/arm/mach-uniphier/debug-uart/debug-uart.c +++ b/arch/arm/mach-uniphier/debug-uart/debug-uart.c @@ -8,6 +8,7 @@ #include <linux/io.h> #include <linux/serial_reg.h> +#include "../sg-regs.h" #include "../soc-info.h" #include "debug-uart.h" @@ -26,8 +27,36 @@ static void _debug_uart_putc(int c) writel(c, base + UNIPHIER_UART_TX); } +#ifdef CONFIG_SPL_BUILD +void sg_set_pinsel(unsigned int pin, unsigned int muxval, + unsigned int mux_bits, unsigned int reg_stride) +{ + unsigned int shift = pin * mux_bits % 32; + unsigned long reg = SG_PINCTRL_BASE + pin * mux_bits / 32 * reg_stride; + u32 mask = (1U << mux_bits) - 1; + u32 tmp; + + tmp = readl(reg); + tmp &= ~(mask << shift); + tmp |= (mask & muxval) << shift; + writel(tmp, reg); +} + +void sg_set_iectrl(unsigned int pin) +{ + unsigned int bit = pin % 32; + unsigned long reg = SG_IECTRL + pin / 32 * 4; + u32 tmp; + + tmp = readl(reg); + tmp |= 1 << bit; + writel(tmp, reg); +} +#endif + void _debug_uart_init(void) { +#ifdef CONFIG_SPL_BUILD void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE; unsigned int divisor; @@ -62,12 +91,6 @@ void _debug_uart_init(void) divisor = uniphier_ld6b_debug_uart_init(); break; #endif -#if defined(CONFIG_ARCH_UNIPHIER_LD11) || defined(CONFIG_ARCH_UNIPHIER_LD20) - case UNIPHIER_LD11_ID: - case UNIPHIER_LD20_ID: - divisor = uniphier_ld20_debug_uart_init(); - break; -#endif default: return; } @@ -75,5 +98,6 @@ void _debug_uart_init(void) writel(UART_LCR_WLEN8 << 8, base + UNIPHIER_UART_LCR_MCR); writel(divisor, base + UNIPHIER_UART_LDR); +#endif } DEBUG_UART_FUNCS |