14 Replies Latest reply on Nov 30, 2018 6:45 AM by GernotH_31

    Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform

      Hi Folks,
      I'm very new to memory technology,
      I'm working on imx8 platform(yocto and kernel build 4.14) and and have attached S25FS512.

       

      I'm able to find id of this nor flash into ./drivers/mtd/spi/spi_flash_ids.c. now in my config CONFIG_SPI_FLASH_STMICRO is enabled by default but i might need to enable

      CONFIG_SPI_FLASH_SPANSION(?!)

      So is there any documentation available on DTS changes and u-boot/kernel changes to get a starter.

      Please let me know if more information is needed from my end.

       

      Any leads would greatly appreciable.

       

      Thanks & Regards,
      Rutvij

        • 1. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
          BushraH_91

          Hello Rutvij,

          Thank you for contacting Cypress Community Forum. Currently we are reviewing the issue and will get back to you as soon as we find the resolution.

           

          Regards,

          Bushra

          • 2. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform


            HI,Thanks for reply.
            hoping to get sooner positive response to start the hold development.

             


            Regards,
            Rutvij

            • 3. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform

              Hi, just fyi i'm getting below logs in kernel 4.14

              root@imx8qxpmek:~# dmesg | grep -i spi

              [    1.499912]1206-spi_nor_read_id

              [    1.504259] fsl-flexspi 5d120000.flexspi: unrecognized JEDEC id bytes: 00, 00, 00

              [    1.511757] fsl-flexspi 5d120000.flexspi: Freescale FlexSPI probe failed

              [    1.518561] fsl-flexspi: probe of 5d120000.flexspi failed with error -2

               

              It seems Nor is not getting detected.

               

               

              Regards,

              Rutvij

              • 4. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
                BushraH_91

                Hello

                Please refer to url for Cypress SPI Flash drivers for Linux Kernel 4.14.0. Let us know if this resolves your issue.

                 

                URL - http://www.cypress.com/products/serial-nor-flash-memory

                 

                Thank you

                Regards,

                Bushra

                1 of 1 people found this helpful
                • 5. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
                  TakahiroK_16

                  Hi Rutvij,

                   

                  According to your kernel log, the SPI master controller (flex SPI in iMX8) does not read correct device ID (all id bytes are 00).

                  So, the problems are in the lower level like host to Flash connection, SPI controller settings, or SPI driver (drivers/spi/xxx) configs.

                   

                  Thanks,

                  Takahiro

                  • 6. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform

                    Hi, BushraH_91, TakahiroK_16,

                     

                    Thank for the replay

                     

                    I applied patch from suggested link for 4.14 kernel.
                    I'm having kernel files as mentioned in README.txt ,I went to menuconfig and enable cypress drivers.
                    Still driver is not being called-up and I'm still getting above logs.

                     

                    root@imx8qxpmek:~# dmesg | grep -i spi

                    [    1.499912]1206-spi_nor_read_id

                    [    1.504259] fsl-flexspi 5d120000.flexspi: unrecognized JEDEC id bytes: 00, 00, 00

                    [    1.511757] fsl-flexspi 5d120000.flexspi: Freescale FlexSPI probe failed

                    [    1.518561] fsl-flexspi: probe of 5d120000.flexspi failed with error -2

                     

                    i found these above logs are from ./drivers/mtd/spi-nor/spi-nor.c

                     

                    I did check for running kernel's configuration and has below of them.

                     

                    zcat /proc/config.gz

                    # CONFIG_MTD_LPDDR is not set

                    CONFIG_MTD_SPI_NOR=y

                    # CONFIG_MTD_MT81xx_NOR is not set

                    # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set

                    CONFIG_MTD_CY_SNOR=y

                    CONFIG_MTD_CY_SNOR_HAL=y

                    CONFIG_MTD_UBI=y

                     

                     

                    my dts configuration has now been changed and looks as per below ,

                     

                    &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>;
                       };
                    };


                    I tried even putting some debug prints in cy-snor.c 's probe function further , but no luck


                    Also can we add support for S25FS512S nor flash in ./drivers/mtd/spi-nor/spi-nor.c current mostly supported linux driver? if yes then any leads ?

                    So is there anything I'm missing here ?

                     


                    Regards,
                    Rutvij.

                    • 7. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform

                      HI BushraH_91,

                       

                      Any solution on above ?

                       


                      Reagards,
                      Rutvij

                      • 8. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
                        BushraH_91

                        Hello,

                        Sorry for late reply. I was out-of-office. I have sent your code to s/w group. Please bear with me.

                         

                        Thank you

                        Regards,

                        Bushra

                        • 9. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
                          TakahiroK_16

                          Hi Rutvij,

                           

                          The device id bytes in your log are still 00, 00, 00. This means the connection between the host (iMX8) and Flash is not established.

                          Could you make sure if the cs-gpio setting in your DTS matches your HW? And if possible, I would suggest to prove a logic analyzer or an oscilloscope to Flash pins and check if they are correctly controlled by the host.

                           

                          Thanks,

                          Takahiro

                          • 10. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
                            BacemD_61

                            Hello Rutvij,

                             

                            it looks like you still have problems instlling the cypress drivers cy-snor.

                            In order to do it properly, please follow the following steps:

                             

                              1. After applying the patch to the kernel tree, new options are selectable in

                              the kernel configuration menu (Device Drivers -> Memory Technology Device

                              support -> Cypress SPI Device Support). In this submenu, the chip driver

                              as well as the generic interface driver can be selected.

                             

                              2. Finally, board drivers or device trees need to bind the SPI device with

                              "cy-snor" instead of "m25p80" (or "spi-nor") to chose the new driver, that

                              is all.

                             

                            After that, you should see the modules being compiled and the cy-snor driver involved.

                             

                            Best regards,

                            Bacem

                            -----

                            Bacem Daassi

                            Cypress Semiconductor Corp.

                            Customer Applications Engineering

                            • 11. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform

                              Hi BushraH_91, TakahiroK_16

                               

                              I was trying to debug meanwhile and found that cs-gpio was acquired by u-boot and was unable to release, i did the fix.
                              After doing above i found nor flash is being detected with s25fl512s FL series , but my nor flash is s25fs512s FS series, i did changes in ids array and added
                              { "s25fs512s", INFO6(0x010220, 0x4d0081, 256 * 1024, 256, SPI_NOR_DUAL_IO_READ | SPI_NOR_QUAD_IO_READ) },
                              and commented out

                              //{ "s25fl512s",  INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },

                              in 4.14 kernel's spi-nor.c

                               

                              so in dmesg log now I'm getting below

                              root@imx8qxpmek:~# dmesg | grep -i spi

                              [    1.538749] fsl-flexspi 5d120000.flexspi: s25fs512s (65536 Kbytes)

                               

                              Above created entry in /dev/mtd0

                               

                              Then i tried to write a file using below command but gets below error

                               

                              root@imx8qxpmek:~# time dd if=write.dat of=/dev/mtd0 

                              [   69.086238] fsl-flexspi 5d120000.flexspi: Unsupported cmd 0x12


                              And while reading from nor flash using below command kernel crashes

                              time dd if=/dev/mtd1 of=read.dat bs=1024 count=16

                               

                              [  114.672900] Synchronous External Abort: synchronous external abort (0x96000210) at 0xffff00000e000000

                              [  114.682193] Internal error: : 96000210 [#1] PREEMPT SMP

                              [  114.687422] Modules linked in:

                              [  114.690484] CPU: 0 PID: 3554 Comm: dd Not tainted 4.14.62-imx_4.14.62_1.0.0_beta+g0a8c3a9 #1

                              [  114.698924] Hardware name: Freescale i.MX8QXP MEK (DT)

                              [  114.704067] task: ffff80007a7b9b00 task.stack: ffff000015e18000

                              [  114.710001] PC is at __memcpy+0x100/0x180

                              [  114.714020] LR is at fsl_flexspi_read+0x178/0x1d8

                              [  114.718722] pc : [<ffff000008c9d780>] lr : [<ffff00000876f238>] pstate: 20000145

                              [  114.726122] sp : ffff000015e1bc80

                              [  114.729432] x29: ffff000015e1bc80 x28: ffff000015e1beb8

                              [  114.734749] x27: ffff000008cd1000 x26: 0000000000000400

                              [  114.740065] x25: 00000000015c4000 x24: ffff000015e1bd70

                              [  114.745382] x23: ffff80007b759800 x22: ffff80007b759800

                              [  114.750699] x21: 0000000000000400 x20: 0000000000000000

                              [  114.756016] x19: ffff80007b108018 x18: 0000000000000366

                              [  114.761332] x17: 000000000041f218 x16: ffff000008214438

                              [  114.766649] x15: 0000ffff9224ede0 x14: 0000ffff9225c2c8

                              [  114.771966] x13: 000000000000270f x12: 0000000000000001

                              [  114.777282] x11: 0000000000000000 x10: 0101010101010101

                              [  114.782599] x9 : 0000000000000200 x8 : 00000000c00000b7

                              [  114.787916] x7 : 0000000000000000 x6 : ffff80007b759800

                              [  114.793233] x5 : ffff000015e1bb68 x4 : 0000000000000000

                              [  114.798549] x3 : 0000000000000400 x2 : 0000000000000380

                              [  114.803866] x1 : ffff00000e000000 x0 : ffff80007b759800

                              [  114.809185] Process dd (pid: 3554, stack limit = 0xffff000015e18000)

                              [  114.815536] Call trace:

                              [  114.817979] Exception stack(0xffff000015e1bb40 to 0xffff000015e1bc80)

                              [  114.824427] bb40: ffff80007b759800 ffff00000e000000 0000000000000380 0000000000000400

                              [  114.832261] bb60: 0000000000000000 ffff000015e1bb68 ffff80007b759800 0000000000000000

                              [  114.840097] bb80: 00000000c00000b7 0000000000000200 0101010101010101 0000000000000000

                              [  114.847935] bba0: 0000000000000001 000000000000270f 0000ffff9225c2c8 0000ffff9224ede0

                              [  114.855769] bbc0: ffff000008214438 000000000041f218 0000000000000366 ffff80007b108018

                              [  114.863607] bbe0: 0000000000000000 0000000000000400 ffff80007b759800 ffff80007b759800

                              [  114.871441] bc00: ffff000015e1bd70 00000000015c4000 0000000000000400 ffff000008cd1000

                              [  114.879278] bc20: ffff000015e1beb8 ffff000015e1bc80 ffff00000876f238 ffff000015e1bc80

                              [  114.887114] bc40: ffff000008c9d780 0000000020000145 ffff000015e1bc80 ffff00000876a670

                              [  114.894950] bc60: 0000ffffffffffff 0000000000000000 ffff000015e1bc80 ffff000008c9d780

                              [  114.902789] [<ffff000008c9d780>] __memcpy+0x100/0x180

                              [  114.907844] [<ffff00000876a904>] spi_nor_read+0xa4/0x120

                              [  114.913162] [<ffff000008761d04>] mtd_read+0x3c/0x80

                              [  114.918042] [<ffff000008766ac0>] mtdchar_read+0xd0/0x238

                              [  114.923362] [<ffff000008213c40>] __vfs_read+0x18/0x108

                              [  114.928500] [<ffff000008213dc0>] vfs_read+0x90/0x170

                              [  114.933470] [<ffff000008214480>] SyS_read+0x48/0xb0

                              [  114.938350] Exception stack(0xffff000015e1bec0 to 0xffff000015e1c000)

                              [  114.944799] bec0: 0000000000000000 00000000015c4000 0000000000000400 0000ffff9239e190

                              [  114.952634] bee0: 00000000015c32b0 00000000015c4000 0000000000404630 0000000000000000

                              [  114.960471] bf00: 000000000000003f 0000ffff923a0270 0101010101010101 0000000000000000

                              [  114.968309] bf20: 0000000000000001 000000000000270f 0000ffff9225c2c8 0000ffff9224ede0

                              [  114.976143] bf40: 0000ffff9230bc18 000000000041f218 0000000000000366 0000000000000000

                              [  114.983981] bf60: 0000000000000400 00000000015c4000 0000000000000000 0000000000000000

                              [  114.991815] bf80: 0000000000000000 0000ffff923a0290 0000000000000010 000000000040d000

                              [  114.999651] bfa0: 0000000000000000 0000ffffd49f20a0 000000000040467c 0000ffffd49f20a0

                              [  115.007487] bfc0: 0000ffff9230bc44 0000000080000000 0000000000000000 000000000000003f

                              [  115.015323] bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000

                              [  115.023164] [<ffff000008083b18>] __sys_trace_return+0x0/0x4

                              [  115.028742] Code: d503201f d503201f d503201f d503201f (a8c12027)

                              [  115.034837] ---[ end trace b5768ae2a9a6b45e ]---

                               

                              I also again tried cy-nor driver provided by in above link but facing still the same issue of not getting call of probe function if even dts has "cy-snor" and makemenu config has driver enabled.

                               

                              Any leads ?

                               

                              Regards,
                              Rutvij

                              • 12. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
                                TakahiroK_16

                                Hi Rutvij,

                                 

                                root@imx8qxpmek:~# time dd if=write.dat of=/dev/mtd0

                                [   69.086238] fsl-flexspi 5d120000.flexspi: Unsupported cmd 0x12

                                 

                                Obviously, the fsl-flexspi driver does not support 0x12 (Page Program in 4-byte address) command. Please look into the driver source code and add the 0x12 command support. I think the fsl-flexspi driver is provided by NXP as BSP for iMX8 so you may want to contact NXP for more details.

                                 

                                Regarding kernel crash, something wrong happens in memcpy(). Since I don't see memcpy() in the spi_nor_read() in the drivers/mtd/spi-nor/spi-nor.c, I think it is called from the fsl-flexspi. Please also look into the fsl-flexspi driver and debug it.

                                 

                                [  114.902789] [<ffff000008c9d780>] __memcpy+0x100/0x180

                                [  114.907844] [<ffff00000876a904>] spi_nor_read+0xa4/0x120

                                 

                                Thanks,

                                Takahiro

                                • 13. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform

                                  Hi TakahiroK_16 buha,

                                  Is there anything to work with cy-nor driver provided by cypress ?
                                  I tried and debug above mentioned (in most above thread) steps and verified in kernel for it working availability.
                                  but even after adding cy-snor tag in my dts , I'm still not able to load the drivers as mentioned above.

                                   


                                  Regards,
                                  Rutvij

                                  • 14. Re: Need help in bring up S25FS512SAGNFI010-ND NOR flash on IMX8 platform
                                    GernotH_31

                                    Hi Ritvij,

                                     

                                    our driver (cy-snor) needs a SPI framework compatible SPI controller driver. NXP seems to go their own path regarding this. Where does the fsl-flexspi driver come from? In a normal 4.14.0 kernel source tree, I only find drivers/mtd/spi-nor/fsl-quadspi.c but no fsl-flexspi.c. Did they extend their BSPs by that?

                                     

                                    Unfortunately, we do not have an i.MX8 system here to test. Also, as Takahiro has mentioned, if you read 0-0-0 as device ID then something fundamental is wrong in your system. In order to debug this further, I would suggest to attach a logic analyzer to the SPI bus to see if and what is going on at the bus level. Does the controller send the ReadID (0x9F) op code to the flash device?

                                     

                                    Best regards,

                                    Gernot