linguini1 opened a new pull request, #17245:
URL: https://github.com/apache/nuttx/pull/17245

   ## Summary
   
   This initial implementation sets up support for the EMMC interfaces on the 
BCM2711. Only EMMC2 is tested since it is the interface of interest (connects 
to uSD card). MMCSD communication is functional and the boot partition of the 
SD card can be mounted and recognized.
   
   Closes #16948.
   Closes #16949.
   
   **NOTE:** This is a draft PR for initial review. I still have some changes 
to make to stabilize this feature. Writes currently fail, there are no software 
time-outs when blocking on the semaphore or polling certain register bits, etc. 
I also intend to let the user choose the transfer speed via Kconfig, since this 
controller implements a large range of speeds and it appears that the MMCSD 
driver doesn't allow that to be re-configured on the fly.
   
   **Does anyone know how to support 8-bit transfer?** The controller is 
capable of that, but the widebus functionality of the NuttX upper-half driver 
only seems to allow 1b or 4b modes.
   
   ## Impact
   
   Users can now interact with the micro-SD card through NuttX! Right now they 
are able to mount the boot partition, however I will also add support for 
mounting two separate partitions on the micro SD card so that a disk filesystem 
exists.
   
   ## Testing
   
   Tested using all the code included in this PR:
   
   - Initialize SDIO lower-half properly
   - Bind SDIO lower-half to MMCSD driver, verify that `/dev/mmcsd0` is mounted 
and that logs from the driver indicate correct operation
   - Mount `/dev/mmcsd0` to NuttX at `/sd` and verify that I can see all of the 
files in the card with `ls`
   - Verify that I can `cat` a file in the SD card
   - Verify that I can `echo` to a file on the SD card to create a new one
   
   ### Successful mount
   
   ```
   [    1.538000] fat_mount: FAT32:
   [    1.541000] fat_mount:       HW  sector size:     512
   [    1.546000] fat_mount:           sectors:         62521344
   [    1.551000] fat_mount:       FAT reserved:        32
   [    1.555000] fat_mount:           sectors:         62519296
   [    1.561000] fat_mount:           start sector:    2080
   [    1.565000] fat_mount:           root sector:     2
   [    1.570000] fat_mount:           root entries:    0
   [    1.575000] fat_mount:           data sector:     32608
   [    1.580000] fat_mount:           FSINFO sector:   2049
   [    1.584000] fat_mount:           Num FATs:        2
   [    1.589000] fat_mount:           FAT sectors:     15264
   [    1.594000] fat_mount:           sectors/cluster: 32
   [    1.598000] fat_mount:           max clusters:    1952773
   [    1.604000] fat_mount:       FSI free count       1952130
   [    1.609000] fat_mount:           next free        1417
   
   NuttShell (NSH) NuttX-12.11.0
   nsh> ls 
   /:
    dev/
    proc/
    sd/
   nsh> ls /dev
   /dev:
    console
    mmcsd0
    null
    zero
   ```
   
   Listing the SD card boot partition:
   
   ```
   /sd:
    bcm2711-rpi-4-b.dtb
    config.txt
    fixup4cd.dat
    fixup4.dat
    fixup4db.dat
    fixup4x.dat
    nuttx.bin
    start4cd.elf
    start4db.elf
    start4.elf
    start4x.elf
    overlays/
    test.txt
   nsh> 
   ```
   
   Using `cat` to see file contents of test.txt:
   
   ```
   nsh> cat /sd/test.txt
   This is a test! 
   ```
   
   Using `echo` to append to test.txt:
   
   *Currently fails*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to