Jump to content

spi-nand kernel module is missing (please add kernel config option MTD_SPI_NAND=m)


Go to solution Solved by Igor,

Recommended Posts

Posted

A lot of spi-nand flashes is supported linux kernel. It will be very helpful to add a possibility to read/write/erase such flashes using standard linux support. Unfortunately spi-nand support is not enabled in armbian linux kernel.
 

example: recovery bootloader on the router board
 

  • Orange Pi 4 configuration

    1. Recompile orange pi 4 linux kernel to enable spi-nand driver (linux-5.10 or above is required). Make sure spinand, mtd and nandcore are built as modules
    2. sudo armbian-config, go to “System → DTC” and replace spidev with spinand
    3. install the following packages: mtd-utils
    4. reboot board to apply changes
     
  • Connect spi-nand chip to orange pi4 board

    Testpoint Meaning Where to connect
    3.3V 3.3V power supply pin 17 of orange pi 4 connector
    DI SPI Data In pin 19 of orange pi 4 connector
    DO SPI Data Out pin 21 of orange pi 4 connector
    CLK SPI Clock pin 23 of orange pi 4 connector
    GND Ground pin 25 of orange pi 4connector
    CS# SPI Chip Select pin 24 of orange pi 4 connector
    WP# Write Protect short with HOLD# and 3.3V testpoints
    HOLD# Hold short with WP# and 3.3V testpoints
     
  • restart spinand and mtd modules

    rmmod ofpart spinand mtd nandcore
    modprobe spinand
    modprobe mtd

    make sure the flash was detected

    dmesg | tail -n 6
    [ 237.055291] spi-nand: probe of spi0.0 failed with error -524
    [ 383.913569] spi-id: 00, ef, aa, 21
    [ 383.913729] spi-id: ef, aa, 21, 00
    [ 383.913878] spi-id: ef, aa, 21, 00
    [ 383.913936] spi-nand spi0.0: Winbond SPI NAND was found.
    [ 383.913965] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
     
  • Recovering bootloader

    Add partitions of your choice using

    mtdpart add /dev/mtd0 <PART_NAME>

    Erase & flash partition

    flash_erase /dev/mtd 0 0
    nandwrite /dev/mtd image_file

    Disconnect flash from orange pi board and test it

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines