Banana Pi M2U: eMMC "data error, sending stop command" fixed with a 40 MHz device-tree overlay

  • Hi,

    on my Banana Pi BPI-M2 Ultra, LibreELEC runs fine from SD, but any sustained read from the eMMC fails within half a second:

    Code
    sunxi-mmc 1c11000.mmc: data error, sending stop command
    sunxi-mmc 1c11000.mmc: send stop command failed

    After that the eMMC host hangs (the reading process is stuck in D state). A warm reboot doesn't bring the eMMC back (fatal err update clk timeout, Failed to initialize a non-removable card), only a cold power-off does.

    Cause: the eMMC node (/soc/mmc@1c11000) in sun8i-r40-bananapi-m2-ultra.dtb has no max-frequency, so the card runs 8-bit DDR52 at 50 MHz, which isn't stable on this board.

    Fix: max-frequency = <40000000> on that node (the driver rounds it to 37.5 MHz). 8-bit and DDR52 stay on. I tested the clock live via /sys/kernel/debug/mmcN/clock first, then in the device tree:

    eMMC clockResult
    50 MHz (stock)fails within 0.5 s, reproducible
    37.5 MHz (max-frequency = <40000000>)pass: 33 min soak (6× full 7.3 GB read + 256 MB write/sha256 verify at 8 offsets), 0 errors
    25 MHzpass (full read)

    LibreELEC 12.2.1 now runs from the eMMC with this fix: read ~61 MB/s, write ~25 MB/s (the SD card manages 23 MB/s read), another 15 min soak with 0 errors, and cedrus HW decoding works.

    I apply it as a device-tree overlay, so it survives updates (an update replaces the dtb, but not a custom overlay or extlinux.conf). The overlay:

    Compile it on a PC (device-tree-compiler package), copy it to /flash and load it from extlinux.conf:

    Code
    dtc -@ -I dts -O dtb -o m2u-emmc-40mhz.dtbo m2u-emmc-40mhz.dts
    scp m2u-emmc-40mhz.dtbo root@<board>:/tmp/
    ssh root@<board>
    mount -o remount,rw /flash
    mkdir -p /flash/overlays && cp /tmp/m2u-emmc-40mhz.dtbo /flash/overlays/
    nano /flash/extlinux/extlinux.conf     # add the FDTOVERLAYS line below right after the FDT line
    sync; mount -o remount,ro /flash; reboot
    Code
      FDT /sun8i-r40-bananapi-m2-ultra.dtb
      FDTOVERLAYS /overlays/m2u-emmc-40mhz.dtbo

    Check after the reboot: cat /proc/device-tree/soc/mmc@1c11000/m2u-emmc-fix prints overlay 40MHz, and cat /sys/kernel/debug/mmcN/ios (after mount -t debugfs none /sys/kernel/debug) shows actual clock: 37500000 Hz, bus width: 3 (8 bits), timing spec: 8 (mmc DDR52).

    eMMC chip: Samsung 8WPD3R (manfid 0x15, eMMC 5.0, 08/2016). The same error is reported on Armbian for this board (topic 28215 on forum.armbian.com, a Samsung 8GTF4R there) and on the Banana Pi forum, so it's not just my unit.

    Would you consider adding max-frequency = <40000000>; to the eMMC node for the M2U in LibreELEC (or upstream)? I'm happy to test images.

    Note: the 12.2.x images don't boot on this board at all because of a separate U-Boot 2025.07 bug (hang after "Trying to boot from MMC1"). I found the cause and a fix, see my reply in thread 29908. On my board I use the 12.2.1 image with the U-Boot from 12.0.2 for now.

  • Would you consider adding max-frequency = <40000000>; to the eMMC node for the M2U in LibreELEC (or upstream)? I'm happy to test images.

    That depends on LE13. I put several SDIO/MMC fixes in it. Please test LE13 nightly first and report the status.