修改 DTS
Read time: 1 minute(s)
要在实际项目中使用 SPI NAND 设备,还需要修改 DTS 配置文件,详细流程如下所示:
-
在 board.dts 中具体的 SPI 控制器下添加
spi-nand
设备。&spi1 { pinctrl-names = "default"; pinctrl-0 = <&spi1_pins_a>; status = "okay"; spi-max-frequency = <100000000>; spi-flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spi-nand"; //固定值,所有 SPINand 驱动均声明此 spi-max-frequency = <100000000>; //最大频率,固定值 spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; reg = <0>; //固定值,一般不需修改 status = "okay"; }; };
-
在 board-u-boot.dtsi 文件中,将添加的
spi-nand
设备标记为 u-boot,dm-pre-reloc,确保 SPL 能够识别和使用该设备。&spi1 { u-boot,dm-pre-reloc; spi-flash@0 { u-boot,dm-pre-reloc; }; };