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/DRA722: QSPI (dual read ,single write) boot stuck at image entry()

Part Number: DRA722

Tool/software: Linux

Hi,

I'm trying to load u-boot from QSPI(micron 64 MB SPI NOR FLASH on a custom board based on DRA722).But I'm stuck at this point:


U-Boot SPL 2016.05 (Nov 28 2017 - 17:44:59)
DRA722-GP ES2.0
Trying to boot from SPI
ti_spi_set_speed: hz: 76800000, clock divider 0
spi_claim_bus: bus:0 cs:0
spi_xfer: bus:0 cs:0 bitlen:8 flags:1
tx cmd 003a0fff dc 00000000
tx done, status 00010002
spi_xfer: bus:0 cs:0 bitlen:40 flags:2
rx cmd 00390fff dc 00000000
rx done, status 00020002, read 20
rx cmd 00390fff dc 00000000
rx done, status 00030002, read ba
rx cmd 00390fff dc 00000000
rx done, status 00040002, read 22
rx cmd 00390fff dc 00000000
rx done, status 00050002, read 10
rx cmd 00390fff dc 00000000
rx done, status 00060002, read 44
SF: Got idcodes
00000000: 20 ba 22 10 44                                      .".D
spi_claim_bus: bus:0 cs:0
spi_xfer: bus:0 cs:0 bitlen:8 flags:1
tx cmd 003a0ff00000
tx done, status 00010002
spi_xfer: bus:0 cs:0 bitlen:8 flags:2
rx cmd 00390fff dc 00000000
rx done, status 00020002, read 00
spi_release_bus: bus:0 cs:0
spi_release_bus: bus:0 cs:0
Unsupported OS image.. Jumping nevertheless..
loaded - jumping to U-Boot...image entry point: 0x0
boot-common.c:image size :0x0
image load_addr:0x0

This is my dtb config

&qspi {
        status = "okay";

        /*spi-max-frequency = <76800000>;*/
        spi-max-frequency = <1000>;
        m25p80@0 {
                compatible = "mt25ql02g","m25p80";
                /*spi-max-frequency = <76800000>;*/
            spi-max-frequency = <1000>;
                reg = <0>;
                spi-tx-bus-width = <1>;
                spi-rx-bus-width = <2>;
                #address-cells = <1>;
                #size-cells = <1>;
        
                /*MTD partition table.
                 * The ROM checks the first four physical blocks
                 * for a valid file to boot and the flash here is
                 * 64KiB block size.*/
                partition@0 {
                        label = "QSPI.SPL";
                        reg = <0x00000000 0x00040000>;
                };
                partition@1 {
                        label = "QSPI.u-boot";
                        reg = <0x00040000 0x00100000>;
                };
                partition@2 {
                        label = "QSPI.u-boot-spl-os";
                        reg = <0x00140000 0x00080000>;
                };
                partition@3 {
                        label = "QSPI.u-boot-env";
                        reg = <0x001c0000 0x00010000>;
                };
                partition@4 {
                        label = "QSPI.u-boot-env.backup1";
                        reg = <0x001d0000 0x0010000>;
                };
                partition@5 {
                        label = "QSPI.kernel";
                        reg = <0x001e0000 0x0800000>;
                };
                partition@6 {
                        label = "QSPI.file-system";
                        reg = <0x009e0000 0x01620000>;
                };
        };

};

I flashed MLO,u-boot.img,uImage and the dtb file to corresponding partitions(tried flashing using both sf write and mtd_debug write).After flashing i used hexdump -C /dev/mtd0 etc to check whether the files are written successfully.Writing seems fine.I tried changing frequencies,dtb configs,sf_param.c configs ,but it never went past this point.

What can be the root cause?What might be the reason that image entry point,image size and image load_addr is 0x0?

Regards,

