Re: [PATCH 1/2] mci-bcm2835: Don't block infinitely while waiting for a command completion

2021-10-02 Thread Sascha Hauer
On Thu, Sep 16, 2021 at 11:36:26AM +0200, Uwe Kleine-König wrote:
> Instead abort with a timeout error. This prevents getting a hung barebox
> when a command doesn't complete.
> 
> Signed-off-by: Uwe Kleine-König 
> ---
>  drivers/mci/mci-bcm2835.c | 4 
>  1 file changed, 4 insertions(+)

Applied, thanks

Sascha

-- 
Pengutronix e.K.   | |
Steuerwalder Str. 21   | http://www.pengutronix.de/  |
31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] mci-bcm2835: Don't block infinitely while waiting for a command completion

2021-09-16 Thread Uwe Kleine-König
Instead abort with a timeout error. This prevents getting a hung barebox
when a command doesn't complete.

Signed-off-by: Uwe Kleine-König 
---
 drivers/mci/mci-bcm2835.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c
index 0450f899c60a..12f7cb6ea398 100644
--- a/drivers/mci/mci-bcm2835.c
+++ b/drivers/mci/mci-bcm2835.c
@@ -87,13 +87,17 @@ static u32 bcm2835_sdhci_read32(struct sdhci *sdhci, int 
reg)
 static u32 bcm2835_mci_wait_command_done(struct bcm2835_mci_host *host)
 {
u32 interrupt = 0;
+   uint64_t start;
 
+   start = get_time_ns();
while (true) {
interrupt = sdhci_read32(>sdhci, SDHCI_INT_STATUS);
if (interrupt & SDHCI_INT_INDEX)
return -EPERM;
if (interrupt & SDHCI_INT_CMD_COMPLETE)
break;
+   if (is_timeout(start, SECOND))
+   return -ETIMEDOUT;
}
return 0;
 }

base-commit: c945d24ec5dad6910b02697e4d1df09f89d2b950
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox