11 Replies Latest reply on Nov 19, 2018 10:15 PM by rutr_3862206

    U-Boot and Linux support for S25FS128S?

      We are using the S25FS128S part in conjunction with the NXP LS1012A for a design based on the LS1012A Freedom board (which uses the S25FS512S part). U-Boot and Linux can read from the flash part, but not write to it.

      There is no error reported when writing (I have not implemented the information provided in How to Check E_ERR/P_ERR Status Errors in the Linux MTD SPI Driver – KBA220225 so that might be why); however the write does not actually modify the flash memory contents.

       

      U-Boot initially identified the flash part as s25fl128s_64k and Linux identified the part as s25fl129p1.

       

      The NXP CodeWarrior TAP (JTAG) using cwflash.py is able to write to the flash part using the files available for S25FS256S. So I added s25fs128s_64k to the u-boot/drivers/mtd/spi/spi_flash_ids.c:

       

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

       

      as a copy of the s25fs256 entry:

       

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

       

      However, I am still unable to successfully write to the flash.

      I have not yet made/tested the change in Linux source-  drivers/mtd/spi-nor/spi-nor.c does not have support for S25FS256S that I can just copy.

       

      There was a post in the NXP community pointing to S25FS-S Support Under Linux - KBA218975 and suggesting SECT_4K should not be used. Even with that flag removed, the U-Boot behavior is still to not modify the flash memory on a write.

       

      Is there something else different between the 256 and 128 parts that I am missing?

       

      Thank you!

      .Tim

       

      Message was edited by: Tim Hammer added detail about Linux spi-nor.c

        • 1. Re: U-Boot and Linux support for S25FS128S?
          BushraH_91

          Hello Tim,

          Thank you for contacting Cypress Community Forum. We have received your inquiry and currently reviewing the case. We will get back to you as soon as we find the resolution.

           

          Have a wonderful weekend

          Regards,

          Bushra

          • 2. Re: U-Boot and Linux support for S25FS128S?

            BushraH_91 - just  a quick update!

             

            I received an assist from the NXP Community in response to my post there and got the U-Boot configuration items that I had missed. I corrected those and am now able to write to the S25FS128S part in U-Boot!

            #define FSL_QSPI_FLASH_SIZE SZ_16M

            #define FSL_QSPI_FLASH_NUM 1

             

             

            That response also provided a suggested update to the Linux DTS declaration, but that change (combined with the spi-nor.c change?) only seems to have "fixed" the message logging:

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

             

            It was:

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

             

             

            flash_erase does not report an error, but the memory is not cleared when I read it back after erasing.

            mtd_debug write does not report an error, but the memory is unchanged when I read it back after erasing/writing.

             

            I appreciate you looking into this.

            .Tim

            • 3. Re: U-Boot and Linux support for S25FS128S?

              Forgot to include that I had also modified the Linux file drivers/mtd/spi-nor/spi-nor.c to include an entry with my best guess of the proper values:

              { "s25fs128s",  INFO6(0x012018, 0x4d0181, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },

              since my initial post.

               

              That change by itself did nothing at all as far as I could tell. It appears that both changes are necessary to get the correct part number identified it the system message during boot.

               

              .Tim

              • 4. Re: U-Boot and Linux support for S25FS128S?
                BushraH_91

                Hello Tim,

                Thank you for the update. I will look into it and get back to you.

                 

                Have a wonderful day

                Regards,

                Bushra

                • 5. Re: U-Boot and Linux support for S25FS128S?
                  BushraH_91

                  Hello Tim

                  The standard Linux SPI driver does not support 4 kB sector overlays.

                   

                  You will have to either switch off the 4 kB sectors via the config register (just removing the SECT_4K in spi-nor.c is not sufficient!) or use Cypress SPI driver (cy-snor) that they can download from http://www.cypress.com/products/serial-nor-flash-memory#tabs-0-bottom_side-5.

                   

                  Thank you

                  Regards,

                  Bushra

                  • 6. Re: U-Boot and Linux support for S25FS128S?

                    Bushra -

                     

                    Thank you for the link to that driver patch. However, I am unable to get it fully working. I have applied the patch, enabled the drivers in the kernel config, and modified my device tree files as follows:

                     

                    arch/arm64/boot/dts/freescale/fsl-ls1012a-frdm.dts

                    &qspi {

                            status = "okay";

                    -      qflash0: s25fs512s@0 {

                    -              compatible = "spansion,m25p80";

                    +      qflash0: s25fs128s@0 {

                    +              compatible = "cy-snor";

                                    #address-cells = <1>;

                                    #size-cells = <1>;

                                    spi-max-frequency = <20000000>;

                     

                    arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi

                                    };

                     

                                    qspi: quadspi@1550000 {

                    -                      compatible = "fsl,ls1012a-qspi", "fsl,ls1021a-qspi";

                    +                      compatible = "cy-snor";

                                            #address-cells = <1>;

                                            #size-cells = <0>;

                                            reg = <0x0 0x1550000 0x0 0x10000>,

                     

                    But now it seems that no driver is loaded. Can you see something that I have done wrong?

                     

                    Thank you!

                    .Tim

                     

                    • 7. Re: U-Boot and Linux support for S25FS128S?
                      BushraH_91

                      Hello Tim,

                      Thank you for your update. I will discuss with our software group and get back to you.

                       

                      Regards,

                      Bushra

                      • 8. Re: U-Boot and Linux support for S25FS128S?
                        BushraH_91

                        Hello,

                        Did you go into the kernel config menu (make menuconfig) and enable the drivers?

                         

                        Thank you

                        Regards,

                        Bushra

                        • 9. Re: U-Boot and Linux support for S25FS128S?

                          cy-snor_config.png

                          Yes I did.

                           

                          # zcat /proc/config.gz | grep MTD_CY_

                          CONFIG_MTD_CY_SNOR=y

                          CONFIG_MTD_CY_SNOR_HAL=y

                           

                          .Tim

                          • 10. Re: U-Boot and Linux support for S25FS128S?

                            Hi,
                            Did you find your solution as I'm facing very similar issue.
                            I've added 4.14 patches for s25fs512s in my kernel source tree, enabled it from menuconfig option and verified using zcat command for config while kernel is working.
                            But probe is not getting called.

                             

                            This is my dts after change

                             

                            &flexspi0 {

                              pinctrl-names = "default";
                              pinctrl-0 = <&pinctrl_flexspi0 &pinctrl_nor_chipdis>;

                              fsl,spi-num-chipselects = <1>;

                              cs-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
                              status = "okay";
                              flash0: s25fs512s@0{
                                      reg = <0>;
                                      #address-cells = <1>;
                                      #size-cells = <1>;
                                      compatible = "cy-snor";
                                      spi-max-frequency = <20000000>;
                               };
                            };

                             

                            Any suggestions ??

                             


                            Thanks,
                            Rutvij

                            1 of 1 people found this helpful
                            • 11. Re: U-Boot and Linux support for S25FS128S?

                              Hi,

                               

                              Any solution on above ?

                               

                              Regards,
                              Rutvij