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/AM3352: m25p80 flash chip not seen in kernel but found in u-boot

Part Number: AM3352

Tool/software: Linux

Hi

I am working with a design that's based on the BeagleBoneBlack and using the latest SDK & tools for the am3352?

Can anyone advise me how I should enable support for an m25p80 SPI flash chip in my kernel?

I have had a look through previously posted questions and followed what examples I have been able to find, but I am not having much luck.

I can access the chip from u-boot and have used it to read my kernel and DTB.

I have defined the flash in the DTS as

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

    spi-flash@0 {
        compatible = "micron,n25q256a", "m25p80";
        spi-max-frequency = <48000000>;
        reg = <0>;
                  #address-cells = <1>;
                   #size-cells = <1>;
                   partition@0 {
                      label = "SPL";
                      reg = <0x00000000 0x00020000>;
                   };
                   partition@20000 {
                      label = "u-boot";
                      reg = <0x00020000 0x00066000>;
                   };
                   partition@86000 {
                      label = "dtb";
                      reg = <0x00086000 0x00010000>;
                   };
                   partition@96000 {
                      label = "kernel";
                      reg = <0x00960000 0x0050a000>;
                   };
                   partition@5a0000 {
                      label = "-";
                      reg = <0x005a0000 0x01a60000>;
                   };
     };
};



Within my .config I can see that I have

#
# Self-contained MTD device drivers
#
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_DATAFLASH is not set
CONFIG_MTD_M25P80=y
# CONFIG_MTD_SST25L is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_MTDRAM is not set
CONFIG_MTD_BLOCK2MTD=y

#
# LPDDR & LPDDR2 PCM memory drivers
#
# CONFIG_MTD_LPDDR is not set
# CONFIG_MTD_LPDDR2_NVM is not set
CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_MTD_UBI_BLOCK is not set
CONFIG_DTC=y

Once the kernel is running however there are no /dev/mtd* devices.
There is nothing in /proc/mtd nor sys/class/mtd

Thanks for any suggestions for how I might big deeper

Kind regards,
Richard

  • Hi Richard,

    Can you try adding:
    spi-flash@0 {
    compatible = "micron,n25q256a", "m25p80";
    spi-max-frequency = <48000000>;
    + status = "okay";
    reg = <0>;
    #address-cells = <1>;

    Best Regards,
    Yordan
  • Thanks for the suggestion 

    - it does not seem to have made any difference though: still nothing in either /dev/ /sys/class/mtd or /proc/mtd

    dumping the part of the tree I can see the new property

    395-        spi@48030000 {
    1396-            compatible = "ti,omap4-mcspi";
    1397-            #address-cells = <0x00000001>;
    1398-            #size-cells = <0x00000000>;
    1399-            reg = <0x48030000 0x000001c1>;
    1400-            interrupts = <0x00000041>;
    1401-            ti,spi-num-cs = <0x00000002>;
    1402:            ti,hwmods = "spi0";
    1403-            dmas = <0x0000002d 0x00000011 0x00000000 0x00000003 0x72783000 0x00000005 0x00000003 0x756c7400 0x00000043 0x68403000 0x6d696372 0x6d323570>;
    1404-            dma-names = "tx0", "rx0", "tx1", "rx1";
    1405-            status = "okay";
    1406-            pinctrl-names = "default";
    1407-            pinctrl-0 = <0x00000043>;
    1408-            spi-flash@0 {
    1409-                compatible = "micron,n25q256a", "m25p80";
    1410-                spi-max-frequency = <0x02dc6c00>;
    1411-                status = "okay";
    1412-                reg = <0x00000000>;
    1413-                #address-cells = <0x00000001>;
    1414-                #size-cells = <0x00000001>;
    

    Looking through the code I notice mention of "m25p80" as a compatible and use of "jedec": I'll try and dig around here.

    I also notice that modprobe does not find dependencies for "m25p80"

    Thanks again

    Richard

  • Hi

    it appears the required binding these days looks like:

    &spi0 {
        status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&spi0_pins>;
    
    	spi-flash@0 {
    		compatible = "micron,n25q256a","jedec,spi-nor";  //<---- n.b. this
    		spi-max-frequency = <48000000>;
    		status = "okay";

    This can be found in the bindings documentation of the source code; (these docs will likely be up to date).

    all the best

    - Richard

  • Thanks for updating the thread.

    Best Regards,
    Yordan