RK3399修改调试串口

RK3399修改调试串口
RK3399可以修改调试串口为任意板载的UART
由于厂家的一级loader没有开源,因此更改调试串口后,一级loader的打印无法再看到了

手里面有一块rockpi4b的板子
在这里插入图片描述其pin脚如下,从官方的uart改为下图中的uart4

在这里插入图片描述
官方支持的bsp代码

https://github.com/radxa/rockchip-bsp.git
1
首先修改uboot的代码

git diff
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 8000614…4c44548 100644
— a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -11,7 +11,7 @@
};
};

-&uart2 {
+&uart4 {
clock-frequency = <24000000>;
:…skipping…
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 8000614…4c44548 100644
— a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -11,7 +11,7 @@
};
};

-&uart2 {
+&uart4 {
clock-frequency = <24000000>;
u-boot,dm-pre-reloc;
status = “okay”;
diff --git a/arch/arm/dts/rockpi-4b-linux.dts b/arch/arm/dts/rockpi-4b-linux.dts
old mode 100644
new mode 100755
index f28fa8f…46a147b
— a/arch/arm/dts/rockpi-4b-linux.dts
+++ b/arch/arm/dts/rockpi-4b-linux.dts
@@ -22,7 +22,7 @@
};

    chosen {
  •           stdout-path = &uart2;
    
  •           stdout-path = &uart4;
              u-boot,spl-boot-order = &sdhci, &sdmmc;
      };
    

diff --git a/configs/rock-pi-4b-rk3399_defconfig b/configs/rock-pi-4b-rk3399_defconfig
index f0292e8…5a4b2e1 100644
— a/configs/rock-pi-4b-rk3399_defconfig
+++ b/configs/rock-pi-4b-rk3399_defconfig
@@ -14,7 +14,7 @@ CONFIG_DEBUG_UART=y
CONFIG_FIT=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_FIT_GENERATOR=“arch/arm/mach-rockchip/make_fit_atf.py”
-CONFIG_BOOTDELAY=1
+CONFIG_BOOTDELAY=5

CONFIG_DISPLAY_CPUINFO is not set

CONFIG_ANDROID_BOOTLOADER=y
CONFIG_SPL_STACK_R=y
@@ -71,9 +71,9 @@ CONFIG_RAM=y
CONFIG_SPL_RAM=y
CONFIG_DM_RESET=y
CONFIG_BAUDRATE=1500000
-CONFIG_DEBUG_UART_BASE=0xFF1A0000
+CONFIG_DEBUG_UART_BASE=0xFF370000
CONFIG_DEBUG_UART_CLOCK=24000000
-CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_DEBUG_UART_SHIFT=4
CONFIG_SYSRESET=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
linux kernel更改如下

git diff
diff --git a/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf b/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf
index 024fe76…41d3d48 100644
— a/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf
+++ b/arch/arm64/boot/dts/rockchip/overlays-rockpi4/hw_intfc.conf
@@ -21,7 +21,7 @@ intfc:i2c7=off
#intfc:dtoverlay=at24c02

Serial console on UART2

-intfc:dtoverlay=console-on-ttyS2
+intfc:dtoverlay=console-on-ttyS4

Serial console on UART4

#intfc:dtoverlay=console-on-ttyS4
diff --git a/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi b/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi
index 1a18fc4…e6ea618 100644
— a/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rockpi-4-linux.dtsi
@@ -54,13 +54,13 @@
fiq_debugger: fiq-debugger {
status = “disabled”;
compatible = “rockchip,fiq-debugger”;

  •           rockchip,serial-id = <2>;
    
  •           rockchip,serial-id = <4>;
              rockchip,signal-irq = <182>;
              rockchip,wake-irq = <0>;
              rockchip,irq-mode-enable = <1>;  /* If enable uart uses irq instead of fiq */
              rockchip,baudrate = <1500000>;  /* Only 115200 and 1500000 */
              pinctrl-names = "default";
    
  •           pinctrl-0 = <&uart2c_xfer>;
    
  •           pinctrl-0 = <&uart4_xfer>;
      };
    
      vcc1v8_s0: vcc1v8-s0 {
    

@@ -750,7 +750,7 @@
};

&uart4 {

  •   status = "disabled";
    
  •   status = "okay";
    

};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
上板子调试完全可以,只是缺少了一级loader的打印

上一篇:ThinkPHP第十一天(关联模型使用,独立分组配置,MySQL concat用法)


下一篇:clientHeight ,offsetHeight,style.height,scrollHeight有区别与联系