使用petalinux2020.1建立QSPI启动的最小系统时,在petalinux-config中Subsystem AUTO Hardware Settings的flash setting中设置分区参数,参考如下:
然后完成u-boot、kernel、rootfs等配置后,就可以编译petalinux-build。
烧录完成后系统打印显示错误如下:
[ 7.193832] zynqmp-qspi ff0f0000.spi: rx bus width not found
[ 7.199505] zynqmp-qspi ff0f0000.spi: tx bus width not found
[ 7.205446] spi_master spi0: cannot find modalias for /amba/spi@ff0f0000/flash@0
[ 7.212870] spi_master spi0: Failed to create SPI device for /amba/spi@ff0f0000/flash@0
从蓝色字体发现,系统没找到设备的名称,查看设备树(位置:components/plnx_workspace/device-tree/device-tree),发现没有定义compatible属性,uboot显示的qspi型号为n25q256ax1,参考别的地方设置该属性为:compatible = "n25q256", "w25q512";
修改的文件为:(上述位置,系统自动生成的,这里的为用户自定义设置和修改)
project-spec/meta-user/recipes-bsp/device-tree/files
修改system-user.dtsi:
/include/ "system-conf.dtsi"
/ {
};
&qspi {
is-dual = <0>;
flash@0 {
compatible = "m25p80", "jedec,spi-nor"; /* 32MB */
#address-cells = <1>;
#size-cells = <1>;
reg = <0x0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>; /* FIXME also DUAL configuration possible */
spi-max-frequency = <108000000>; /* Based on DC1 spec */
partition@0 {
label = "boot";
reg = <0x00000000 0x009c0000>;
};
partition@1 {
label = "bootenv";
reg = <0x009c0000 0x00040000>;
};
partition@2 {
label = "kernel";
reg = <0x00a00000 0x0a000000>;
};
partition@3 {
label = "bootscr";
reg = <0x0aa00000 0x00100000>;
};
partition@4 {
label = "rootfs";
reg = <0x0ab00000 0x05200000>;
};
partition@5 {
label = "fzk";
reg = <0x0fd00000 0x00200000>;
};
partition@6 {
label = "spare";
reg = <0x0ff00000 0x00100000>;
};
};
};
还有问题!!!
串口启动打印:spi-nor spi0.0: unrecognized JEDEC id bytes: c2 20 1c c2 20 1c
需要添加新的flash id,在文件drivers/mtd/spi-nor/spi-nor.c 的 2620行左右,添加id对应的参数:
{ "mx66l2g45g", INFO(0xc2201c, 0, 64 * 1024, 4096, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
终于:可以看到qspi的分区了。