版权声明:转载请关注我的公众号-青儿创客基地 https://blog.csdn.net/Zhu_Zhu_2009/article/details/81352468
qspi flash读写错误
在linux上尝试用fw_printenv获取环境变量发现crc错误,用dd+hexdump和uboot下读取的flash分区比较(uboot env print可显示环境变量的大小),发现有个别数据读取错误,这里使用了冗余环境变量分区,前面的9485 e1f7指示当前分区是否是有效的环境变量分区。
root@mwm:~# dd if=/dev/mtd1 of=1.txt bs=8K count=1
root@mwm:~# hexdump 1.txt
ZynqMP> env print
autoload=no
baudrate=115200
Environment size: 7198/131067 bytes
ZynqMP> md.w ${clobstart} 0x2000
10000000: 9485 e1f7 6101 7475 6c6f 616f 3d64 6f6e .....autoload=no
检查设备树配置,
spi@ff0f0000 {
u-boot,dm-pre-reloc;
compatible = "xlnx,zynqmp-qspi-1.0";
status = "okay";
clock-names = "ref_clk", "pclk";
interrupts = <0x0 0xf 0x4>;
interrupt-parent = <0x4>;
num-cs = <0x1>;
reg = <0x0 0xff0f0000 0x0 0x1000 0x0 0xc0000000 0x0 0x8000000>;
#address-cells = <0x1>;
#size-cells = <0x0>;
#stream-id-cells = <0x1>;
iommus = <0xe 0x873>;
power-domains = <0x1e>;
clocks = <0x3 0x35 0x3 0x1f>;
is-dual = <0x1>;
spi-rx-bus-width = <0x4>;
spi-tx-bus-width = <0x4>;
flash@0 {
compatible = "n25q512a", "micron,m25p80";
spi-tx-bus-width = <0x1>;
spi-rx-bus-width = <0x4>;
reg = <0x0>;
#address-cells = <0x1>;
#size-cells = <0x1>;
/*spi-max-frequency = <0x66ff300>;*/
spi-max-frequency = <0x337F980>;
partition@0x00000000 {
label = "boot";
reg = <0x0 0x100000>;
};
将总线频率降低一半,数据读取正确,rx-bus-width还是保持为4。