diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-06-29 02:38:06 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-06-29 22:31:18 +0900 |
commit | 69492fb4c56d82142e0312474369d8da97d5182d (patch) | |
tree | 2ca572f75e9644a215679dca55e197981f5910cf /arch/arm/mach-uniphier/debug-uart | |
parent | e3d5d3ac5bbbddddf830a918e59c13f7a8d9ef6c (diff) |
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 <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier/debug-uart')
-rw-r--r-- | arch/arm/mach-uniphier/debug-uart/debug-uart.c | 28 | ||||
-rw-r--r-- | arch/arm/mach-uniphier/debug-uart/debug-uart.h | 4 |
2 files changed, 32 insertions, 0 deletions
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 <linux/io.h> #include <linux/serial_reg.h> +#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 diff --git a/arch/arm/mach-uniphier/debug-uart/debug-uart.h b/arch/arm/mach-uniphier/debug-uart/debug-uart.h index 689da7cf27..f4e98c0bb0 100644 --- a/arch/arm/mach-uniphier/debug-uart/debug-uart.h +++ b/arch/arm/mach-uniphier/debug-uart/debug-uart.h @@ -13,4 +13,8 @@ unsigned int uniphier_pro5_debug_uart_init(void); unsigned int uniphier_pxs2_debug_uart_init(void); unsigned int uniphier_ld6b_debug_uart_init(void); +void sg_set_pinsel(unsigned int pin, unsigned int muxval, + unsigned int mux_bits, unsigned int reg_stride); +void sg_set_iectrl(unsigned int pin); + #endif /* _MACH_DEBUG_UART_H */ |