Murugan

  • Hi Murugan,

    I have forwarded your question to U-boot expert.

    Regards,
    Yordan
  • Murugun

    I assume this is custom EVM, and you configured for dual read and single write? Have you test verified the qspi read/write and integrity check ?

    How did you flash MLO, u-boot.img to QSPI, using sd/boot or SPL-DFU?
    Can you use DFU to flash MLO and u-boot.img, rather than using sf_write.

    Regards
    Ravi
  • Hi Ravi,

    1)Yes,its a custom EVM.

    2)I experimented with several configuration as i couldnt find any documentation on "dual read" in particular.So I am not sure if my configurations are right.These are the changes i made for dual read:

                         a)In u-boot/drivers/mtd/spi/sf_params.c I tried parameters RD_EXTN and RD_NORM

                          eg:{"mt25ql02g",      0x20ba22, 0x0,       64 * 1024,  4096, RD_EXTN, WR_QPP | E_FSR | SECT_4K},

                         b)In u-boot/arch/arm/dra72-evm-common.dtsi ,I used

                                      spi-rx-bus-width = <2>;

                               Instead of

                                        spi-rx-bus-width=<4>;

    Did i miss any configuration?

    3)Yes and I found that data was WRITTEN CORRECTLY but was READ INCORRECTLY.By default mode 0 is being used (single write and single read ,i suppose).So I tried forcing DUAL and QUAD read by modifying u-boot/drivers/spi/ti_qspi.c    and observed some strange behaviours:

                    I tried to write the following pattern.

                     INPUT PATTERN:

    82000000: 00000001 00000002 00000003 00000004    ................
    82000010: 00000005 00000006 00000007 00000008    ................
    82000020: 00000009 00000010 00000011 00000012    ................
    82000030: 00000013 00000014 00000015 00000016    ................
    82000040: 00000017 00000018 00000019 00000020    ............ ...
    82000050: 00000021 00000022 00000023 00000024    !..."...#...$...
    82000060: 00000025 00000026 00000027 00000028    %...&...'...(...
    82000070: 00000029 00000030 00000031 00000032    )...0...1...2...
    82000080: 00000033 00000034 00000035 00000036    3...4...5...6...
    82000090: 00000037 00000038 00000039 00000040    7...8...9...@...
    820000a0: 00000041 00000042 00000043 00000044    A...B...C...D...
    820000b0: 00000045 00000046 00000047 00000048    E...F...G...H...
    820000c0: 00000049 00000050 00000051 00000052    I...P...Q...R...
    820000d0: 00000053 00000054 00000055 00000056    S...T...U...V...
    820000e0: 00000057 00000058 00000059 00000060    W...X...Y...`...
    820000f0: 00000061 00000062 00000063 00000064    a...b...c...d...
    82000100: 00000065 00000066 00000067 00000068    e...f...g...h...
    82000110: 00000069 00000070 00000071 00000072    i...p...q...r...
    82000120: 00000073 00000074 00000075 00000076    s...t...u...v...
    82000130: 00000077 00000078 00000079 00000080    w...x...y.......
    82000140: 00000081 00000082 00000083 00000084    ................
    82000150: 00000085 00000086 00000087 00000088    ................
    82000160: 00000089 00000090 00000091 00000092    ................
    82000170: 00000093 00000094 00000095 00000096    ................
    82000180: 00000097 00000098 00000099 00000100    ................
    82000190: 00000101 00000102 00000103 00000104    ................
    820001a0: 00000105 00000106 00000107 00000108    ................
    820001b0: 00000109 00000110 00000111 00000112    ................
    820001c0: 00000113 00000114 00000115 00000116    ................
    820001d0: 00000117 00000118 00000119 00000120    ............ ...
    820001e0: 00000121 00000122 00000123 00000124    !..."...#...$...
    820001f0: 00000125 00000126 00000127 00000128    %...&...'...(...
    
    

                                    OUTPUT PATTERNS:

                                 a)when mode is SPI_RX_DEFUALT(mode 0):

    mode:SPI_RX_DEFUALT
    83000000: 02000000 03000000 04000000 05000000    ................
    83000010: 06000000 07000000 08000000 09000000    ................
    83000020: 10000000 11000000 12000000 13000000    ................
    83000030: 14000000 15000000 16000000 17000000    ................
    83000040: 18000000 19000000 20000000 21000000    ........... ...!
    83000050: 22000000 23000000 24000000 25000000    ..."...#...$...%
    83000060: 26000000 27000000 28000000 29000000    ...&...'...(...)
    83000070: 30000000 31000000 32000000 33000000    ...0...1...2...3
    83000080: 02000000 03000000 04000000 05000000    ................
    83000090: 06000000 07000000 08000000 09000000    ................
    830000a0000000 11000000 12000000 13000000    ..........
    830000b0: 14000000 15000000 16000000 17000000    ................
    830000c0: 18000000 19000000 20000000 21000000    ........... ...!
    830000d0: 22000000 23000000 24000000 25000000    ..."...#...$...%
    830000e0: 26000000 27000000 28000000 29000000    ...&...'...(...)
    830000f0: 30000000 31000000 32000000 33000000    ...0...1...2...3
    83000100: 00020000 00030000 00040000 00050000    ................
    83000110: 00060000 00070000 00080000 00090000    ................
    83000120: 00100000 00110000 00120000 00130000    ................
    83000130: 00140000 00150000 00160000 00170000    ................
    83000140: 00180000 00190000 00200000 00210000    .......... ...!.
    83000150: 00220000 00230000 00240000 00250000    .."...#...$...%.
    83000160: 00260000 00270000 00280000 00290000    ..&...'...(...).
    83000170: 00300000 00310000 00320000 00330000    ..0...1...2...3.
    83000180: 00020000 00030000 00040000 00050000    ................
    83000190: 00060000 00070000 00080000 00090000    ................
    830001a0: 00100000 00110000 00120000 00130000    ................
    830001b0: 00140000 00150000 00160000 00170000    ................
    830001c0: 00180000 00190000 00200000 00210000    .......... ...!.
    830001d0: 00220000 00230000 00240000 00250000    .."...#...$...%.
    830001e0: 00260000 00270000 00280000 00290000    ..&...'...(...).
    830001f0: 00300000 00310000 00320000 00330000 
    

                                      b)when mode is SPI_RX_DUAL:

    mode:SPI_RX_DUAL
    83000000: 00300020 00100000 00300020 00100000     .0..... .0.....
    83000010: 00500040 00700060 00500040 00700060    @.P.`.p.@.P.`.p.
    83000020: 00500040 00900080 00b000a0 00900080    @.P.............
    83000030: 00b000a0 00900080 00d000c0 00f000e0    ................
    83000040: 00d000c0 00f000e0 00d000c0 00100000    ................
    83000050: 00300020 00100000 00300020 00100000     .0..... .0.....
    83000060: 00500040 00700060 00500040 00700060    @.P.`.p.@.P.`.p.
    83000070: 00500040 00900080 00b000a0 00900080    @.P.............
    83000080: 00000000 00000000 00000000 00000000    ................
    83000090: 00000000 00000000 00000000 00000000    ................
    830000a0: 00000000 00000000 00000000 00000000    ................
    830000b0: 00000000 00000000 00000000 00000000    ................
    830000c0: 00000000 00000000 00000000 00000000    ................
    830000d0: 00000000 00000000 00000000 00000000    ................
    830000e0: 00000000 00000000 00000000 00000000    ................
    830000f0: 00000000 00000000 00000000 00000000    ................
    83000100: 00000300 02000100 00000300 04000100    ................
    83000110: 06000500 04000700 06000500 04000700    ................
    83000120: 08000500 0a000900 08000b00 0a000900    ................
    83000130: 08000b00 0c000900 0e000d00 0c000f00    ................
    83000140: 0e000d00 0c000f00 00000d00 02000100    ................
    83000150: 00000300 02000100 00000300 04000100    ................
    83000160: 06000500 04000700 06000500 04000700    ................
    83000170: 08000500 0a000900 08000b00 0a000900    ................
    83000180: 00000000 00000000 00000000 00000000    ................
    83000190: 00000000 00000000 00000000 00000000    ................
    830001a0: 00000000 00000000 00000000 00000000    ................
    830001b0: 00000000 00000000 00000000 00000000    ................
    830001c0: 00000000 00000000 00000000 00000000    ................
    830001d0: 00000000 00000000 00000000 00000000    ................
    830001e0: 00000000 00000000 00000000 00000000    ................
    830001f0: 00000000 00000000 00000000 00000000    ................
    
    

                                             c)when mode is SPI_RX_QUAD(mode 8):

    mode:SPI_RX_QUAD
    83000000: 00000001 00000002 00000003 00000004    ................
    83000010: 00000005 00000006 00000007 00000008    ................
    83000020: 00000009 00000010 00000011 00000012    ................
    83000030: 00000013 00000014 00000015 00000016    ................
    83000040: 00000017 00000018 00000019 00000020    ............ ...
    83000050: 00000021 00000022 00000023 00000024    !..."...#...$...
    83000060: 00000025 00000026 00000027 00000028    %...&...'...(...
    83000070: 00000029 00000030 00000031 00000032    )...0...1...2...
    83000080: cccccccc cccccccc cccccccc cccccccc    ................
    83000090: cccccccc cccccccc cccccccc cccccccc    ................
    830000a0: cccccccc cccccccc cccccccc cccccccc    ................
    830000b0: cccccccc cccccccc cccccccc cccccccc    ................
    830000c0: cccccccc cccccccc cccccccc cccccccc    ................
    830000d0: cccccccc cccccccc cccccccc cccccccc    ................
    830000e0: cccccccc cccccccc cccccccc cccccccc    ................
    830000f0: cccccccc cccccccc cccccccc cccccccc    ................
    83000100: 00000065 00000066 00000067 00000068    e...f...g...h...
    83000110: 00000069 00000070 00000071 00000072    i...p...q...r...
    83000120: 00000073 00000074 00000075 00000076    s...t...u...v...
    83000130: 00000077 00000078 00000079 00000080    w...x...y.......
    83000140: 00000081 00000082 00000083 00000084    ................
    83000150: 00000085 00000086 00000087 00000088    ................
    83000160: 00000089 00000090 00000091 00000092    ................
    83000170: 00000093 00000094 00000095 00000096    ................
    83000180: 00000097 00000098 00000099 00000100    ................
    83000190: 00000101 00000102 00000103 00000104    ................
    830001a0: 00000105 00000106 00000107 00000108    ................
    830001b0: 00000109 00000110 00000111 00000112    ................
    830001c0: 00000113 00000114 00000115 00000116    ................
    830001d0: 00000117 00000118 00000119 00000120    ............ ...
    830001e0: 00000121 00000122 00000123 00000124    !..."...#...$...
    830001f0: 00000125 00000126 00000127 00000128    %...&...'...(...
    
    

    4)I used sf read,write,erase commands to write MLO and u-boot.img through sd boot.I also tried flashing using mtd_debug write command.But I have not tried SPL-DFU method yet.Will it make a difference since there seems to be an issue with reading from qspi?

                                                                                    As you can see ,the pattern is matching the most when the mode is QUAD(at least data is aligned ).I changed the frequency to a higher value than that specified in <spi-max-frequency> from uboot using,

                        sf probe 0 90000000 (value of spi-max-frequency was 79000000) and strangely enough the pattern was perfectly matching but the read  was extremely slow.Also was not able to WRITE at this frequency(strange again).But its useless for me because I cannot do this when i set the SYSBOOT switches for qspi boot.

    What  Is the right way to configure dual read and single write mode ?

    What exactly happens when i sf probe with value higher that specified as spi-max-frequency in the dtsi and other files?

    How can I change the mode without mofiying the ti_qspi.c file?

    Thanks for your time and patience.

    Regards,

    Murugan S

  • Hi Murugan,

    Can you try disabling DMA for QSPI read and check? I want to check if the CPU reads work.

    You can delete "#define CONFIG_TI_EDMA3" from dra7xx_evm.h to disable EDMA.

    regards,
    Venkat
  • Hi Venkat,

                                      As you suggested, I disabled EDMA and these are the output patterns(input pattern is same as before):

                     a)When mode is SPI_RX_DEFAULT(mode 0):

    mode:SPI_RX_DEFAULT
    
    83000000: 02000000 02000000 02000000 02000000    ................
    83000010: 02000000 02000000 02000000 02000000    ................
    83000020: 02000000 02000000 02000000 02000000    ................
    83000030: 02000000 02000000 02000000 02000000    ................
    83000040: 02000000 02000000 02000000 02000000    ................
    83000050: 02000000 02000000 02000000 02000000    ................
    83000060: 02000000 02000000 02000000 02000000    ................
    83000070: 02000000 02000000 02000000 02000000    ................
    83000080: 02000000 02000000 02000000 02000000    ................
    83000090: 02000000 02000000 02000000 02000000    ................
    830000a0: 02000000 02000000 02000000 02000000    ................
    830000b0: 02000000 02000000 02000000 02000000    ................
    830000c0: 02000000 02000000 02000000 02000000    ................
    830000d0: 02000000 02000000 02000000 02000000    ................
    830000e0: 02000000 02000000 02000000 02000000    ................
    830000f0: 02000000 02000000 0200    ................
    83000100: 00020000 00020000 00020000 00020000    ................
    83000110: 00020000 00020000 00020000 00020000    ................
    83000120: 00020000 00020000 00020000 00020000    ................
    83000130: 00020000 00020000 00020000 00020000    ................
    83000140: 00020000 00020000 00020000 00020000    ................
    83000150: 00020000 00020000 00020000 00020000    ................
    83000160: 00020000 00020000 00020000 00020000    ................
    83000170: 00020000 00020000 00020000 00020000    ................
    83000180: 00020000 00020000 00020000 00020000    ................
    83000190: 00020000 00020000 00020000 00020000    ................
    830001a0: 00020000 00020000 00020000 00020000    ................
    830001b0: 00020000 00020000 00020000 00020000    ................
    830001c0: 00020000 00020000 00020000 00020000    ................
    830001d0: 00020000 00020000 00020000 00020000    ................
    830001e0: 00020000 00020000 00020000 00020000    ................
    830001f0: 00020000 00020000 00020000 00020000    ................
    
    

                     b)When mode is SPI_RX_DUAL       (mode 4):

    mode:SPI_RX_DUAL
    
    83000000: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    83000010: c6c6c6c6 00000000 c6c6c6c6 2a000000    ...............*
    83000020: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    83000030: c6c6c6c6 aa000000 c6c6c6c6 00000000    ................
    83000040: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    83000050: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    83000060: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    83000070: c6c6c6c6 a2020000 c6c6c6c6 00000000    ................
    83000080: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    83000090: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    830000a0: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    830000b0: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    830000c0: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    830000d0: c6c6c6c6 00000000 c6c6c6c6 aaaa0a00    ................
    830000e0: c6c6c6c6 8a0a0000 c6c6c6c6 00000000    ................
    830000f0: c6c6c6c6 00000000 c6c6c6c6 00000000    ................
    83000100: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000110: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000120: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000130: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000140: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000150: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000160: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000170: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000180: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    83000190: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    830001a0: 6c6c6c6c aaaa2a00 6c6c6c6c aaaa2a00    llll.*..llll.*..
    830001b0: 6c6c6c6c aaaa2a00 6c6c6c6c 00000000    llll.*..llll....
    830001c0: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    830001d0: 6c6c6c6c aa2a0000 6c6c6c6c aa2a0000    llll..*.llll..*.
    830001e0: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    830001f0: 6c6c6c6c 00000000 6c6c6c6c 00000000    llll....llll....
    
    

                     c)When mode is SPI_RX_QUAD       (mode 8):

    mode:SPI_RX_QUAD
    
    83000000: 00000001 cccccccc 00000003 cccccccc    ................
    83000010: 00000005 cccccccc 00000007 cccccccc    ................
    83000020: 00000009 cccccccc 00000011 cccccccc    ................
    83000030: 00000013 cccccccc 00000015 cccccccc    ................
    83000040: 00000017 cccccccc 00000019 cccccccc    ................
    83000050: 00000021 cccccccc 00000023 cccccccc    !.......#.......
    83000060: 00000025 cccccccc 00000027 cccccccc    %.......'.......
    83000070: 00000029 cccccccc 00000031 cccccccc    ).......1.......
    83000080: 00000033 cccccccc 00000035 cccccccc    3.......5.......
    83000090: 00000037 cccccccc 00000039 cccccccc    7.......9.......
    830000a0: 00000041 cccccccc 00000043 cccccccc    A.......C.......
    830000b0: 00000045 cccccccc 00000047 cccccccc    E.......G.......
    830000c0: 00000049 cccccccc 00000051 cccccccc    I.......Q.......
    830000d0: 00000053 eecccccc 00000055 eecccccc    S.......U.......
    830000e0: 00000057 cccccccc 00000059 cccccccc    W.......Y.......
    830000f0: 00000061 cccccccc 00000063 cccccccc    a.......c.......
    83000100: 00000065 cccccccc 00000067 cccccccc    e.......g.......
    83000110: 00000069 cccccccc 00000071 cccccccc    i.......q.......
    83000120: 00000073 cccccccc 00000075 cccccccc    s.......u.......
    83000130: 00000077 cccccccc 00000079 00000080    w.......y.......
    83000140: 00000081 00000082 00000083 00000084    ................
    83000150: 00000085 00000086 00000087 00000088    ................
    83000160: 00000089 00000090 00000091 00000092    ................
    83000170: 00000093 00000094 00000095 00000096    ................
    83000180: 00000097 00000098 00000099 cccccccc    ................
    83000190: 00000101 cccccccc 00000103 cccccccc    ................
    830001a0: 00000105 cccccccc 00000107 cccccccc    ................
    830001b0: 00000109 eececccc 00000111 cccccccc    ................
    830001c0: 00000113 cccccccc 00000115 cccccccc    ................
    830001d0: 00000117 cccccccc 00000119 cccccccc    ................
    830001e0: 00000121 cccccccc 00000123 cccccccc    !.......#.....
    830001f0: 00000125 cccccccc 00000127 cccccccc    %.......'.......
    
    
    

                                                     These are my current settings:

    1)FILE:u-boot/include/configs/my_custom_board.h
    
    /* SPI */
    #undef  CONFIG_OMAP3_SPI
    #define CONFIG_TI_SPI_MMAP
    #define CONFIG_SF_DEFAULT_SPEED                166000000                //76800000
    #define CONFIG_SF_DEFAULT_MODE                 SPI_MODE_0 
    #define CONFIG_QSPI_QUAD_SUPPORT 
    
    /* SPI SPL */
    #define CONFIG_SPL_SPI_SUPPORT
    #define CONFIG_SPL_DMA_SUPPORT
    /*#define CONFIG_TI_EDMA3*/
    #define CONFIG_SPL_SPI_LOAD
    #define CONFIG_SPL_SPI_FLASH_SUPPORT
    
    2)FILE:u-boot/arch/arm/dts/dra72-evm-common.dtsi
    
    &qspi {
            status = "okay";
    
          /*spi-max-frequency = <76800000>;*/
            spi-max-frequency = <166000000>;
            m25p80@0 {
                    compatible = "mt25ql02g","m25p80";
                    /*spi-max-frequency = <76800000>;*/
                    spi-max-frequency = <166000000>;
                    reg = <0>;
                    spi-tx-bus-width = <1>;
                    spi-rx-bus-width = <4>;
                    #address-cells = <1>;
                    #size-cells = <1>;
                    
               ...     followed by the partition values
    }
    
    3)FILE:u-boot/arch/arm/dts/dra7-evm.dts
    
    &qspi {
            status = "okay";
    /*      pinctrl-names = "default";
            pinctrl-0 = <&qspi1_pins>; we are not muxing the qspi pins*/
    
            spi-max-frequency = <166000000>;
            m25p80@0 {
                    compatible = "mt25ql02g","spi-flash";
                    spi-max-frequency = <166000000>;
                    reg = <0>;
                    spi-tx-bus-width = <1>;
                    spi-rx-bus-width = <4>;
                    #address-cells = <1>;
                    #size-cells = <1>;
    }
    
    4)FILE:u-boot/drivers/spi/ti_qspi.c ...This is the code segment that I modify to force different modes.
    
           switch (mode) {
    //      default:
            case SPI_RX_QUAD:
                    memval |= QSPI_CMD_READ_QUAD;
                    memval |= QSPI_SETUP0_NUM_D_BYTES_8_BITS;                      
                    memval |= QSPI_SETUP0_READ_QUAD;
                    slave->mode_rx = SPI_RX_QUAD;
                    break;
    //      default:
            case SPI_RX_DUAL:
                    memval |= QSPI_CMD_READ_DUAL;
                    memval |= QSPI_SETUP0_NUM_D_BYTES_8_BITS;
                    memval |= QSPI_SETUP0_READ_DUAL;
                    break;
            default:
                    memval |= QSPI_CMD_READ;
                    memval |= QSPI_SETUP0_NUM_D_BYTES_NO_BITS;      
                    memval |= QSPI_SETUP0_READ_NORMAL;
                    break;
            }
            writel(memval, &priv->base->setup0);
    }
    
    

    Answering one of my own questions,

                                                         When we probe with a value greater than <spi-max-frequency> ,I think by default some very low frequecy is used instead.Because when i forced QUAD_MODE and used,

    #sf probe 0 8000000

    and I was able to read correctly.I even loaded uImage and dtb from spi flash successfully(from mmc's uboot).Any value more that 8MHz resulted in pattern mismatch.

    So I tried changing all dts,dtsi and board.h frequency values to 8MHz.But that did not work and same pattern mismatch,as before,occurred.

    So to read correctly,at the moment,I have to:

    1)set <spi-max-frequency> and CONFIG_SF_DEFAULT_SPEED to a high value,say 166MHz.

    2)use sf probe 0 8000000 (8 MHz or lower values)

                                                                               As  I mentioned before,this trick is useless for me because i have to use SYSBOOT switches to boot from QSPI.And for that both reading and writing should be perfectly working without the need of any runtime modifications.

    UPDATE: When I  lowered the frequecy i accidently changed CONFIG_DRA7xx_FCLK value to 8MHz(76.8MHz) was default.I changed it back to 76.8 MHz and kept 8MHz everywhere else(in dtsi and CONFIG_SF_DEFAULT_SPEED).Now I can read and write at 8MHz(can go upto 8.5MHz) without changing the frequency during runtime.But when I change switch settings for QSPI BOOT (SW  5:0 110110) it doesnt go beyond "image_entry:0x0".

    Thanks for your time and patience.

    Regards,

    Murugan S

  • Hi all,
    I fixed the reading issue.The commands for dual and single read were different for the qspi flash that we were using(eg:command for single read was 0x13 for our spi flash,default value was0x03).I modifed the commands ,in accordance with our spi flash's data sheet ,in the ti_qspi.c file.Now i can read and write successfully at any frequency.

    But Im still facing issue with qspi boot.I will start a new thread for that.
    Regards,
    Murugan S
  • Hi,

    Can you please the QSPI boot in both

    1) QSPI1

    2) QSPI4

    modes?

    regards,

    Venkat

  • Hi Venkat,
    Im able to boot from qspi ,But only under the following conditions:
    1)debug printing is ON.
    2)QSPI Frequency <= 8MHz.

    Sometimes I have to reset the board 5-10 times to successfully boot from qspi.But after atleast one successful boot,I have no issues with further reboot.But to boot successfully for the first time I may have to reset the board several times.Could it be a hardware issue?
    Could you please explain the difference between QSPI_1 and QSPI_4? and how to switch between them?

    Regards,
    Murugan S
  • Hi Venkat,
    I can now boot from QSPI.I lowered the frequency from 8MHz to 6 MHz.Now QSPI boot is working with DEBUG OFF.I have to figure out why we are not able to use higher frequecies.

    Regards,
    Murugan S