From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/2] mci: sdhci: provide sdhci_readx_poll_timeout helpers
Date: Wed, 22 Apr 2020 07:49:51 +0200 [thread overview]
Message-ID: <20200422054951.11970-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20200422054951.11970-1-s.hauer@pengutronix.de>
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
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>
---
drivers/mci/sdhci.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
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 */
--
2.26.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2020-04-22 5:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 9:29 [PATCH 1/4] " Ahmad Fatoum
2020-04-15 9:29 ` [PATCH 2/4] mci: sdhci: implement sdhci_reset() Ahmad Fatoum
2020-04-15 9:29 ` [PATCH 3/4] ARM: at91: dts: specify aliases for sdmmc nodes Ahmad Fatoum
2020-04-15 9:29 ` [PATCH 4/4] mci: sdhci: add Atmel SDHCI (sama5d2, sam9x60) support Ahmad Fatoum
2020-04-20 6:22 ` [PATCH 1/4] mci: sdhci: provide sdhci_readx_poll_timeout helpers Sascha Hauer
2020-04-20 6:25 ` Ahmad Fatoum
2020-04-22 5:51 ` Sascha Hauer
2020-04-22 5:49 ` [PATCH 1/2] iopoll: Introduce read_poll_timeout Sascha Hauer
2020-04-22 5:49 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422054951.11970-2-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox