On Tue, Aug 11, 2020 at 2:59 PM aTc atc@k-n-p.org wrote:
On 8/11/20 8:38 PM, Nick Elsmore wrote:
If we use a script in the initramfs to manage this
I hope you are aware that there is already a script in the initramfs that does some emmc/microsd magic to handle booting from either one. This could get in the way of any experiments you are trying to do.
https://dev.pyra-handheld.com/packages/pyra-config/-/blob/master/initramfs/p...
Yep I'm aware of this script. Thanks for pointing it out with the link, though. The issue with this script detecting the mux state as it does is that the driver will not reflect the device selected by the bootloader. When the txs02612 driver is probed, it will first add the mmc host for the eMMC and then the uSD. When these hosts are added, their request op functions get called which switches the mux state. The state of the mux will be left with whichever is requested last. It is usually the uSD since it is added last, but since the detect function is called asynchronously there is no guarantee of this.
I can see that the script is detecting whether a mmcblk device has been registered, but the existence of this device does not reflect the state of the mux either. It is possible that the eMMC device was registered and the mux is switched to uSD afterwards, but the mmcblk device still exists as the polling has not occurred yet to trigger its de-enumeration. While the situation is unlikely, unfortunately "unlikely" in this scenario means potential bug.