lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 27 Jan 2017 00:37:26 +0100
From:   Gerd Hoffmann <kraxel@...hat.com>
To:     linux-rpi-kernel@...ts.infradead.org
Cc:     Stefan Wahren <stefan.wahren@...e.com>,
        Eric Anholt <eric@...olt.net>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        linux-mmc@...r.kernel.org, Gerd Hoffmann <kraxel@...hat.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Ray Jui <rjui@...adcom.com>,
        Scott Branden <sbranden@...adcom.com>,
        bcm-kernel-feedback-list@...adcom.com (maintainer:BROADCOM
        BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...),
        Stephen Warren <swarren@...dotorg.org>,
        Lee Jones <lee@...nel.org>,
        linux-arm-kernel@...ts.infradead.org (moderated list:BROADCOM BCM2835
        ARM ARCHITECTURE), linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 13/13] mmc: bcm2835: use bcm2835_read_wait_sdcmd in bcm2835_finish_command

Signed-off-by: Gerd Hoffmann <kraxel@...hat.com>
---
 drivers/mmc/host/bcm2835.c | 56 +---------------------------------------------
 1 file changed, 1 insertion(+), 55 deletions(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 82caddc..64a2334 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -152,7 +152,6 @@ struct bcm2835_host {
 	unsigned int		blocks;		/* remaining PIO blocks */
 	int			irq;		/* Device IRQ */
 
-	u32			cmd_quick_poll_retries;
 	u32			ns_per_fifo_word;
 
 	/* cached registers */
@@ -782,62 +781,10 @@ static void bcm2835_finish_command(struct bcm2835_host *host)
 	struct device *dev = &host->pdev->dev;
 	struct mmc_command *cmd = host->cmd;
 	u32 sdcmd;
-	u32 retries;
 
 	dev_dbg(dev, "finish_command(%x)\n", readl(host->ioaddr + SDCMD));
 
-	/* Poll quickly at first */
-
-	retries = host->cmd_quick_poll_retries;
-	if (!retries) {
-		/* Work out how many polls take 1us by timing 10us */
-		struct timeval start, now;
-		int us_diff;
-
-		retries = 1;
-		do {
-			int i;
-
-			retries *= 2;
-
-			do_gettimeofday(&start);
-
-			for (i = 0; i < retries; i++) {
-				cpu_relax();
-				sdcmd = readl(host->ioaddr + SDCMD);
-			}
-
-			do_gettimeofday(&now);
-			us_diff = (now.tv_sec - start.tv_sec) * 1000000 +
-				(now.tv_usec - start.tv_usec);
-		} while (us_diff < 10);
-
-		host->cmd_quick_poll_retries =
-			((retries * us_diff + 9) * CMD_DALLY_US) / 10 + 1;
-		retries = 1; /* We've already waited long enough this time */
-	}
-
-	retries = host->cmd_quick_poll_retries;
-	for (sdcmd = readl(host->ioaddr + SDCMD);
-	     (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries;
-	     retries--) {
-		cpu_relax();
-		sdcmd = readl(host->ioaddr + SDCMD);
-	}
-
-	if (!retries) {
-		unsigned long wait_max;
-
-		/* Wait max 100 ms */
-		wait_max = jiffies + msecs_to_jiffies(100);
-		while (time_before(jiffies, wait_max)) {
-			usleep_range(1, 10);
-			sdcmd = readl(host->ioaddr + SDCMD);
-			if (!(sdcmd & SDCMD_NEW_FLAG) ||
-			    (sdcmd & SDCMD_FAIL_FLAG))
-				break;
-		}
-	}
+	sdcmd = bcm2835_read_wait_sdcmd(host, 100, true);
 
 	/* Check for errors */
 	if (sdcmd & SDCMD_NEW_FLAG) {
@@ -1435,7 +1382,6 @@ static int bcm2835_probe(struct platform_device *pdev)
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
 	host->pdev = pdev;
-	host->cmd_quick_poll_retries = 0;
 	host->pio_timeout = msecs_to_jiffies(500);
 	host->pio_limit = 1;
 	host->max_delay = 1; /* Warn if over 1ms */
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