[PATCH 03/21] mci: sdhci: support compiling common SDHCI code for sandbox PBL
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Jun 5 04:35:12 PDT 2025
We do not link sandbox with --gc-sections, so having references to
non-existent functions would lead to errors, even if they are never
called. Fix this by providing stubs.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
include/dma.h | 22 +++++++++++++++++-----
include/mci.h | 9 +++++++++
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/include/dma.h b/include/dma.h
index cb44963cc02e..b8016c2e890e 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -105,6 +105,12 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t address,
void dma_sync_single_for_device(struct device *dev, dma_addr_t address,
size_t size, enum dma_data_direction dir);
+
+dma_addr_t dma_map_single(struct device *dev, void *ptr,
+ size_t size, enum dma_data_direction dir);
+
+void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
+ size_t size, enum dma_data_direction dir);
#else
/*
* assumes buffers are in coherent/uncached memory, e.g. because
@@ -121,13 +127,19 @@ static inline void dma_sync_single_for_device(struct device *dev, dma_addr_t add
{
barrier_data(address);
}
+
+static inline dma_addr_t dma_map_single(struct device *dev, void *ptr,
+ size_t size, enum dma_data_direction dir)
+{
+ return virt_to_phys(ptr);
+}
+
+static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
+ size_t size, enum dma_data_direction dir)
+{
+}
#endif
-dma_addr_t dma_map_single(struct device *dev, void *ptr,
- size_t size, enum dma_data_direction dir);
-
-void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
- size_t size, enum dma_data_direction dir);
#ifndef dma_alloc_coherent
void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle);
diff --git a/include/mci.h b/include/mci.h
index 207fb9779a14..82099f118e65 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -767,6 +767,7 @@ static inline int mmc_card_hs(struct mci *mci)
mci->host->ios.timing == MMC_TIMING_MMC_HS;
}
+#if IN_PROPER
/*
* Execute tuning sequence to seek the proper bus operating
* conditions for HS200 and HS400, which sends CMD21 to the device.
@@ -775,6 +776,14 @@ int mmc_hs200_tuning(struct mci *mci);
int mci_execute_tuning(struct mci *mci);
int mmc_send_tuning(struct mci *mci, u32 opcode);
int mci_send_abort_tuning(struct mci *mci, u32 opcode);
+
+#else
+static inline int mmc_hs200_tuning(struct mci *mci) { return -ENOSYS; }
+static inline int mci_execute_tuning(struct mci *mci) { return -ENOSYS; }
+static inline int mmc_send_tuning(struct mci *mci, u32 opcode) { return -ENOSYS; }
+static inline int mci_send_abort_tuning(struct mci *mci, u32 opcode) { return -ENOSYS; }
+#endif
+
int mmc_select_timing(struct mci *mci);
int mci_set_blockcount(struct mci *mci, unsigned int cmdarg);
int mci_blk_part_switch(struct mci_part *part);
--
2.39.5
More information about the barebox
mailing list