This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4376: QSPI NOR flash probe fails

Part Number: AM4376

Tool/software: Linux

Hello All,

We are using AM4376 custom board having QSPI NOR flash( PART No: MX66L1G45G).

We used linux kernel(4.9.69) and u-boot(2017.01) provided by ti and buildroot as build system.

We made necessary changes in .dts(am437x-gp-evm.dts) and kernel configuration(mykernel_configuration) related to QSPI NOR flash.

but we are not able to probe QSPI NOR flash.

Out put of "dmesg | grep mtd" is as follow:

[    1.586648] mtdoops: mtd device (mtddev=name/number) must be supplied

cat /proc/mtd also show nothing.

Is there any step i am missing in device tree or linux kernel configuration?

Is MX66L1G45G is compatible with AM4376 QSPI?

I attached linux kernel configuration,dts file,uboot configuration,QSPI nor connection with AM4376,dmesg log for reference.

Regards,

Dhananjay 

Attachment :=

QSPI.tar.gz

  • Can you attach your full dmesg output? And can you attach it as a file? Thank you.

    Steve K.
  • Sorry about that, I just noticed the dmesg.txt. I don't see any driver loading errors. I did look at the spi-nor driver ids and could not find that part number. The last two Macronix ids in the table are
    { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) },
    { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) },

    Yet in u-boot I found
    {"mx66u51235f", INFO(0xc2253a, 0x0, 64 * 1024, 1024, RD_FULL | WR_QPP) },
    {"mx66l1g45g", INFO(0xc2201b, 0x0, 64 * 1024, 2048, RD_FULL | WR_QPP) },

    What happens if you try 'sf probe' in u-boot to see if u-boot finds the flash?

    Steve K.
  • Hi Steve ,

    Thank you for your valuable input.

    I add entry for "mx66l1g45g" in driver/mtd/spi-nor/spi-nor.c and drivers/mtd /devices/m25p80.c .

    Also I enable CONFIG_MTD_M25P80 in linux kernel.

    and mx66l1g get correctly probed. I attached dmesg log for reference.

    Unfortunately i unable to probe mx66l1g45g in u-boot.

    output of " sf probe " is as follow:

    SF: unrecognized JEDEC id bytes: 00, 00, 00

    Failed to initialize SPI flash at 0:0 (error -2)

    I attached u-boot dts file for your reference.

    is anything missing from u-boot side?

    Regards,

    Dhananjay


    Attachment:=

    23_MAY_2018.tar.gz

     

  • Can you enable debug in the driver? In drivers/mtd/spi/spi_flash.c modify it so that you have
    */

    #define DEBUG
    #include <common.h>
    #include <errno.h>

    There is some debug that might show us something.

    Steve K.
  • Hi Steve,

    I tried to debug driver by defining driver/mtd/spi/spi_flash.c but nothing appear on console.

    I define DEBUG in include/common.h and and use u-boot.img for finding some debug message.

    i am attaching u-boot log for your reference.

    Regards,

    Dhananjay  

    Attachment:=

    7180.u-bootlog.txt

  • Hi Steve,

    I issued sf probe on our custom board and AM437x starter kit

    On starter kit QSPI NOR flash detected correctly by sf probe (Please refer attach log) but failed on custom board.

    Please guide me to solve this issue.

    Attachments:=

    uclass_find_device_by_seq: 0 0
       - 0 -1
       - not found
    spi_find_bus_and_cs: No bus 0
    uclass_find_device_by_seq: 0 0
       - 0 -1
       - not found
    uclass_find_device_by_seq: 1 0
       - 0 -1
       - found
    uclass_find_device_by_seq: 0 0
       - 0 -1
       - not found
    Req index out of range
    OF: ** translation for device qspi@47900000 **
    OF: bus is default (na=1, ns=1) on ocp
    OF: translating address: 00009047
    OF: parent bus is default (na=1, ns=1) on                                          
    OF: no ranges, 1:1 translation                                                     
    OF: parent translation for: 00000000                                               
    OF: with offset: 1200619520                                                        
    OF: one level translation: 00009047                                                
    OF: reached root node
    OF: ** translation for device qspi@47900000 **
    OF: bus is default (na=1, ns=1) on ocp
    OF: translating address: 00000030
    OF: parent bus is default (na=1, ns=1) on 
    OF: no ranges, 1:1 translation
    OF: parent translation for: 00000000
    OF: with offset: 805306368
    OF: one level translation: 00000030
    OF: reached root node
    fdtdec_get_int: spi-max-frequency: 0x2dc6c00 (48000000)
    fdtdec_get_int: num-cs: 0x4 (4)
    ti_qspi_ofdata_to_platdata: regs=<0x47900000>, max-frequency=48000000
    fdtdec_get_int: spi-max-frequency: 0x2dc6c00 (48000000)
    spi_find_chip_select: plat=9df05978, cs=0
    uclass_find_device_by_seq: 0 -1
    uclass_find_device_by_seq: 0 0
       - -1 -1
       - not found
    spi_flash_std_probe: slave=9df06598, cs=0
    ti_spi_set_speed: hz: 48000000, clock divider 3
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read 00
    rx cmd 00390fff dc 00000005
    rx done, status 00030002, read 00
    rx cmd 00390fff dc 00000005
    rx done, status 00040002, read 00
    rx cmd 00390fff dc 00000005
    rx done, status 00050002, read 00
    rx cmd 00390fff dc 00000005
    rx done, status 00060002, read 00
    rx cmd 00390fff dc 00000005
    rx done, status 00070002, read 00
    SF: unrecognized JEDEC id bytes: 00, 00, 00
    spi_get_bus_and_cs: Error path, created=0, device 'm25p80@0'
    Failed to initialize SPI flash at 0:0 (error -2)
    Command failed, result=1
    
    

    uclass_find_device_by_seq: 0 0
       - 0 -1
       - not found
    spi_find_bus_and_cs: No bus 0
    uclass_find_device_by_seq: 0 0
       - 0 -1
       - not found
    uclass_find_device_by_seq: 1 0
       - 0 -1
       - found
    uclass_find_device_by_seq: 0 0
       - 0 -1
       - not found
    Req index out of range
    OF: ** translation for device qspi@47900000 **
    OF: bus is default (na=1, ns=1) on ocp
    OF: translating address: 00009047
    OF: parent bus is default (na=1, ns=1) on 
    OF: no ranges, 1:1 translation
    OF: parent translation for: 00000000
    OF: with offset: 1200619520
    OF: one level translation: 00009047
    OF: reached root node
    OF: ** translation for device qspi@47900000 **
    OF: bus is default (na=1, ns=1) on ocp
    OF: translating address: 00000030
    OF: parent bus is default (na=1, ns=1) on 
    OF: no ranges, 1:1 translation
    OF: parent translation for: 00000000
    OF: with offset: 805306368
    OF: one level translation: 00000030
    OF: reached root node
    fdtdec_get_int: spi-max-frequency: 0x2dc6c00 (48000000)
    fdtdec_get_int: num-cs: 0x4 (4)
    ti_qspi_ofdata_to_platdata: regs=<0x47900000>, max-frequency=48000000
    fdtdec_get_int: spi-max-frequency: 0x2dc6c00 (48000000)
    spi_find_chip_select: plat=bdf0d680, cs=0
    uclass_find_device_by_seq: 0 -1
    uclass_find_device_by_seq: 0 0
       - -1 -1
       - not found
    spi_flash_std_probe: slave=bdf0e370, cs=0
    ti_spi_set_speed: hz: 48000000, clock divider 3
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read c2
    rx cmd 00390fff dc 00000005
    rx done, status 00030002, read 20
    rx cmd 00390fff dc 00000005
    rx done, status 00040002, read 1a
    rx cmd 00390fff dc 00000005
    rx done, status 00050002, read c2
    rx cmd 00390fff dc 00000005
    rx done, status 00060002, read 20
    rx cmd 00390fff dc 00000005
    rx done, status 00070002, read 1a
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    tx cmd 003a0fff dc 00000005
    tx done, status 00020002
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read 43
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read 00
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read 00
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    tx cmd 003a0fff dc 00000005
    tx done, status 00020002
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read 40
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read 40
    tx cmd 003a0fff dc 00000005
    tx done, status 00010002
    rx cmd 00390fff dc 00000005
    rx done, status 00020002, read 00
    fdtdec_get_addr_size_fixed: memory-map: (not found)
    spi_flash_decode_fdt: Cannot decode address
    SF: Detected mx25l51235f with page size 256 Bytes, erase size 64 KiB, total 64 MiB, mapped at 30000000
    ti_spi_set_speed: hz: 48000000, clock divider 3
    spi_get_bus_and_cs: bus=bdf0d5b0, slave=bdf0e370
    
    

  • In u-boot, can you use md.l to dump the pinmux for the QSPI just to make sure it is correct?

    Steve K.
  • Also, are you doing pin muxing in mux.c in u-boot? It's done both in mux.c and the dts file in u-boot.

    Steve K.
  • Hi Steve,
    pinmuxing is done in board/ti/am43xx/mux.c and in dts file also.(dts file in uboot attached in previous post)
    If you compare log of SF probe of custom and starter kit there is difference.
    Please refer sf probe log attached in previous post.
    spi_find_chip_select: plat=9df05978, (for custom board).
    spi_find_chip_select: plat=bdf0d680, cs=0 (on starter kit).
    On Starter kit it correctly probed.
    Why there is difference?
    Regards,
    Dhananjay
  • I would like to see the pinmux for QSPI when booted from some other media. In the messages I saw the code reading a JEDEC id that is not correct.

    The spi_find_chip debug message is showing the platform id of the parent to the QSPI.
    for (device_find_first_child(bus, &dev); dev;
    device_find_next_child(&dev)) {
    struct dm_spi_slave_platdata *plat;

    plat = dev_get_parent_platdata(dev);
    debug("%s: plat=%p, cs=%d\n", __func__, plat, plat->cs);
    if (plat->cs == cs) {
    *devp = dev;
    return 0;
    }
    }

    I would expect to see the cs=0 for your custom board.

    Steve K.
  • Hi Steve,

    Thanks for continuous help and support.

    It was issue of pinmuxing.

    We successfully probed QSPI NOR in linux kernel and verified.

    We successfully probed QSPI NOR flash in uboot using sf probe 0.

    We get following output of sf probe 0

    spi_flash_std_probe: slave=9df23958, cs=0

    SF: Detected mx66l1g45g with page size 256 Bytes, erase size 64 KiB, total 128 MiB, mapped at 30000000

    We need to verify that QSPI NOR is successfully detected in uboot.

    Please suggest any method to verify QSPI NOR flash.

    Regards,

    Dhananjay Patil

  • I just noticed that your QSPI is 128MiB. The memory mapped region for the processor is only 64MiB so you could only use half of your QSPI. If you use it in legacy mode, it will be slower but you can access all 128MiB.

    When you see the message that your QSPI was detected, it has been detected. To test if it works try
    sf erase 0 0x4000000

    If it erased successfully, you will see
    SF: 67108864 bytes @ 0x0 Erased: OK

    Steve K.
  • Hi Steve,

    Thank you for help and support.

    How to use QSPI NOR in legacy mode?
    Is it by enabling SPI_FLASH_BAR option in u-boot?
    and do we need any changes in u-boot source code?

    Regards,
    Dhananjay Patil