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>
diff --git a/arch/arm/mach-uniphier/debug-uart/debug-uart.c b/arch/arm/mach-uniphier/debug-uart/debug-uart.c
index db2904b..bc96b2e 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 @@
 	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