Date: Fri, 29 Sep 2006 22:31:05 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 106918 for review Message-ID: <200609292231.k8TMV5Uv060459@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609292231.k8TMV5Uv060459>