Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2006 20:01:37 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 106795 for review
Message-ID:  <200609272001.k8RK1bKJ029330@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106795

Change 106795 by imp@imp_lighthouse on 2006/09/27 20:00:39

	wait_for_app_cmd

Affected files ...

.. //depot/projects/arm/src/sys/dev/mmc/mmc.c#7 edit

Differences ...

==== //depot/projects/arm/src/sys/dev/mmc/mmc.c#7 (text+ko) ====

@@ -175,6 +175,31 @@
 	return (cmd->error);
 }
 
+static int
+mmc_wait_for_app_cmd(struct mmc_softc *sc, uint32_t rca,
+    struct mmc_command *cmd, int retries)
+{
+	struct mmc_command appcmd;
+	int err = MMC_ERR_NONE, i;
+
+	for (i = 0; i <= retries; i++) {
+		appcmd.opcode = MMC_APP_CMD;
+		appcmd.arg = rca << 16;
+		appcmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+		mmc_wait_for_cmd(sc, &appcmd, 0);
+		err = appcmd.error;
+		if (err != MMC_ERR_NONE)
+			continue;
+		if (appcmd.resp[0] & R1_APP_CMD)
+			return MMC_ERR_FAILED;
+		mmc_wait_for_cmd(sc, cmd, 0);
+		err = cmd->error;
+		if (err == MMC_ERR_NONE)
+			break;
+	}
+	return (err);
+}
+
 static void
 mmc_idle_cards(struct mmc_softc *sc)
 {
@@ -211,7 +236,7 @@
 	cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
 
 	for (i = 0; i < 100; i++) {
-		err = mmc_wait_for_cmd(sc, &cmd, CMD_RETRIES);
+		err = mmc_wait_for_app_cmd(sc, 0, &cmd, CMD_RETRIES);
 		if (err != MMC_ERR_NONE)
 			break;
 		if ((cmd.resp[0] & MMC_OCR_CARD_BUSY) || ocr == 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609272001.k8RK1bKJ029330>