From owner-p4-projects@FreeBSD.ORG Fri Sep 29 22:31:07 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 DA2F716A47B; Fri, 29 Sep 2006 22:31:06 +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 9AEC516A403 for ; Fri, 29 Sep 2006 22:31:06 +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 0143343D73 for ; Fri, 29 Sep 2006 22:31:05 +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 k8TMV5Ix060462 for ; Fri, 29 Sep 2006 22:31:05 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8TMV5Uv060459 for perforce@freebsd.org; Fri, 29 Sep 2006 22:31:05 GMT (envelope-from imp@freebsd.org) Date: Fri, 29 Sep 2006 22:31:05 GMT Message-Id: <200609292231.k8TMV5Uv060459@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 106918 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: Fri, 29 Sep 2006 22:31:07 -0000 http://perforce.freebsd.org/chv.cgi?CH=106918 Change 106918 by imp@imp_lighthouse on 2006/09/29 22:30:13 After sending CMD55, make sure we get a R1_APP_CMD bit set in the reply (not cleared). set bus mode push-pull for sd detection (linux doesn't do this, but the boot blocks do and work) Re-add ocr check Debugging changes Affected files ... .. //depot/projects/arm/src/sys/dev/mmc/mmc.c#10 edit Differences ... ==== //depot/projects/arm/src/sys/dev/mmc/mmc.c#10 (text+ko) ==== @@ -183,6 +183,7 @@ cmd->retries = retries; cmd->data = NULL; mreq.cmd = cmd; + printf("CMD: %x ARG %x\n", cmd->opcode, cmd->arg); mmc_wait_for_req(sc, &mreq); return (cmd->error); } @@ -202,7 +203,7 @@ err = appcmd.error; if (err != MMC_ERR_NONE) continue; - if (appcmd.resp[0] & R1_APP_CMD) + if (!(appcmd.resp[0] & R1_APP_CMD)) return MMC_ERR_FAILED; mmc_wait_for_cmd(sc, cmd, 0); err = cmd->error; @@ -247,9 +248,8 @@ cmd.arg = ocr; cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR; - for (i = 0; i < 100; i++) { + for (i = 0; i < 10; i++) { err = mmc_wait_for_app_cmd(sc, 0, &cmd, CMD_RETRIES); - printf("err is %x busy is %x\n", err, cmd.resp[0]); if (err != MMC_ERR_NONE) break; if ((cmd.resp[0] & MMC_OCR_CARD_BUSY) || ocr == 0) @@ -259,7 +259,6 @@ } if (rocr && err == MMC_ERR_NONE) *rocr = cmd.resp[0]; - printf("app op sayz %x\n", cmd.resp[0]); return err; } @@ -309,6 +308,7 @@ mmc_ms_delay(2); } +#if 0 static void mmc_decode_cid(int is_sd, uint32_t *raw_cid, struct mmc_cid *cid) { @@ -354,6 +354,7 @@ panic("Write a MMC CSD parser"); } } +#endif static void mmc_discover_cards(struct mmc_softc *sc) @@ -404,6 +405,7 @@ // First, try SD modes mmcbr_set_mode(dev, mode_sd); mmc_power_up(sc); + mmcbr_set_bus_mode(dev, pushpull); mmc_idle_cards(sc); if (mmc_send_app_op_cond(sc, 0, &ocr) != MMC_ERR_NONE) { // Failed, try MMC @@ -426,8 +428,8 @@ * one card on the bus. */ printf("Oink %x!\n", mmcbr_get_ocr(dev)); -// if (mmcbr_get_ocr(dev) == 0) -// return; + if (mmcbr_get_ocr(dev) == 0) + return; /* XXX Linux re-sends op_cond command here */ mmc_discover_cards(sc);