全志F1C100S/F1C200S学习笔记(8)——主线uboot更改默认终端串口为uart1

u-boot源码:全志F1C100S/F1C200S学习笔记(3)——u-boot编译与烧录
uboot默认终端串口为uart0,这里修改成uart1


补丁包:

全志f1c100s/f1c200s-uboot串口1终端补丁包
补丁使用:
1、u-boot-uart1.patch 放在u-boot 同级目录
2、进入u-boot目录
3、执行patch -p1 < ../u-boot-uart1.patch


修改内容:

u-boot/arch/arm/dts/suniv-f1c100s-licheepi-nano.dts17行:

/ {
    
    
	model = "Lichee Pi Nano";
	compatible = "licheepi,licheepi-nano", "allwinner,suniv-f1c100s",
		     "allwinner,suniv";

	aliases {
    
    
		serial0 = &uart0;
		serial1 = &uart1;
		spi0 = &spi0;
	};

	chosen {
    
    
		stdout-path = "serial1:115200n8";
	};
};

...

&uart1 {
    
    
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_pins_a>;
	status = "okay";
};

u-boot/arch/arm/dts/suniv.dtsi124行:

pio: pinctrl@1c20800 {
    
    
	compatible = "allwinner,suniv-pinctrl";
	reg = <0x01c20800 0x400>;
	interrupts = <38>, <39>, <40>;
	clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
	clock-names = "apb", "hosc", "losc";
	gpio-controller;
	interrupt-controller;
	#interrupt-cells = <3>;
	#gpio-cells = <3>;

	spi0_pins_a: spi0-pins-pc {
    
    
		pins = "PC0", "PC1", "PC2", "PC3";
		function = "spi0";
	};

	uart0_pins_a: uart-pins-pe {
    
    
		pins = "PE0", "PE1";
		function = "uart0";
	};

	uart1_pins_a: uart-pins-pa {
    
    
		pins = "PA2", "PA3";
		function = "uart1";
	};			
};

/u-boot/arch/arm/include/asm/arch-sunxi/gpio.h146行:

#define SUNXI_GPA_EMAC		2
#define SUNIV_GPA_UART1		5

u-boot/include/configs/suniv.h17行:

#include <configs/sunxi-common.h>

#undef CONFIG_CONS_INDEX
#define CONFIG_CONS_INDEX       2  //UART1

#endif /* __CONFIG_H */

u-boot/arch/arm/mach-sunxi/board.c86行:

#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUNIV)
	sunxi_gpio_set_cfgpin(SUNXI_GPE(0), SUNIV_GPE_UART0);
	sunxi_gpio_set_cfgpin(SUNXI_GPE(1), SUNIV_GPE_UART0);
	sunxi_gpio_set_pull(SUNXI_GPE(1), SUNXI_GPIO_PULL_UP);
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUNIV)
	sunxi_gpio_set_cfgpin(SUNXI_GPA(2), SUNIV_GPA_UART1);
	sunxi_gpio_set_cfgpin(SUNXI_GPA(3), SUNIV_GPA_UART1);
	sunxi_gpio_set_pull(SUNXI_GPA(3), SUNXI_GPIO_PULL_UP);

猜你喜欢

转载自blog.csdn.net/p1279030826/article/details/113116927