#define BAUDRATE 115200
#define DIV_ROUND(x, d) (((x) + ((d) / 2)) / (d))
+.macro sg_set_pinsel, pin, muxval, mux_bits, reg_stride, ra, rd
+ ldr \ra, =(SG_PINCTRL_BASE + \pin * \mux_bits / 32 * \reg_stride)
+ ldr \rd, [\ra]
+ and \rd, \rd, #~(((1 << \mux_bits) - 1) << (\pin * \mux_bits % 32))
+ orr \rd, \rd, #(\muxval << (\pin * \mux_bits % 32))
+ str \rd, [\ra]
+.endm
+
ENTRY(debug_ll_init)
ldr r0, =SG_REVISION
ldr r1, [r0]
#include <linux/io.h>
#include <linux/serial_reg.h>
+#include "../sg-regs.h"
#include "../soc-info.h"
#include "debug-uart.h"
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
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 */
#define SG_PINMON0_CLK_MODE_AXOSEL_20480KHZ (0x2 << 16)
#define SG_PINMON0_CLK_MODE_AXOSEL_25000KHZ_A (0x3 << 16)
-#ifdef __ASSEMBLY__
-
- .macro sg_set_pinsel, pin, muxval, mux_bits, reg_stride, ra, rd
- ldr \ra, =(SG_PINCTRL_BASE + \pin * \mux_bits / 32 * \reg_stride)
- ldr \rd, [\ra]
- and \rd, \rd, #~(((1 << \mux_bits) - 1) << (\pin * \mux_bits % 32))
- orr \rd, \rd, #(\muxval << (\pin * \mux_bits % 32))
- str \rd, [\ra]
- .endm
-
-#else
-
-#include <linux/types.h>
-#include <linux/io.h>
-
-static inline void sg_set_pinsel(unsigned pin, unsigned muxval,
- unsigned mux_bits, unsigned reg_stride)
-{
- unsigned 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);
-}
-
-static inline void sg_set_iectrl(unsigned pin)
-{
- unsigned bit = pin % 32;
- unsigned long reg = SG_IECTRL + pin / 32 * 4;
- u32 tmp;
-
- tmp = readl(reg);
- tmp |= 1 << bit;
- writel(tmp, reg);
-}
-
-#endif /* __ASSEMBLY__ */
-
#endif /* UNIPHIER_SG_REGS_H */