From owner-p4-projects@FreeBSD.ORG Tue Oct 3 19:42:05 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 12FC816A412; Tue, 3 Oct 2006 19:42:05 +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 E08B716A403 for ; Tue, 3 Oct 2006 19:42:04 +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 ABE9C43D49 for ; Tue, 3 Oct 2006 19:42:04 +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 k93Jg4hj089137 for ; Tue, 3 Oct 2006 19:42:04 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k93Jg43f089133 for perforce@freebsd.org; Tue, 3 Oct 2006 19:42:04 GMT (envelope-from imp@freebsd.org) Date: Tue, 3 Oct 2006 19:42:04 GMT Message-Id: <200610031942.k93Jg43f089133@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 107209 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: Tue, 03 Oct 2006 19:42:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=107209 Change 107209 by imp@imp_lighthouse on 2006/10/03 19:41:03 Add data command logging decrement mapped when we unmap the DMA buffer On the error path, if we have a dma buffer mapped, unmap it In read finished processing: o swap all the words in the buffer, not just the first one o Disable ENDRX and enable RXBUFF interrutps o turn off transfer bits of PDC (maybe could RXTDIS?) When we get a RXBUFF interrupt, disable it before enabling CMDRDY Affected files ... .. //depot/projects/arm/src/sys/arm/at91/at91_mci.c#17 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/at91_mci.c#17 (text+ko) ==== @@ -378,6 +378,7 @@ } else panic("Write write support"); } + 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) { @@ -474,10 +475,15 @@ cmd = sc->curcmd; bus_dmamap_sync(sc->dmatag, sc->map, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->dmatag, sc->map); + sc->mapped--; walker = (uint32_t *)cmd->data->data; len = cmd->data->len / 4; for (i = 0; i < len; i++) - *walker = bswap32(*walker); + walker[i] = bswap32(walker[i]); + // Finish up the sequence... + WR4(sc, MCI_IDR, MCI_SR_ENDRX); + WR4(sc, MCI_IER, MCI_SR_RXBUFF); + WR4(sc, PDC_PTCR, PDC_PTCR_RXTDIS | PDC_PTCR_TXTDIS); } static void @@ -506,6 +512,10 @@ else cmd->error = MMC_ERR_FAILED; done = 1; + if (sc->mapped && cmd->error) { + bus_dmamap_unload(sc->dmatag, sc->map); + sc->mapped--; + } } else { if (sr & MCI_SR_TXBUFE) { printf("TXBUFE\n"); @@ -513,6 +523,7 @@ } if (sr & MCI_SR_RXBUFF) { printf("RXBUFF\n"); + WR4(sc, MCI_IDR, MCI_SR_RXBUFF); WR4(sc, MCI_IER, MCI_SR_CMDRDY); } if (sr & MCI_SR_ENDTX) {