eMMC not accessible

  • Issue with the onboard 4G eMMC on the efuasa9 not being available from u-boot and linux.


    The eMMC in the device tree states that there is a hardware issue and that (in efusa9qdl.dtsi):
    /* emmc doesn't work currently */
    ...
    /*
    * Due to board issue, we can not use external regulator for card slot
    * by default since the card power is shared with card detect pullup.
    * Disabling the vmmc regulator will cause unexpected card detect
    * interrupts.
    * HW rework is needed to fix this isssue. Remove R695 first, then you
    * can open below line to enable the using of external regulator.
    * Then you will be able to power off the card during suspend. This is
    * especially needed for a SD3.0 card re-enumeration working on UHS mode
    * Note: reg_sd3_vmmc is also need to be enabled
    */


    Is it the case that we can not currently make use of the eMMC 4G on the board without a hardware fix?
    Also, is this issue related to u-boot not being able to "see" the eMMC?
    Finally, we have ordered some more efus and armstone boards (which hopefully will be delivered next week), if there was previously a hardware issue, is this problem persisting in the new boards?


    Many thanks

  • In the past we had quite some problems accessing the eMMC. But these problems are gone with the new 4.1 kernel now. However we did not add eMMC support for efusA9 in time to be included in the fsimx6-V3.0 release. But in the meantime, we have it working in Linux. So if you want to have this, we con provide a patch. It is mainly changes in the device tree.


    However eMMC support in U-Boot is a totally different story. Unfortunately this is not easy to implement. All current accesses to storage devices like SD-card, USB-Stick and even to Network with NFS and TFTP are only meant to download a file to the board to be stored in NAND memory. So these are all read operations, and all write operations to write any data to one of these devices other than NAND flash are simply missing in U-Boot. They are not just configured out in our version, they simply do not exist at all.


    But to use eMMC as a boot device would require the following functions in U-Boot:


    • Create a partition table
    • Format the eMMC device/partition, i.e. install a filesystem
    • Write files to eMMC
    • Have boot strategies to load kernel/fdt/rootfs from eMMC


    All of this is currently missing. We first have to investigate the best way how this can be implemented. Maybe we have to go to newer U-Boot versions first to have support for some of this stuff.


    You actually can read a file from an existing filesystem on an eMMC device in U-Boot, but you can not create one in U-Boot. Theoretically you could start a Linux system with rootfs in some other media (NFS, NAND, initrd) just to format and install the final rootfs in the eMMC. And then start from eMMC. However this is not very convenient and updates would also be very complicated.


    So in our view, at the moment eMMC is not a good choice for a boot device. You can use it in Linux, for example to store large data files on it, but we do not recommend to use it as boot device right now.


    Here is some other information about eMMC. eMMC is cheap, but only because it is also not very stable. Depending on the temperature, the data may be corrupted in a rather short period of time. If it is very hot, this may be only a few weeks of data retention time. Much shorter than data stored in the SLC NAND memory that we provide on our boards. So if eMMC is a good storage at all depends heavily on the average and maximum temperature of your environment. NAND is much more stable compared to eMMC.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Thanks for the update.
    " So if you want to have this, we con provide a patch. It is mainly changes in the device tree." Yes it would be necessary for us to access the eMMC at least under linux. So if you could provide the necessary changes, it would be great.


    Thanks
    Oreste

  • Dear Mr. Oreste,


    here is the patch for the emmc support on efusA9.


    Your F&S Support Team

    Files

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Thanks for the patch file. I have installed this and the emmc 4G is now seen by the os. However, I am not familiar with using such cards.
    I would like to create one or more paritions on the card. The first partition could contain the rootfs and another partition will contain some large files.
    I have installed the mmc utility - not sure if this is the correct utility to use or whether there is some other way to create the necessary partitions.
    Currently the emmc shows up as


    brw-rw---- 1 root disk 179, 8 Dec 4 23:00 /dev/mmcblk2
    brw-rw---- 1 root disk 179, 16 Dec 4 23:00 /dev/mmcblk2boot0 (can be accessed and contains 2M of zeros)
    brw-rw---- 1 root disk 179, 24 Dec 4 23:00 /dev/mmcblk2boot1 (can be accessed and contains 2M of zeros)
    brw-rw---- 1 root disk 179, 32 Dec 4 23:00 /dev/mmcblk2rpmb (can NOT be accessed)


    Any pointer to documentation or other help appreciated.


    Many thanks
    Oreste

  • You should use the mmcblk2 device. This is the main part of the eMMC device. The device is already partitioned, but there are some rules when using the boot and rpmb partitions. I think one of them can only be written once. So I would add all partitions to the mmcblk2 device.


    There are two ways of storing data there.


    1. Lowlevel write a disk image, including partition table and filesystems
    2. Do partitioning and formating of the device by hand and store single files on the device



    Way 1:


    You create an image of the whole eMMC disk beforehand on your PC. For example create a file of the size of the eMMC, use fdisk on it to create partitions and use mke2fs to create filesystems on it. Then mount the partitions via loop device and store files in them. The result is one large file that contains everything that you want to write to eMMC device. This file needs to be downloaded somehow to the board and written with dd to the /dev/mmcblk2.


    Disadvantages: The file is rather large, so you get trouble downloading it, as the RAM is not large enough. So you might need some NFS-Server to access it on the fly from the PC while writing it to the eMMC. But it also takes time to write such a large file.



    Way 2:


    Unfortunately now that you mention it, I have seen that we haven't added the fdisk program to our rootfs yet. So if you really want to partition the device, you have to add it to your buildroot configuration. In fact it is part of busybox, so call


    Code
    1. make busybox-menuconfig


    in buildroot, go to "Linux System Utilities" and check "fdisk" there. Then rebuild buildroot and download the new rootfs to the board. Now you can partition the device with


    Code
    1. fdisk /dev/mmcblk2


    After you have created the partitions. you should have additional devices like /dev/mmcblk2p1, /dev/mmcblk2p2, etc. Each one is a partition of the device.


    We have already installed the e2progs, so you can create an ext4 filesystem on top of these devices. Just use one of the above partition devices as argument for the mke2fs program. When this is done, you can mount such a partition with the mount command and copy files to it.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.