summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-04-15 11:29:13 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-04-27 21:17:24 +0200
commitef7544a30304cf8cde50699b8bc2f40d10500bb1 (patch)
treef15985e5c8c51d2221650784584b0f020d69ddf6
parentbce7c84e6aa41cc1cce85f0b098863365dd4a3a0 (diff)
downloadbarebox-ef7544a30304cf8cde50699b8bc2f40d10500bb1.tar.gz
barebox-ef7544a30304cf8cde50699b8bc2f40d10500bb1.tar.xz
mci: sdhci: provide sdhci_readx_poll_timeout helpers
The sdhci_readN accessors don't lend themselves for clean use with readx_poll_timeout because they accept two arguments. Add a sdhci-specific helper, so the sdhci drivers can cut down on the timeout loop boilerplate. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mci/sdhci.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mci/sdhci.h b/drivers/mci/sdhci.h
index a307dc97cd..8c250a4d89 100644
--- a/drivers/mci/sdhci.h
+++ b/drivers/mci/sdhci.h
@@ -1,6 +1,9 @@
#ifndef __MCI_SDHCI_H
#define __MCI_SDHCI_H
+#include <pbl.h>
+#include <linux/iopoll.h>
+
#define SDHCI_DMA_ADDRESS 0x00
#define SDHCI_BLOCK_SIZE__BLOCK_COUNT 0x04
#define SDHCI_BLOCK_SIZE 0x04
@@ -144,4 +147,13 @@ void sdhci_set_cmd_xfer_mode(struct sdhci *host, struct mci_cmd *cmd,
u32 *xfer);
int sdhci_transfer_data(struct sdhci *sdhci, struct mci_data *data);
+#define sdhci_read8_poll_timeout(sdhci, reg, val, cond, timeout_us) \
+ read_poll_timeout(sdhci_read8, val, cond, timeout_us, sdhci, reg)
+
+#define sdhci_read16_poll_timeout(sdhci, reg, val, cond, timeout_us) \
+ read_poll_timeout(sdhci_read16, val, cond, timeout_us, sdhci, reg)
+
+#define sdhci_read32_poll_timeout(sdhci, reg, val, cond, timeout_us) \
+ read_poll_timeout(sdhci_read32, val, cond, timeout_us, sdhci, reg)
+
#endif /* __MCI_SDHCI_H */