[PATCH 2/3] ARM: CCMX51: Add support for low-level debug

Alexander Shiyan eagle.alexander923 at gmail.com
Tue Apr 19 00:21:22 PDT 2022


Signed-off-by: Alexander Shiyan <eagle.alexander923 at gmail.com>
---
 arch/arm/boards/ccxmx51/lowlevel.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm/boards/ccxmx51/lowlevel.c b/arch/arm/boards/ccxmx51/lowlevel.c
index adcb30a7ff..367925e398 100644
--- a/arch/arm/boards/ccxmx51/lowlevel.c
+++ b/arch/arm/boards/ccxmx51/lowlevel.c
@@ -2,12 +2,37 @@
 /* Author: Alexander Shiyan <shc_work at mail.ru> */
 
 #include <common.h>
+#include <debug_ll.h>
+#include <mach/clock-imx51_53.h>
 #include <mach/esdctl.h>
 #include <mach/generic.h>
+#include <mach/iomux-mx51.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
 #include <mach/imx51-regs.h>
 
+static inline void setup_uart(void)
+{
+	void __iomem *iomuxbase = IOMEM(MX51_IOMUXC_BASE_ADDR);
+	void __iomem *ccmbase = IOMEM(MX51_CCM_BASE_ADDR);
+
+	/*
+	 * Restore CCM values that might be changed by the Mask ROM
+	 * code.
+	 *
+	 * Source: RealView debug scripts provided by Freescale
+	 */
+	writel(MX5_CCM_CBCDR_RESET_VALUE,  ccmbase + MX5_CCM_CBCDR);
+	writel(MX5_CCM_CSCMR1_RESET_VALUE, ccmbase + MX5_CCM_CSCMR1);
+	writel(MX5_CCM_CSCDR1_RESET_VALUE, ccmbase + MX5_CCM_CSCDR1);
+
+	imx_setup_pad(iomuxbase, MX51_PAD_UART1_TXD__UART1_TXD);
+
+	imx51_uart_setup_ll();
+
+	putc_ll('>');
+}
+
 ENTRY_FUNCTION(start_ccxmx51, r0, r1, r2)
 {
 	extern char __dtb_imx51_ccxmx51_start[];
@@ -15,6 +40,9 @@ ENTRY_FUNCTION(start_ccxmx51, r0, r1, r2)
 
 	imx5_cpu_lowlevel_init();
 
+	if (IS_ENABLED(CONFIG_DEBUG_LL))
+		setup_uart();
+
 	arm_setup_stack(0x20000000);
 
 	fdt = __dtb_imx51_ccxmx51_start + get_runtime_offset();
-- 
2.32.0




More information about the barebox mailing list