summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2023-10-16 18:16:12 +0200
committerStefano Babic <[email protected]>2023-10-17 23:55:10 +0200
commite936db953600aba0986743f12229d8b7ebff92ae (patch)
treeb9a76226e83d2092323071747df0b58da242e5f7 /common
parentfb2bdc4efcb99fab62051274ad2330aef07360f6 (diff)
spl: mmc: Introduce proper layering for spl_mmc_get_uboot_raw_sector()
Introduce two new weak functions, arch_spl_mmc_get_uboot_raw_sector() and board_spl_mmc_get_uboot_raw_sector(), each of which can be overridden at a matching level, that is arch/ and board/ , in addition to the existing weak function spl_mmc_get_uboot_raw_sector(). This way, architecture code can define a default architecture specific implementation of arch_spl_mmc_get_uboot_raw_sector(), while the board code can override that using board_spl_mmc_get_uboot_raw_sector() which takes precedence over the architecture code. In some sort of unlikely special case where code has to take precedence over board code too, the spl_mmc_get_uboot_raw_sector() is still left out to be a weak function, but it should be unlikely that this is ever needed to be overridden. Signed-off-by: Marek Vasut <[email protected]>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_mmc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 0ab85d2168c..612b11ef5b9 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -361,10 +361,22 @@ int __weak spl_mmc_boot_partition(const u32 boot_device)
}
#endif
+unsigned long __weak arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
+ unsigned long raw_sect)
+{
+ return raw_sect;
+}
+
+unsigned long __weak board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
+ unsigned long raw_sect)
+{
+ return arch_spl_mmc_get_uboot_raw_sector(mmc, raw_sect);
+}
+
unsigned long __weak spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
unsigned long raw_sect)
{
- return raw_sect;
+ return board_spl_mmc_get_uboot_raw_sector(mmc, raw_sect);
}
int default_spl_mmc_emmc_boot_partition(struct mmc *mmc)