1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-26 16:13:55 +01:00

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>
This commit is contained in:
Masahiro Yamada
2019-06-29 02:38:06 +09:00
parent e3d5d3ac5b
commit 69492fb4c5
4 changed files with 40 additions and 42 deletions

View File

@@ -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