PolarFire eMMC Support, SDHCI Driver Refactor and add CUSTOM_ENCRYPT_KEY support
#659
+2,829
−2,470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds eMMC support for the PolarFire SoC platform and refactors the SD/eMMC driver code into a reusable generic SDHCI module. Additionally, it introduces support for custom encryption key implementations.
Changes
🆕 New Features
src/sdhci.candinclude/sdhci.h) that can be used by other platformsCUSTOM_ENCRYPT_KEYoption allowing users to implement their own encryption key storage/retrieval functions♻️ Refactoring
hal/mpfs250.cto the new genericsrc/sdhci.chal/mpfs250.candhal/mpfs250.hsignificantlyhal/riscv.h📝 Documentation
docs/Targets.mdwith custom encryption key usage instructionsCUSTOM_ENCRYPT_KEYdocumentation todocs/encrypted_partitions.mdNew Build Options
DISK_SDCARD=1DISK_EMMC=1CUSTOM_ENCRYPT_KEY=1Files Changed
src/sdhci.c- New generic SDHCI driver implementationinclude/sdhci.h- New SDHCI driver header with full register definitionshal/mpfs250.c- Simplified to use the new generic SDHCI driverhal/mpfs250.h- Reduced to platform-specific definitions onlyhal/riscv.h- Added RISC-V specific helper macrossrc/boot_riscv.c- Updated for eMMC boot supportsrc/update_disk.c- Enhanced disk update logicsrc/libwolfboot.c- Conditional compilation for custom encryption keysoptions.mk- Added new build optionsconfig/examples/polarfire_mpfs250.config- Updated with SD/eMMC optionsdocs/Targets.md- Updated documentationdocs/encrypted_partitions.md- Added custom encryption key documentationUsage Example
To enable eMMC instead of SD card in your config:
To use custom encryption key storage:
Then implement
wolfBoot_get_encrypt_key()in your custom source file.Testing
Example eMMC Encrypted Boot output (with DISK_TEST=1)
Example SDCARD Encrypted Boot output (with DISK_TEST=1)