SPI - F-RAM usage on Linux

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI - F-RAM usage on Linux

Jump to solution
1,164 Views
steffendoster
Contributor IV

Hi everyone,

I'm trying to use a Fujitsu F-RAM on a custom i.MX6 Linux platform.

The F-RAM: https://www.fujitsu.com/uk/Images/MB85RS1MT.pdf should be available with Linux' <spi-nor> driver.

My devicetree configuration for this F-RAM looks like:

ecspi2: ecspi@0200c000 {
    #address-cells = <1>;
    #size-cells = <0>;
    compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
    reg = <0x0200c000 0x4000>;
    interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clks IMX6QDL_CLK_ECSPI2>,
    <&clks IMX6QDL_CLK_ECSPI2>;
    clock-names = "ipg", "per";
    fsl,spi-num-chipselects = <1>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_ecspi2>;
    dmas = <&sdma 5 7 1>, <&sdma 6 7 2>;
    dma-names = "rx", "tx";
    status = "okay";

/*    spidev: spidev@0 {
 *        compatible = "linux,spidev";
 *        reg = <0>;

 *        spi-max-frequency = <25000000>;
 *        status = "okay";

 *    };
 */
    fram: mb85rs4mt@0 {
        compatible = "jedec,spi-nor";
        reg = <0>;
        spi-max-frequency = <40000000>;
        #address-cells = <1>;
        #size-cells = <1>;
        m25p,fast-read;
        status = "okay";

        partition@p1 {
        label = "spi-fram";
        reg = <0x0 0x20000>;
        };
    };

};

I used spidev to debug the device.

My problem is: this configuration does not recognize the F-RAM as it should. The F-RAM has the JEDEC RDID-functionality which gives you the Device-ID by sending RDID-command 0x9f.

Linux attempts to read this register but only gets back 0xffffff.

The Error is:

m25p80 spi1.0: unrecognized JEDEC id bytes: ff, ff, ff
m25p80: probe of spi1.0 failed with error -2

I tried to read the Device-ID with <spidev> and got a valid answer (0x047f27).

The difference between both SPI-communications is the timing!

When I use spidev I send the RDID and immediately (in the same chip-select) some dummy bytes to read the informations sent by the F-RAM.

When Linux tries to get the Device-ID it sends the command (0x9f), sets the Chip-Select back to high and after a while it tries to get the data by setting Chip-Select to low and clocking the device. But then the answer from the device is 0xffffff.

I tried this with other devices mentioned in <spi-nor.c> (for example a m25p20) and they all have the same behavior.

How can I get Linux to do the RDID in a single Chip-Select???

Labels (2)
0 Kudos
1 Solution
787 Views
steffendoster
Contributor IV

IT WORKS!!!!

Why didn't I find the answer earlier?
Problem with jedec,spi-nor on IMX8M Mini EVK 

The problem is the behaviour of the ss0-signal (used as chip-select).

I switched to a simple GPIO on IO-Mux and added the cs-gpio-entry to the spi-port:

cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;

And now it works! The FRAM is detected correctly.

By the way: I added the mb85rs4mt to <spi-nor.c> because the smaller mb85rs1mt is already defined there.

Just changed size and ID to fit the additional Device.

Greetings

Steffen Doster

View solution in original post

0 Kudos
2 Replies
787 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Steffen

one can try to debug it using description in sect.3.8 SPI NOR Flash Memory

Technology Device (MTD) attached Linux Manual, not using spidev.

 fram mb85rs4mt seems is not supported in linux/drivers/mtd/spi-nor/spi-nor.c,

not listed in flash_info spi_nor_ids[] structure:

spi-nor.c\spi-nor\mtd\drivers - linux-imx - i.MX Linux kernel 

Specific timings can be added in the same manner as for "m25p80.c" part which

is supported in BSP.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
788 Views
steffendoster
Contributor IV

IT WORKS!!!!

Why didn't I find the answer earlier?
Problem with jedec,spi-nor on IMX8M Mini EVK 

The problem is the behaviour of the ss0-signal (used as chip-select).

I switched to a simple GPIO on IO-Mux and added the cs-gpio-entry to the spi-port:

cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;

And now it works! The FRAM is detected correctly.

By the way: I added the mb85rs4mt to <spi-nor.c> because the smaller mb85rs1mt is already defined there.

Just changed size and ID to fit the additional Device.

Greetings

Steffen Doster

View solution in original post

0 Kudos