From owner-p4-projects@FreeBSD.ORG Wed Sep 27 20:01:38 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 86F2416A416; Wed, 27 Sep 2006 20:01:38 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D75116A412 for ; Wed, 27 Sep 2006 20:01:38 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0EFEE43D46 for ; Wed, 27 Sep 2006 20:01:38 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k8RK1bN5029333 for ; Wed, 27 Sep 2006 20:01:37 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8RK1bKJ029330 for perforce@freebsd.org; Wed, 27 Sep 2006 20:01:37 GMT (envelope-from imp@freebsd.org) Date: Wed, 27 Sep 2006 20:01:37 GMT Message-Id: <200609272001.k8RK1bKJ029330@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 106795 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Sep 2006 20:01:38 -0000 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)