summaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier/debug-uart/debug-uart.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-06-29 12:09:23 -0400
committerTom Rini <trini@konsulko.com>2019-06-29 12:09:23 -0400
commit884512f7dbf9523c0f6ad6fcabf92b61f59f4330 (patch)
tree2966af646505420c91f4157aed5f19577c2fb7e9 /arch/arm/mach-uniphier/debug-uart/debug-uart.c
parent4a941152065ca949179a886f05fe099fa8049a58 (diff)
parent69492fb4c56d82142e0312474369d8da97d5182d (diff)
Merge tag 'uniphier-v2019.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-uniphier
UniPhier SoC updates for v2019.07 - Add SPI pin-mux data for pinctrl driver - Remove unused code - Trivial bug-fix and clean-up
Diffstat (limited to 'arch/arm/mach-uniphier/debug-uart/debug-uart.c')
-rw-r--r--arch/arm/mach-uniphier/debug-uart/debug-uart.c36
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