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.

Adding support for SPI flash in kernel.

Hi Biser,

I am able to do SPI flash locking in U-boot.

Now when I am booting my kernel at that time I am not able to get any detection of my SPI flash in kernel log.I am using kernel version 3.14.26.

Here my all the device configuration I have did in dts file.

Even I am using SPI1-> CS0 , the same I have mentioned in my dts file.

But no mtd device is enumerating in kernel log.

Please suggest a way.

Rgs,

Santosh

  • If your SPI flash is password protected there is no way for the kernel SPI driver to enumerate it. You must unlock it beforehand.
  • As a second thought, check D0 and D1 directions in your .DTS file. MISO and MOSI may be reversed.
  • Yes, that should be it. Password protection does not disable reading the flash.
  • Hi Biser,

    It's not possible because we are able to enumerate the same device in our other products in that we have used mindspeed processor.

    Thus it's possible.

    Please check.

  • Check my latest posts.
  • Hi biser,

    I had verified that at the initial stage.
    Cs is UAR0 rtsnb pull up output , spi so is mcasp0 fsx as input, spi si mcasp0 axr0 as output and clk as mcasp0 aclkx as output pin .
    Thus there is no problem with pin connections
    Can you tell me kernel configuration parameters.
  • Please post the SPI section of your .DTS file.
  • Hi Biser,

    dtsi file portion of SPI:

    spi0: spi@48030000 {
    compatible = "ti,omap4-mcspi";
    #address-cells = <1>;
    #size-cells = <0>;
    reg = <0x48030000 0x400>;
    interrupts = <65>;
    ti,spi-num-cs = <2>;
    ti,hwmods = "spi0";
    dmas = <&edma 16
    &edma 17
    &edma 18
    &edma 19>;
    dma-names = "tx0", "rx0", "tx1", "rx1";
    status = "disabled";
    };

    spi1: spi@481a0000 {
    compatible = "ti,omap4-mcspi";
    #address-cells = <1>;
    #size-cells = <0>;
    reg = <0x481a0000 0x400>;
    interrupts = <125>;
    ti,spi-num-cs = <2>;
    ti,hwmods = "spi1";
    dmas = <&edma 42
    &edma 43
    &edma 44
    &edma 45>;
    dma-names = "tx0", "rx0", "tx1", "rx1";
    status = "disabled";
    };

    DTS file contain:

    &spi1 {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&spi1_pins_default>;
    pinctrl-1 = <&spi1_pins_sleep>;
    /*MATRIX: SPI is working on a fixed clock frequency of 48MHZ.
    Thus it is not mentioned in a dtsi or dts files. */
    status = "okay";

    };

    spi1_pins_default: spi1_pins_default {
    pinctrl-single,pins = < /* MATRIX: this pins used for SPI FLash */
    0x16c (PIN_OUTPUT_PULLUP | MUX_MODE5) /* MATRIX: spi1_cs0 */
    0x194 (PIN_INPUT| MUX_MODE3) /* MATRIX: spi1_so (slave output) */
    0x198 (PIN_OUTPUT | MUX_MODE3) /* MATRIX: spi1_si (slave input)*/
    0x190 (PIN_OUTPUT | MUX_MODE3) /* MATRIX: spi1_clk */
    >;
    };

    spi1_pins_sleep: spi1_pins_sleep {
    pinctrl-single,pins = < /* MATRIX: this pins used for SPI FLash */
    0x16c (PIN_OUTPUT_PULLUP | MUX_MODE7) /* MATRIX: spi1_cs0 */
    0x194 (PIN_OUTPUT | MUX_MODE7) /* MATRIX: spi1_si */
    0x198 (PIN_INPUT | MUX_MODE7) /* MATRIX: spi1_s0 */
    0x190 (PIN_OUTPUT | MUX_MODE7) /* MATRIX: spi1_clk */
    >;
    };

    Please check .

    Rgs,

    Santosh Rai.

  • Hi,

    I tested this on my BBB, running kernel 3.14 (SDK1.00.00.03). I used the following spi settings:

              spi1_pins: spi1_pins {

                pinctrl-single,pins = <

                      0x190 (PIN_INPUT_PULLUP | MUX_MODE3)  /*MCASP0_ACLKX.spi1_clk*/

                      0x194 (PIN_INPUT_PULLUP | MUX_MODE3)  /*MCASP0_FSX.spi1_d0*/

                      0x198 (PIN_OUTPUT_PULLUP | MUX_MODE3)  /*MCASP0_AXR0.spi1_d1*/

                      0x19c (PIN_OUTPUT_PULLUP | MUX_MODE3)  /*MCASP0_AHCLKR.spi1_cs0*/

                >;

          };

          

    &spi1 {
             pinctrl-names = "default";
             pinctrl-0 = <&spi1_pins>;
             status = "okay";
             spidev@1 {
                       spi-max-frequency = <24000000>;
                       reg = <0>;
                       compatible = "linux,spidev";
            };
    };

    And managed to see the SPI clk & data pins toggling on the scope, after I executed echo "A5A5A5" > /dev/spidev1.0. 

    Best Regards, 
    Yordan

  • HI YK,

    I want tto use an m25p80 driver for my flash.

    Because using this driver I can unlock and lock my flash.

    Here using compatible string it will use other drivers.

    Rgs,

    Santosh Rai

  • HI All,

    Here what yordan did SPI_CLK as input pin but in my system ARM McSPI is working as master thus I need to make that pin as output pin.
    In my schematic I have used pulled-up CS line only.rest of the pins either input or output.

    Please HELP not able to resolve this.

    Rgs,
    Santosh
  • Hi All,

    I am still suffering from the issue of SPI flash read/write in kernel.


    Rgs,
    Santosh
  • RAI SANTOSH said:
    Here what yordan did SPI_CLK as input pin but in my system ARM McSPI is working as master thus I need to make that pin as output pin. 

    Read Note 1 under Table 24-4 in the AM335x TRM Rev. M.

  • HI Biser ,

    I have did that change also made my clk pin as input enable.

    But at that time also its reading FF from the flash.

    Rgs,

    Santosh Rai

  • Hi All,

    I am having as issue while testing my SPI interface.

    One test process I am following is

    Use the MTD interface provided for SPI flash on the EVM to validate the SPI driver interface.

    The below step copies 8KiB from /dev/mtd2 partition (u-boot env) to /dev/mtd4 partition and reads

    the 8KiB image from /dev/mtd4 to a file and checks the md5sum. The md5sum of test.img and test1.img should be same.

    cd /tmp

    dd if=/dev/mtd2 of=test.img bs=8k count=1

    md5sum test.img

    flash_eraseall /dev/mtd4

    cp test.img /dev/mtd4

    dd if=/dev/mtd4 of=test1.img bs=8k count=1

    md5sum test1.img

    But while testing found that this test process is not Ok,

    The reason is as logs are,

     # ls -l /dev/mtd0
    crw-r--r--    1 root     root       90,   0 Jan 21 05:08 [1;35m/dev/mtd0[0m
    ~ #
    ~ # cd /tmp
    /tmp #
    /tmp # dd if=/dev/mtd6 of=test.img bs=8k count=1

    1+0 records in
    1+0 records out
    8192 bytes (8.0KB) copied, 0.001909 seconds, 4.1MB/s
    /tmp #
    /tmp # ls -l /dev/mtd0

    crw-r--r--    1 root     root       90,   0 Jan 21 05:08 [1;35m/dev/mtd0[0m
    /tmp #
    /tmp # md5sum test.img

    f88e19038a28306e716d0346d6112546  test.img
    /tmp #
    /tmp # flash_eraseall /dev/mtd0

    flash_eraseall has been replaced by `flash_erase <mtddev> 0 0`; please use it

    Erasing 64 Kibyte @ 0 --  0 % complete
    Erasing 64 Kibyte @ 10000 --  0 % complete
    Erasing 64 Kibyte @ 20000 --  0 % complete
    Erasing 64 Kibyte @ 30000 --  1 % complete
    Erasing 64 Kibyte @ 40000 --  1 % complete
    Erasing 64 Kibyte @ 50000 --  1 % complete
    Erasing 64 Kibyte @ 60000 --  2 % complete
    Erasing 64 Kibyte @ 70000 --  2 % complete
    Erasing 64 Kibyte @ 80000 --  3 % complete
    Erasing 64 Kibyte @ 90000 --  3 % complete
    Erasing 64 Kibyte @ a0000 --  3 % complete
    Erasing 64 Kibyte @ b0000 --  4 % complete
    Erasing 64 Kibyte @ c0000 --  4 % complete
    Erasing 64 Kibyte @ d0000 --  5 % complete
    Erasing 64 Kibyte @ e0000 --  5 % complete
    Erasing 64 Kibyte @ f0000 --  5 % complete
    Erasing 64 Kibyte @ 100000 --  6 % complete
    Erasing 64 Kibyte @ 110000 --  6 % complete
    Erasing 64 Kibyte @ 120000 --  7 % complete
    Erasing 64 Kibyte @ 130000 --  7 % complete
    Erasing 64 Kibyte @ 140000 --  7 % complete
    Erasing 64 Kibyte @ 150000 --  8 % complete
    Erasing 64 Kibyte @ 160000 --  8 % complete
    Erasing 64 Kibyte @ 170000 --  8 % complete
    Erasing 64 Kibyte @ 180000 --  9 % complete
    Erasing 64 Kibyte @ 190000 --  9 % complete
    Erasing 64 Kibyte @ 1a0000 -- 10 % complete
    Erasing 64 Kibyte @ 1b0000 -- 10 % complete
    Erasing 64 Kibyte @ 1c0000 -- 10 % complete
    Erasing 64 Kibyte @ 1d0000 -- 11 % complete
    Erasing 64 Kibyte @ 1e0000 -- 11 % complete
    Erasing 64 Kibyte @ 1f0000 -- 12 % complete
    Erasing 64 Kibyte @ 200000 -- 12 % complete
    Erasing 64 Kibyte @ 210000 -- 12 % complete
    Erasing 64 Kibyte @ 220000 -- 13 % complete
    Erasing 64 Kibyte @ 230000 -- 13 % complete
    Erasing 64 Kibyte @ 240000 -- 14 % complete
    Erasing 64 Kibyte @ 250000 -- 14 % complete
    Erasing 64 Kibyte @ 260000 -- 14 % complete
    Erasing 64 Kibyte @ 270000 -- 15 % complete
    Erasing 64 Kibyte @ 280000 -- 15 % complete
    Erasing 64 Kibyte @ 290000 -- 16 % complete
    Erasing 64 Kibyte @ 2a0000 -- 16 % complete
    Erasing 64 Kibyte @ 2b0000 -- 16 % complete
    Erasing 64 Kibyte @ 2c0000 -- 17 % complete
    Erasing 64 Kibyte @ 2d0000 -- 17 % complete
    Erasing 64 Kibyte @ 2e0000 -- 17 % complete
    Erasing 64 Kibyte @ 2f0000 -- 18 % complete
    Erasing 64 Kibyte @ 300000 -- 18 % complete
    Erasing 64 Kibyte @ 310000 -- 19 % complete
    Erasing 64 Kibyte @ 320000 -- 19 % complete
    Erasing 64 Kibyte @ 330000 -- 19 % complete
    Erasing 64 Kibyte @ 340000 -- 20 % complete
    Erasing 64 Kibyte @ 350000 -- 20 % complete
    Erasing 64 Kibyte @ 360000 -- 21 % complete
    Erasing 64 Kibyte @ 370000 -- 21 % complete
    Erasing 64 Kibyte @ 380000 -- 21 % complete
    Erasing 64 Kibyte @ 390000 -- 22 % complete
    Erasing 64 Kibyte @ 3a0000 -- 22 % complete
    Erasing 64 Kibyte @ 3b0000 -- 23 % complete
    Erasing 64 Kibyte @ 3c0000 -- 23 % complete
    Erasing 64 Kibyte @ 3d0000 -- 23 % complete
    Erasing 64 Kibyte @ 3e0000 -- 24 % complete
    Erasing 64 Kibyte @ 3f0000 -- 24 % complete
    Erasing 64 Kibyte @ 400000 -- 25 % complete
    Erasing 64 Kibyte @ 410000 -- 25 % complete
    Erasing 64 Kibyte @ 420000 -- 25 % complete
    Erasing 64 Kibyte @ 430000 -- 26 % complete
    Erasing 64 Kibyte @ 440000 -- 26 % complete
    Erasing 64 Kibyte @ 450000 -- 26 % complete
    Erasing 64 Kibyte @ 460000 -- 27 % complete
    Erasing 64 Kibyte @ 470000 -- 27 % complete
    Erasing 64 Kibyte @ 480000 -- 28 % complete
    Erasing 64 Kibyte @ 490000 -- 28 % complete
    Erasing 64 Kibyte @ 4a0000 -- 28 % complete
    Erasing 64 Kibyte @ 4b0000 -- 29 % complete
    Erasing 64 Kibyte @ 4c0000 -- 29 % complete
    Erasing 64 Kibyte @ 4d0000 -- 30 % complete
    Erasing 64 Kibyte @ 4e0000 -- 30 % complete
    Erasing 64 Kibyte @ 4f0000 -- 30 % complete
    Erasing 64 Kibyte @ 500000 -- 31 % complete
    Erasing 64 Kibyte @ 510000 -- 31 % complete
    Erasing 64 Kibyte @ 520000 -- 32 % complete
    Erasing 64 Kibyte @ 530000 -- 32 % complete
    Erasing 64 Kibyte @ 540000 -- 32 % complete
    Erasing 64 Kibyte @ 550000 -- 33 % complete
    Erasing 64 Kibyte @ 560000 -- 33 % complete
    Erasing 64 Kibyte @ 570000 -- 33 % complete
    Erasing 64 Kibyte @ 580000 -- 34 % complete
    Erasing 64 Kibyte @ 590000 -- 34 % complete
    Erasing 64 Kibyte @ 5a0000 -- 35 % complete
    Erasing 64 Kibyte @ 5b0000 -- 35 % complete
    Erasing 64 Kibyte @ 5c0000 -- 35 % complete
    Erasing 64 Kibyte @ 5d0000 -- 36 % complete
    Erasing 64 Kibyte @ 5e0000 -- 36 % complete
    Erasing 64 Kibyte @ 5f0000 -- 37 % complete
    Erasing 64 Kibyte @ 600000 -- 37 % complete
    Erasing 64 Kibyte @ 610000 -- 37 % complete
    Erasing 64 Kibyte @ 620000 -- 38 % complete
    Erasing 64 Kibyte @ 630000 -- 38 % complete
    Erasing 64 Kibyte @ 640000 -- 39 % complete
    Erasing 64 Kibyte @ 650000 -- 39 % complete
    Erasing 64 Kibyte @ 660000 -- 39 % complete
    Erasing 64 Kibyte @ 670000 -- 40 % complete
    Erasing 64 Kibyte @ 680000 -- 40 % complete
    Erasing 64 Kibyte @ 690000 -- 41 % complete
    Erasing 64 Kibyte @ 6a0000 -- 41 % complete
    Erasing 64 Kibyte @ 6b0000 -- 41 % complete
    Erasing 64 Kibyte @ 6c0000 -- 42 % complete
    Erasing 64 Kibyte @ 6d0000 -- 42 % complete
    Erasing 64 Kibyte @ 6e0000 -- 42 % complete
    Erasing 64 Kibyte @ 6f0000 -- 43 % complete
    Erasing 64 Kibyte @ 700000 -- 43 % complete
    Erasing 64 Kibyte @ 710000 -- 44 % complete
    Erasing 64 Kibyte @ 720000 -- 44 % complete
    Erasing 64 Kibyte @ 730000 -- 44 % complete
    Erasing 64 Kibyte @ 740000 -- 45 % complete
    Erasing 64 Kibyte @ 750000 -- 45 % complete
    Erasing 64 Kibyte @ 760000 -- 46 % complete
    Erasing 64 Kibyte @ 770000 -- 46 % complete
    Erasing 64 Kibyte @ 780000 -- 46 % complete
    Erasing 64 Kibyte @ 790000 -- 47 % complete
    Erasing 64 Kibyte @ 7a0000 -- 47 % complete
    Erasing 64 Kibyte @ 7b0000 -- 48 % complete
    Erasing 64 Kibyte @ 7c0000 -- 48 % complete
    Erasing 64 Kibyte @ 7d0000 -- 48 % complete
    Erasing 64 Kibyte @ 7e0000 -- 49 % complete
    Erasing 64 Kibyte @ 7f0000 -- 49 % complete
    Erasing 64 Kibyte @ 800000 -- 50 % complete
    Erasing 64 Kibyte @ 810000 -- 50 % complete
    Erasing 64 Kibyte @ 820000 -- 50 % complete
    Erasing 64 Kibyte @ 830000 -- 51 % complete
    Erasing 64 Kibyte @ 840000 -- 51 % complete
    Erasing 64 Kibyte @ 850000 -- 51 % complete
    Erasing 64 Kibyte @ 860000 -- 52 % complete
    Erasing 64 Kibyte @ 870000 -- 52 % complete
    Erasing 64 Kibyte @ 880000 -- 53 % complete
    Erasing 64 Kibyte @ 890000 -- 53 % complete
    Erasing 64 Kibyte @ 8a0000 -- 53 % complete
    Erasing 64 Kibyte @ 8b0000 -- 54 % complete
    Erasing 64 Kibyte @ 8c0000 -- 54 % complete
    Erasing 64 Kibyte @ 8d0000 -- 55 % complete
    Erasing 64 Kibyte @ 8e0000 -- 55 % complete
    Erasing 64 Kibyte @ 8f0000 -- 55 % complete
    Erasing 64 Kibyte @ 900000 -- 56 % complete
    Erasing 64 Kibyte @ 910000 -- 56 % complete
    Erasing 64 Kibyte @ 920000 -- 57 % complete
    Erasing 64 Kibyte @ 930000 -- 57 % complete
    Erasing 64 Kibyte @ 940000 -- 57 % complete
    Erasing 64 Kibyte @ 950000 -- 58 % complete
    Erasing 64 Kibyte @ 960000 -- 58 % complete
    Erasing 64 Kibyte @ 970000 -- 58 % complete
    Erasing 64 Kibyte @ 980000 -- 59 % complete
    Erasing 64 Kibyte @ 990000 -- 59 % complete
    Erasing 64 Kibyte @ 9a0000 -- 60 % complete
    Erasing 64 Kibyte @ 9b0000 -- 60 % complete
    Erasing 64 Kibyte @ 9c0000 -- 60 % complete
    Erasing 64 Kibyte @ 9d0000 -- 61 % complete
    Erasing 64 Kibyte @ 9e0000 -- 61 % complete
    Erasing 64 Kibyte @ 9f0000 -- 62 % complete
    Erasing 64 Kibyte @ a00000 -- 62 % complete
    Erasing 64 Kibyte @ a10000 -- 62 % complete
    Erasing 64 Kibyte @ a20000 -- 63 % complete
    Erasing 64 Kibyte @ a30000 -- 63 % complete
    Erasing 64 Kibyte @ a40000 -- 64 % complete
    Erasing 64 Kibyte @ a50000 -- 64 % complete
    Erasing 64 Kibyte @ a60000 -- 64 % complete
    Erasing 64 Kibyte @ a70000 -- 65 % complete
    Erasing 64 Kibyte @ a80000 -- 65 % complete
    Erasing 64 Kibyte @ a90000 -- 66 % complete
    Erasing 64 Kibyte @ aa0000 -- 66 % complete
    Erasing 64 Kibyte @ ab0000 -- 66 % complete
    Erasing 64 Kibyte @ ac0000 -- 67 % complete
    Erasing 64 Kibyte @ ad0000 -- 67 % complete
    Erasing 64 Kibyte @ ae0000 -- 67 % complete
    Erasing 64 Kibyte @ af0000 -- 68 % complete
    Erasing 64 Kibyte @ b00000 -- 68 % complete
    Erasing 64 Kibyte @ b10000 -- 69 % complete
    Erasing 64 Kibyte @ b20000 -- 69 % complete
    Erasing 64 Kibyte @ b30000 -- 69 % complete
    Erasing 64 Kibyte @ b40000 -- 70 % complete
    Erasing 64 Kibyte @ b50000 -- 70 % complete
    Erasing 64 Kibyte @ b60000 -- 71 % complete
    Erasing 64 Kibyte @ b70000 -- 71 % complete
    Erasing 64 Kibyte @ b80000 -- 71 % complete
    Erasing 64 Kibyte @ b90000 -- 72 % complete
    Erasing 64 Kibyte @ ba0000 -- 72 % complete
    Erasing 64 Kibyte @ bb0000 -- 73 % complete
    Erasing 64 Kibyte @ bc0000 -- 73 % complete
    Erasing 64 Kibyte @ bd0000 -- 73 % complete
    Erasing 64 Kibyte @ be0000 -- 74 % complete
    Erasing 64 Kibyte @ bf0000 -- 74 % complete
    Erasing 64 Kibyte @ c00000 -- 75 % complete
    Erasing 64 Kibyte @ c10000 -- 75 % complete
    Erasing 64 Kibyte @ c20000 -- 75 % complete
    Erasing 64 Kibyte @ c30000 -- 76 % complete
    Erasing 64 Kibyte @ c40000 -- 76 % complete
    Erasing 64 Kibyte @ c50000 -- 76 % complete
    Erasing 64 Kibyte @ c60000 -- 77 % complete
    Erasing 64 Kibyte @ c70000 -- 77 % complete
    Erasing 64 Kibyte @ c80000 -- 78 % complete
    Erasing 64 Kibyte @ c90000 -- 78 % complete
    Erasing 64 Kibyte @ ca0000 -- 78 % complete
    Erasing 64 Kibyte @ cb0000 -- 79 % complete
    Erasing 64 Kibyte @ cc0000 -- 79 % complete
    Erasing 64 Kibyte @ cd0000 -- 80 % complete
    Erasing 64 Kibyte @ ce0000 -- 80 % complete
    Erasing 64 Kibyte @ cf0000 -- 80 % complete
    Erasing 64 Kibyte @ d00000 -- 81 % complete
    Erasing 64 Kibyte @ d10000 -- 81 % complete
    Erasing 64 Kibyte @ d20000 -- 82 % complete
    Erasing 64 Kibyte @ d30000 -- 82 % complete
    Erasing 64 Kibyte @ d40000 -- 82 % complete
    Erasing 64 Kibyte @ d50000 -- 83 % complete
    Erasing 64 Kibyte @ d60000 -- 83 % complete
    Erasing 64 Kibyte @ d70000 -- 83 % complete
    Erasing 64 Kibyte @ d80000 -- 84 % complete
    Erasing 64 Kibyte @ d90000 -- 84 % complete
    Erasing 64 Kibyte @ da0000 -- 85 % complete
    Erasing 64 Kibyte @ db0000 -- 85 % complete
    Erasing 64 Kibyte @ dc0000 -- 85 % complete
    Erasing 64 Kibyte @ dd0000 -- 86 % complete
    Erasing 64 Kibyte @ de0000 -- 86 % complete
    Erasing 64 Kibyte @ df0000 -- 87 % complete
    Erasing 64 Kibyte @ e00000 -- 87 % complete
    Erasing 64 Kibyte @ e10000 -- 87 % complete
    Erasing 64 Kibyte @ e20000 -- 88 % complete
    Erasing 64 Kibyte @ e30000 -- 88 % complete
    Erasing 64 Kibyte @ e40000 -- 89 % complete
    Erasing 64 Kibyte @ e50000 -- 89 % complete
    Erasing 64 Kibyte @ e60000 -- 89 % complete
    Erasing 64 Kibyte @ e70000 -- 90 % complete
    Erasing 64 Kibyte @ e80000 -- 90 % complete
    Erasing 64 Kibyte @ e90000 -- 91 % complete
    Erasing 64 Kibyte @ ea0000 -- 91 % complete
    Erasing 64 Kibyte @ eb0000 -- 91 % complete
    Erasing 64 Kibyte @ ec0000 -- 92 % complete
    Erasing 64 Kibyte @ ed0000 -- 92 % complete
    Erasing 64 Kibyte @ ee0000 -- 92 % complete
    Erasing 64 Kibyte @ ef0000 -- 93 % complete
    Erasing 64 Kibyte @ f00000 -- 93 % complete
    Erasing 64 Kibyte @ f10000 -- 94 % complete
    Erasing 64 Kibyte @ f20000 -- 94 % complete
    Erasing 64 Kibyte @ f30000 -- 94 % complete
    Erasing 64 Kibyte @ f40000 -- 95 % complete
    Erasing 64 Kibyte @ f50000 -- 95 % complete
    Erasing 64 Kibyte @ f60000 -- 96 % complete
    Erasing 64 Kibyte @ f70000 -- 96 % complete
    Erasing 64 Kibyte @ f80000 -- 96 % complete
    Erasing 64 Kibyte @ f90000 -- 97 % complete
    Erasing 64 Kibyte @ fa0000 -- 97 % complete
    Erasing 64 Kibyte @ fb0000 -- 98 % complete
    Erasing 64 Kibyte @ fc0000 -- 98 % complete
    Erasing 64 Kibyte @ fd0000 -- 98 % complete
    Erasing 64 Kibyte @ fe0000 -- 99 % complete
    Erasing 64 Kibyte @ ff0000 -- 99 % complete
    Erasing 64 Kibyte @ ff0000 -- 100 % complete
    /tmp #
    /tmp # ls -l /dev/mtd0

    crw-r--r--    1 root     root       90,   0 Jan 21 05:08 [1;35m/dev/mtd0[0m
    /tmp #
    /tmp # cp test.img /dev/mtd0

    /tmp #
    /tmp # ls -l /dev/mtd0

    -rw-r--r--    1 root     root          8192 Jan 21 05:14 [0;0m/dev/mtd0[0m
    /tmp #
    /tmp #

    ////////Here clearly while issuing cp command it is removing the driver file and generating a new regular kind of file.

    Thus then after data I will read from the mtd0 file will actully not use my SPI interface.

    Please check and help!

    Rgs,

    Santosh

  • Hi All,

    My dtsi file configuration:


    spi1: spi@481a0000 {
    compatible = "ti,omap4-mcspi";
    #address-cells = <1>;
    #size-cells = <0>;
    reg = <0x481a0000 0x400>;
    interrupts = <125>;
    ti,spi-num-cs = <1>;
    ti,hwmods = "spi1";
    dmas = <&edma 42
    &edma 43
    &edma 44
    &edma 45>;
    dma-names = "tx0", "rx0", "tx1", "rx1";
    status = "disabled";
    };


    Dts file configguration:

    &spi1 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&spi1_pins_default>;
    /*MATRIX: SPI is working on a fixed clock frequency of 48MHZ.
    Thus it is not mentioned in a dtsi or dts files. */
    spidev@0 {
    compatible = "m25p80";
    reg = <0>;
    spi-max-frequency = <48000000>;
    };
    };

    spi1_pins_default: spi1_pins_default {
    pinctrl-single,pins = < /* MATRIX: this pins used for SPI FLash */
    0x16c (0x15) /* MATRIX: spi1_cs0 */
    0x194 (0x23) /* MATRIX: spi1_so (slave output) */
    0x198 (0x03) /* MATRIX: spi1_si (slave input)*/
    0x190 (0x23) /* MATRIX: spi1_clk */
    >;
    };


    Is there any configguration issue is present in my dts file?
    Please HELP.

    Rgs,
    Santosh Rai
  • Hi,

    By default m25p80 is built as loadable module in TISDK kernel 3.14 => CONFIG_MTD_M25P80=m. Have you tried changing this to CONFIG_MTD_M25P80=y? Or if not, have you insmoded the m25p80.ko driver?

    Have you tried adding the spi-nor dts node? Should look something like:

    &spi1 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&spi1_pins_default>;
    spi-flash@0 {
    compatible = "m25p80";
    reg = <0>;
    spi-max-frequency = <48000000>;
    #address-cells = <1>;
    #size-cells = <1>;
    };
    };

    Best Regards,
    Yordan
  • Hi yk,

    I had made driver as statically compiled with the kernel.

    And then after changed DTS file as u suggested . but still suffering an issue.

    Rgs,

    Santosh

  • Hi,
    Im able to access spi flash.. this is my dts entry

    &spi0 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi0_pins>;
    status = "okay";

    flash: m25p80@0 {
    #address-cells = <1>;
    #size-cells = <1>;
    compatible = "spansion,m25p80";
    spi-max-frequency = <48000000>;
    reg = <0>;

    partition@0 {
    label = "NOR.env1";
    reg = <0x0A0000 0x010000>;
    };

    partition@1 {
    label = "NOR.env2";
    reg = <0x0B0000 0x010000>;
    };

    };
    };

    and I use flashcp from user space to write an image.

  • Hi,

    Did you verify that your spi interface is working properly (probe the pins with a scope)?

    What is the vendor of the spi-flash chip? Can you send link to its datasheet? Is it possible to try with another chip?

    Best Regards,
    Yordan
  • HI Sooraj,

    Can you please share me your pin configuration.

    As well as can you share how you are using flashcp in your user space.

    Which SPI flash you are using?

    Rgs,

    Santosh Rai

  • Hi YK,


    Device which we are using is spansion (sfl128) SPI nor flash.
    No other SPI flash is present with me to test .

    Rgs,
    Santosh Rai
  • Hi YK,

    Even I have checked on scope for CS , CLK and SDO pins .
    CS and CLK are working fine is seems because when I am using SPI interface at that time CS and CLK deflection I can see but cannot find any action on SDO pin.

    Rgs,
    Santosh.
  • hi santhosh,

    spansion s25fl164k is my spi nor flash..

    pin configuration

    spi0_pins: spi0_pins_default {
    pinctrl-single,pins = <
    0x150 ( PIN_INPUT | MUX_MODE0 ) /* (A18) spi0_sclk.spi0_sclk */
    0x154 ( PIN_INPUT | MUX_MODE0 ) /* (B18) spi0_d0.spi0_d0 */
    0x158 ( PIN_INPUT | MUX_MODE0 ) /* (B17) spi0_d1.spi0_d1 */
    0x15c ( PIN_OUTPUT | MUX_MODE0 ) /* (A17) spi0_cs0.spi0_cs0 */
    >;
    };

    flashcp example

    flashcp MLO.byteswap /dev/mtd0
  • hi,

    Check whether your flash is listed in
      static const struct spi_device_id m25p_ids
    in file   drivers/mtd/devices/m25p80.c..

    If not you will have to add