Date: Tue, 3 Oct 2006 22:30:08 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 107224 for review Message-ID: <200610032230.k93MU8G9028509@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107224 Change 107224 by imp@imp_lighthouse on 2006/10/03 22:29:45 Less verbosity Affected files ... .. //depot/projects/arm/src/sys/arm/at91/at91_mci.c#21 edit .. //depot/projects/arm/src/sys/dev/mmc/mmc.c#20 edit .. //depot/projects/arm/src/sys/dev/mmc/mmcsd.c#7 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/at91_mci.c#21 (text+ko) ==== @@ -335,7 +335,7 @@ if (!data) { // The no data case is fairly simple at91_mci_pdc_disable(sc); - printf("CMDR %x ARGR %x\n", cmdr, cmd->arg); +// printf("CMDR %x ARGR %x\n", cmdr, cmd->arg); WR4(sc, MCI_ARGR, cmd->arg); WR4(sc, MCI_CMDR, cmdr); WR4(sc, MCI_IER, MCI_SR_ERROR | MCI_SR_CMDRDY); @@ -379,7 +379,7 @@ } else panic("Write write support"); } - printf("CMDR %x ARGR %x with data\n", cmdr, cmd->arg); +// printf("CMDR %x ARGR %x with data\n", cmdr, cmd->arg); WR4(sc, MCI_ARGR, cmd->arg); WR4(sc, MCI_CMDR, cmdr); if (cmdr & MCI_CMDR_TRCMD_START) { @@ -402,10 +402,12 @@ // assert locked if (!(sc->flags & CMD_STARTED)) { sc->flags |= CMD_STARTED; +// printf("Starting CMD\n"); at91_mci_start_cmd(sc, req->cmd); return; } if (!(sc->flags & STOP_STARTED) && req->stop) { +// printf("Starting Stop\n"); sc->flags |= STOP_STARTED; at91_mci_start_cmd(sc, req->stop); return; @@ -499,7 +501,7 @@ AT91_MCI_LOCK(sc); sr = RD4(sc, MCI_SR) & RD4(sc, MCI_IMR); - printf("i 0x%x\n", sr); +// printf("i 0x%x\n", sr); cmd = sc->curcmd; if (sr & MCI_SR_ERROR) { // Ignore CRC errors on CMD2 and ACMD47, per relevant standards @@ -521,39 +523,39 @@ } } else { if (sr & MCI_SR_TXBUFE) { - printf("TXBUFE\n"); +// printf("TXBUFE\n"); //XXX at91_mci_xmit_done(sc); } if (sr & MCI_SR_RXBUFF) { - printf("RXBUFF\n"); +// printf("RXBUFF\n"); WR4(sc, MCI_IDR, MCI_SR_RXBUFF); WR4(sc, MCI_IER, MCI_SR_CMDRDY); } if (sr & MCI_SR_ENDTX) { - printf("ENDTX\n"); +// printf("ENDTX\n"); } if (sr & MCI_SR_ENDRX) { - printf("ENDRX\n"); +// printf("ENDRX\n"); at91_mci_read_done(sc); } if (sr & MCI_SR_NOTBUSY) { - printf("NOTBUSY\n"); +// printf("NOTBUSY\n"); WR4(sc, MCI_IER, MCI_SR_CMDRDY); } if (sr & MCI_SR_DTIP) { - printf("Data transfer in progress\n"); +// printf("Data transfer in progress\n"); } if (sr & MCI_SR_BLKE) { - printf("Block transfer end\n"); +// printf("Block transfer end\n"); } if (sr & MCI_SR_TXRDY) { - printf("Ready to transmit\n"); +// printf("Ready to transmit\n"); } if (sr & MCI_SR_RXRDY) { - printf("Ready to receive\n"); +// printf("Ready to receive\n"); } if (sr & MCI_SR_CMDRDY) { - printf("Command ready\n"); +// printf("Command ready\n"); done = 1; cmd->error = MMC_ERR_NONE; } @@ -564,7 +566,7 @@ for (i = 0; i < ((cmd->flags & MMC_RSP_136) ? 4 : 1); i++) { cmd->resp[i] = RD4(sc, MCI_RSPR + i * 4); - printf("RSPR[%d] = %x\n", i, cmd->resp[i]); +// printf("RSPR[%d] = %x\n", i, cmd->resp[i]); } } at91_mci_start(sc); ==== //depot/projects/arm/src/sys/dev/mmc/mmc.c#20 (text+ko) ==== @@ -77,7 +77,10 @@ #define MMC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); static void mmc_delayed_attach(void *); -static int mmc_wait_for_cmd(struct mmc_softc *sc, struct mmc_command *cmd, int retries); +static int mmc_wait_for_cmd(struct mmc_softc *sc, struct mmc_command *cmd, + int retries); +static int mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, + uint32_t arg, uint32_t flags, uint32_t *resp, int retries); static void mmc_ms_delay(int ms) @@ -105,7 +108,6 @@ /* We'll probe and attach our children later, but before / mount */ sc->config_intrhook.ich_func = mmc_delayed_attach; sc->config_intrhook.ich_arg = sc; - printf("arg is %p\n", sc); if (config_intrhook_establish(&sc->config_intrhook) != 0) device_printf(dev, "config_intrhook_establish failed\n"); return (0); @@ -121,7 +123,6 @@ mmc_acquire_bus(device_t busdev, device_t dev) { struct mmc_softc *sc; - struct mmc_command cmd; int err; err = MMCBR_ACQUIRE_HOST(device_get_parent(busdev), dev); @@ -136,10 +137,9 @@ if (busdev != dev) { // XXX Should do lazy selection. - cmd.opcode = MMC_SELECT_CARD; - cmd.arg = mmc_get_rca(dev) << 16; - cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; - mmc_wait_for_cmd(sc, &cmd, CMD_RETRIES); + mmc_wait_for_command(sc, MMC_SELECT_CARD, + mmc_get_rca(dev) << 16, MMC_RSP_R1 | MMC_CMD_AC, + NULL, CMD_RETRIES); // XXX should set bus width here? } return (0); @@ -149,17 +149,14 @@ mmc_release_bus(device_t busdev, device_t dev) { struct mmc_softc *sc; - struct mmc_command cmd; int err; sc = device_get_softc(busdev); if (busdev != dev) { - // XXX Should do lazy selection. - cmd.opcode = MMC_DESELECT_CARD; - cmd.arg = 0; - cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; - mmc_wait_for_cmd(sc, &cmd, CMD_RETRIES); + // XXX Should do lazy deselection. + mmc_wait_for_command(sc, MMC_DESELECT_CARD, 0, + MMC_RSP_R1 | MMC_CMD_AC, NULL, CMD_RETRIES); } MMC_LOCK(sc); if (!sc->owner) @@ -205,7 +202,7 @@ { struct mmc_softc *sc; - printf("Wakeup for req %p done_data %p\n", req, req->done_data); +// printf("Wakeup for req %p done_data %p\n", req, req->done_data); sc = (struct mmc_softc *)req->done_data; MMC_LOCK(sc); req->flags |= MMC_REQ_DONE; @@ -220,14 +217,14 @@ req->done = mmc_wakeup; req->done_data = sc; - printf("Submitting request %p sc %p\n", req, sc); +// printf("Submitting request %p sc %p\n", req, sc); MMCBR_REQUEST(device_get_parent(sc->dev), sc->dev, req); MMC_LOCK(sc); do { err = msleep(req, &sc->sc_mtx, PZERO | PCATCH, "mmcreq", hz / 10); } while (!(req->flags & MMC_REQ_DONE) && err == EAGAIN); - printf("Request %p done with error %d\n", req, err); +// printf("Request %p done with error %d\n", req, err); MMC_UNLOCK(sc); return (err); } @@ -237,7 +234,6 @@ { struct mmc_softc *sc = device_get_softc(brdev); - printf("passing along request %p\n", req); return mmc_wait_for_req(sc, req); } @@ -251,7 +247,7 @@ cmd->retries = retries; cmd->data = NULL; mreq.cmd = cmd; - printf("CMD: %x ARG %x\n", cmd->opcode, cmd->arg); +// printf("CMD: %x ARG %x\n", cmd->opcode, cmd->arg); mmc_wait_for_req(sc, &mreq); return (cmd->error); } @@ -281,6 +277,31 @@ return (err); } +static int +mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, + uint32_t arg, uint32_t flags, uint32_t *resp, int retries) +{ + struct mmc_command cmd; + int err; + + memset(&cmd, 0, sizeof(cmd)); + cmd.opcode = opcode; + cmd.arg = arg; + cmd.flags = flags; + err = mmc_wait_for_cmd(sc, &cmd, retries); + if (err) + return (err); + if (cmd.error) + return (cmd.error); + if (resp) { + if (flags & MMC_RSP_136) + memcpy(resp, cmd.resp, 4 * sizeof(uint32_t)); + else + *resp = cmd.resp[0]; + } + return (0); +} + static void mmc_idle_cards(struct mmc_softc *sc) { @@ -297,7 +318,6 @@ cmd.arg = 0; cmd.flags = MMC_RSP_NONE | MMC_CMD_BC; mmc_wait_for_cmd(sc, &cmd, 0); - printf("GO_IDLE returns %d\n", cmd.error); mmc_ms_delay(1); mmcbr_set_chip_select(dev, cs_dontcare); @@ -565,7 +585,6 @@ if (mmc_send_op_cond(sc, 0, &ocr) != MMC_ERR_NONE) return; // Failed both, punt! XXX power down? } - printf("OCR IS %x\n", ocr); mmcbr_set_ocr(dev, mmc_select_vdd(sc, ocr)); if (mmcbr_get_ocr(dev) != 0) mmc_idle_cards(sc); @@ -682,7 +701,6 @@ { struct mmc_softc *sc = xsc; - device_printf(sc->dev, "insert mmc/sd probe code here\n"); mmc_scan(sc); config_intrhook_disestablish(&sc->config_intrhook); } ==== //depot/projects/arm/src/sys/dev/mmc/mmcsd.c#7 (text+ko) ==== @@ -95,7 +95,7 @@ sc->disk->d_close = mmcsd_close; sc->disk->d_strategy = mmcsd_strategy; // sc->disk->d_dump = mmcsd_dump; Need polling mmc layer - sc->disk->d_name = "flash/card"; + sc->disk->d_name = "mmcsd"; sc->disk->d_drv1 = sc; sc->disk->d_maxsize = DFLTPHYS; sc->disk->d_sectorsize = mmc_get_sector_size(dev); @@ -179,13 +179,15 @@ } while (bp == NULL); MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev); bioq_remove(&sc->bio_queue, bp); - printf("mmc_task: request %p for block %lld\n", bp, bp->bio_pblkno); +// printf("mmc_task: request %p for block %lld\n", bp, bp->bio_pblkno); sz = sc->disk->d_sectorsize; end = bp->bio_pblkno + (bp->bio_bcount / sz); // XXX should use read/write_mulit for (block = bp->bio_pblkno; block < end; block++) { char *vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz; memset(&req, 0, sizeof(req)); + memset(&cmd, 0, sizeof(cmd)); + memset(&stop, 0, sizeof(stop)); req.cmd = &cmd; cmd.data = &data; req.stop = &stop;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610032230.k93MU8G9028509>