S25FS128S driver support?

cancel
Showing results for 
Search instead for 
Did you mean: 

S25FS128S driver support?

547 Views
Contributor III

Our custom board design is based on the LS1012A Freedom reference design. One change is the QSPI flash part is  16Mbyte (S25FS128SAGNFI103) rather than 64Mbyte (S25FS512SAGNFI011). To get cwflash.py to work with the  different part, I initially just used the CW4NET_v2018.01/CW_ARMv8/Config/flash/devices/S25FS256S.xml description file and this works fine for the CW TAP/JTAG connection (Does anyone have the flash programmer .xml files for S25FS128S QSPI part?).

The part ID was being interpreted by U-Boot as s25fl128s_64k because 0x4d0181 was not in the ID table but the logic allows it to match 0x4d01:

{"s25fl128s_64k", INFO(0x012018, 0x4d01, 64 * 1024, 256, RD_FULL | WR_QPP) },


With that part description, U-Boot is able to read the QSPI flash, but not write- although a write does not indicate an error (e.g. saveenv result indicates that the environment was written/saved, but resetting/restarting U-Boot still gets a CRC error reading the environment from flash!).

Since the S25FS256S description worked for cwflash, I created a new ID entry in U-Boot matching the s25fs256s_64k but with the s25fs128s name/id:

{"s25fs128s_64k", INFO6(0x012018, 0x4d0181, 64 * 1024, 256, RD_FULL | WR_QPP | SECT_4K) },
{"s25fs256s_64k", INFO6(0x010219, 0x4d0181, 64 * 1024, 512, RD_FULL | WR_QPP | SECT_4K) },


I have confirmed that U-Boot is now identifying the part as my new s25fs128s_64k entry:

SF: Detected s25fs128s_64k with page size 256 Bytes, erase size 4 KiB, total 16 MiB

but saveenv/reset still fails to work as expected.

I did find a previous discussion about this QSPI part and the LS1012A: https://community.nxp.com/message/918715?sr=search&searchId=0d0fc7cd-0297-45af-b1ff-11b3d6198456&sea... where the author was reporting a problem reading the part from Linux. They added an equivalent entry to the ID table in the Linux driver.

BacemDaassi‌ from Cypress Semi responded with a pointer to a Cypress KB article and suggested removing the SECT_4K flag.

There is no response from the original poster, so it is not obvious if this was the solution for them or not.

I have removed the SECT_4K flag, but still am not able to write to the QSPI flash from U-Boot.

Has anyone successfully written to the S25FS128S part (or the S25FS256S part which is essentially the same) from U-Boot or Linux drivers?

Thanks!

.Tim

Tags (2)
0 Kudos
3 Replies

20 Views
Contributor III

I have experience with s70fs01gs which, I think, is similar. The problem is the flash is hybrid sector architecture  which is not supported by the current vanilla Linux kernel (and U-Boot) drivers. It's possible to disable hybrid sector layout in s70fs01gs by writing to an OTP configuration register (but its not revertible, so I do not like it) or somehow improve the flash drivers. I have patched the drivers to solve the issues. Nowawadays, it's possible to find some patches for Linux qspi-nor drivers adding support for hybrid sectors architecture, but I think, those patches have not found their way to vanilla kernel yet.

0 Kudos

20 Views
NXP TechSupport
NXP TechSupport

Hello Tim Hammer,

Please refer to u-boot configuration.

In u-boot include/configs/<platform>.h

/* QSPI device */
#ifdef CONFIG_FSL_QSPI
#define CONFIG_SPI_FLASH_SPANSION
#define FSL_QSPI_FLASH_SIZE             SZ_64M
#define FSL_QSPI_FLASH_NUM              2
#define CONFIG_SYS_FSL_ERRATUM_A009282
#define CONFIG_QSPI_AHB_INIT
#endif

In Linux Kernel, dts configuration

&qspi {
        status = "okay";
        qflash0: s25fs128s@0 {
                compatible = "spansion,m25p80";
                #address-cells = <1>;
                #size-cells = <1>;
                spi-max-frequency = <20000000>;
                m25p,fast-read;
                reg = <0>;
                spi-rx-bus-width = <2>;
                spi-tx-bus-width = <2>;
        };

};

0 Kudos

20 Views
Contributor III

yipingwang‌ -

Thank you for the pointers.

I had missed those definitions. ls1012a_common.h has some of them. I have modified FSL_QSPI_FLASH_SIZE and FSL_QSPI_FLASH_NUM to match our board setup.

CONFIG_QSPI_AHB_INIT is already defined in generated/autoconf.h

CONFIG_SYS_FSL_ERRATUM_A009282 is not in any Kconfig and attempting to define it in the header file as an ad-hoc config item breaks the build- I left this one out.

With those changes, I am now able to erase and write the QSPI flash memory from U-Boot.

The DTS for the Linux kernel did have "s25fs512s" carried over from the Freedom board source that I missed. However, fixing that has only seemed to corrected the system message that is logged:

[    1.603486] fsl-quadspi 1550000.quadspi: s25fs128s (16384 Kbytes)

 

was:

[    1.591366] fsl-quadspi 1550000.quadspi: s25fl129p1 (16384 Kbytes)

I am still unable to erase or write the QSPI flash memory from GNU/Linux. Any other ideas?

Thanks!

.Tim

0 Kudos