We encounter FLEXSPI erase and write issue. We use the following commands to test FLEXSPI read, write, and erase.
mtd_debug erase /dev/mtd2 0x0000000 0x10000
dd if=/dev/zero of=data.hex count=1 bs=65536
mtd_debug write /dev/mtd2 0x0000000 0x10000 data.hex
mtd_debug read /dev/mtd2 0x0000000 0x10000 dump
The contents of data.hex and dump files should be same. But unfortunately the contents of these two files are not identical.
P.S.
fsl-lx2160a-tcd.dts is dts file.
spi-nxp-fspi.c is FLEXSPI driver source file.
erase.PNG, read.PNG, and write.PNG are captured from Zeroplus logic analyzer.
Plese kindly give us your advice.
Thanks!
I have fixed this issue by disabling erasing and writing protection from NOR flash register.
In your dts file, please define FSPI flash device and configure "compatible" property according to the flash device on your target board. Please refer to the following example, please refer to SPI NOR flash driver drivers/mtd/spi-nor/spi-nor.c.
&fspi {
status = "okay";
mt35xu512aba0: flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spansion,m25p80";
m25p,fast-read;
spi-max-frequency = <50000000>;
reg = <0>;
spi-rx-bus-width = <8>;
spi-tx-bus-width = <8>;
};
mt35xu512aba1: flash@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spansion,m25p80";
m25p,fast-read;
spi-max-frequency = <50000000>;
reg = <1>;
spi-rx-bus-width = <8>;
spi-tx-bus-width = <8>;
};
};