Fix reboot on odroid C4 when using UHS microSD cards #4824
Closed
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.
Description
This fixes reboot on Odroid C4 boards which boot from UHS microSD cards. The issue has been discussed before here:
https://forum.armbian.com/topic/19340-odroid-c4-will-not-reboot-after-any-sort-of-kernel-update-have-tried-running-nand-sata-install/
A previous pull request removed a version of this patch here:
https://github.com/armbian/build/pull/3154/files#diff-8530e3af79cd8a35329d7d1a44b2a8006ad0cd70deefb0341a9933233673a9b6
The previous version of the patch was broken by upstream changes in the kernel, and this commit contains the minimal changes needed to fix it. Standard PSCI reset functions are now called in mainline, so the patch has been updated to reflect that. The patch now registers a reboot handler which gets called before the standard PSCI functions and toggles some GPIO lines to reset the SD card. If the card is a UHS card, then this puts it back into a state which the bootloader can deal with, and the board can reboot cleanly.
This patch might be applicable to other boards, but I can't test them. They can be tested by adding some code to the device tree, to add in the odroid,reboot driver.
I'd like to work on getting this change added to the kernel. but I'll try to make it more general, so it might not be a board-specific patch by the time it gets that far. When that eventually happens, this patch can be removed again.
How Has This Been Tested?
This has been tested by booting the board with a UHS-I SD card using the kernels compiled for odroidc4 targeting both BRANCH=current and BRANCH=edge. Both versions of the patched kernel allow a clean reboot.
Checklist: