
Hi Andre,
On Sun, 23 May 2021 at 18:37, Andre Przywara andre.przywara@arm.com wrote:
At the moment the fastboot code relies on the Kconfig variable CONFIG_FASTBOOT_FLASH_MMC_DEV to point to the MMC device to use for the flash command. This value needs to be the *U-Boot device number*, which recently got more dynamic, and depends on other MMC nodes in the devicetree, but also on mmc aliases defined. This leads to situations where it's hard to fix this number at compile time, because a WiFi device might enumerate before the wanted eMMC device, for instance.
To avoid this fragile situation, allow this value to be determined at runtime. This decision is probably platform specific, so introduce a weak function that returns the needed number, and use that everywhere instead of the Kconfig variable.
For now the default implementation just returns this very Kconfig variable, but this can be overwritten by platforms later.
No functional change at this point.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/fastboot/fb_command.c | 6 +++--- drivers/fastboot/fb_common.c | 3 ++- drivers/fastboot/fb_mmc.c | 12 ++++++++---- include/fastboot.h | 7 +++++++ 4 files changed, 20 insertions(+), 8 deletions(-)
I wonder if this would be better done using a sysinfo driver? Then it could be hard-coded, picked up from the DT, probed at runtime, etc., just as with a weak function.
Regards, Simon