am5728 uboot console到uart8

随意的标题一

最近碰到个需求,原来am5728的console是在uart3上面的,然后需要改到uart8,一般来说这个并没有什么难度,但是看了下,有点懵逼,因为麻烦的是uboot串口默认1-6是随意切换的,但是后面7往后就没有那么简单了.于是还是写下来记录一下.捡一些重要的说一下.

主要参照的是ti论坛内的一个回复修改的,但是当前写博客的时候,我已经懒得去找那个链接了…

代码

  1. 修改dtb切换输出串口,并使能串口8
diff --git a/arch/arm/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
index 49aeecd..6af99c3 100644
--- a/arch/arm/dts/am57xx-beagle-x15-common.dtsi
+++ b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
@@ -24,7 +24,7 @@
 	};
 
 	chosen {
-		stdout-path = &uart3;
+		stdout-path = &uart8;
 	};
 
 	memory@0 {
@@ -587,3 +587,7 @@
 		status = "okay";
 	};
 };
+
+&uart8 {
+	status = "okay";
+};

diff --git a/arch/arm/dts/am57xx-idk-common.dtsi b/arch/arm/dts/am57xx-idk-common.dtsi
index fa5a078..561fe30 100644
--- a/arch/arm/dts/am57xx-idk-common.dtsi
+++ b/arch/arm/dts/am57xx-idk-common.dtsi
@@ -15,7 +15,7 @@
 	};
 
 	chosen {
-		stdout-path = &uart3;
+		stdout-path = &uart8;
 	};
 
 	vmain: fixedregulator-vmain {
@@ -416,6 +416,9 @@
 	no-1-8-v;
 	/delete-property/ mmc-hs200-1_8v;
 };
+&uart8 {
+	status = "okay";
+};
 
 &dcan1 {
 	status = "okay";

当初没有仔细看是哪个dts文件,所以索性都改了.

  1. 不了解
 	reg-shift = <2>;
 };
 
-&uart3 {
+&uart8 {
 	u-boot,dm-spl;
 	reg-shift = <2>;
 };

这里并不是很了解,待我完了之后去看下代码理解一下.

  1. 打开串口时钟
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 5710136..b96c1bf 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -284,6 +284,7 @@ struct prcm_regs {
 	u32 cm_l4per_i2c5_clkctrl;
 	u32 cm_l4per_uart5_clkctrl;
 	u32 cm_l4per_uart6_clkctrl;
+	u32 cm_l4per_uart8_clkctrl;
 	u32 cm_l4sec_clkstctrl;
 	u32 cm_l4sec_staticdep;
 	u32 cm_l4sec_dynamicdep;
diff --git a/arch/arm/mach-omap2/clocks-common.c b/arch/arm/mach-omap2/clocks-common.c
index 93c4c6f..8d68962 100644
--- a/arch/arm/mach-omap2/clocks-common.c
+++ b/arch/arm/mach-omap2/clocks-common.c
@@ -805,7 +805,7 @@ static void setup_clocks_for_console(void)
 			MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<
 			MODULE_CLKCTRL_MODULEMODE_SHIFT);
 
-	clrsetbits_le32((*prcm)->cm_l4per_uart3_clkctrl,
+	clrsetbits_le32((*prcm)->cm_l4per_uart8_clkctrl,
 			MODULE_CLKCTRL_MODULEMODE_MASK,
 			MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<
 			MODULE_CLKCTRL_MODULEMODE_SHIFT);
diff --git a/arch/arm/mach-omap2/omap5/prcm-regs.c b/arch/arm/mach-omap2/omap5/prcm-regs.c
index b5f1d70..aff2896 100644
--- a/arch/arm/mach-omap2/omap5/prcm-regs.c
+++ b/arch/arm/mach-omap2/omap5/prcm-regs.c
@@ -970,6 +970,7 @@ struct prcm_regs const dra7xx_prcm = {
 	.cm_l4per_uart3_clkctrl			= 0x4a009850,
 	.cm_l4per_uart4_clkctrl			= 0x4a009858,
 	.cm_l4per_uart5_clkctrl			= 0x4a009870,
+	.cm_l4per_uart8_clkctrl			= 0x4a0098e0,
 	.cm_l4sec_clkstctrl			= 0x4a009880,
 	.cm_l4sec_staticdep			= 0x4a009884,
 	.cm_l4sec_dynamicdep			= 0x4a009888,
  1. 切换cmdline里面传给kernel的参数让kernel也在uart8输出
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index cf5cacd..b59a139 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -27,7 +27,7 @@
 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 
-#define CONSOLEDEV			"ttyO2"
+#define CONSOLEDEV			"ttyO7"
 #define CONFIG_SYS_NS16550_COM1		UART1_BASE	/* Base EVM has UART0 */
 #define CONFIG_SYS_NS16550_COM2		UART2_BASE	/* UART2 */
 #define CONFIG_SYS_NS16550_COM3		UART3_BASE	/* UART3 */
-- 

大概是这么一个节奏.

你可能感兴趣的:(uboot,c,linux)