From e3d5d3ac5bbbddddf830a918e59c13f7a8d9ef6c Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 29 Jun 2019 02:38:05 +0900 Subject: ARM: uniphier: remove unused init code for CONFIG_DEBUG_UART debug_uart_init() is called from spl_board_init(), which is only compiled for SPL. For U-boot proper, _debug_uart_init() is unreachable, so dropped by the dead code elimination. Now that 64-bit SoCs of this SoC family no longer support SPL, debug-uart-ld20.c is never compiled. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/debug-uart/debug-uart.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'arch/arm/mach-uniphier/debug-uart/debug-uart.c') diff --git a/arch/arm/mach-uniphier/debug-uart/debug-uart.c b/arch/arm/mach-uniphier/debug-uart/debug-uart.c index 992b4a9857..db2904b553 100644 --- a/arch/arm/mach-uniphier/debug-uart/debug-uart.c +++ b/arch/arm/mach-uniphier/debug-uart/debug-uart.c @@ -28,6 +28,7 @@ static void _debug_uart_putc(int c) void _debug_uart_init(void) { +#ifdef CONFIG_SPL_BUILD void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE; unsigned int divisor; @@ -61,12 +62,6 @@ void _debug_uart_init(void) case UNIPHIER_LD6B_ID: 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 +70,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 -- cgit From 69492fb4c56d82142e0312474369d8da97d5182d Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 29 Jun 2019 02:38:06 +0900 Subject: ARM: uniphier: move sg_set_{pinsel, iectrl} to more relevant places Move the sg_set_pinsel macro to arch/arm/mach-uniphier/arm32/debug_ll.S since it is not used anywhere else. Move the C functions sg_set_{pinsel,iectrl} to debug-uart.c since they are not used anywhere else. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/debug-uart/debug-uart.c | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'arch/arm/mach-uniphier/debug-uart/debug-uart.c') diff --git a/arch/arm/mach-uniphier/debug-uart/debug-uart.c b/arch/arm/mach-uniphier/debug-uart/debug-uart.c index db2904b553..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 #include +#include "../sg-regs.h" #include "../soc-info.h" #include "debug-uart.h" @@ -26,6 +27,33 @@ 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 -- cgit