Date: Thu, 30 Nov 2006 01:37:14 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 110700 for review Message-ID: <200611300137.kAU1bErj090593@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=110700 Change 110700 by imp@imp_lighthouse on 2006/11/30 01:36:39 Interrupt driven doesn't work, but polling does. Go figure. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/at91_spi.c#13 edit .. //depot/projects/arm/src/sys/arm/at91/at91_spireg.h#7 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/at91_spi.c#13 (text+ko) ==== @@ -98,8 +98,8 @@ * Allocate DMA tags and maps */ err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, 2058, 1, 2048, BUS_DMA_ALLOCNOW, - NULL, NULL, &sc->dmatag); + BUS_SPACE_MAXADDR, NULL, NULL, 1024 * 10, 1, 1024 * 10, + BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); if (err != 0) goto out; for (i = 0; i < 4; i++) { @@ -231,25 +231,32 @@ cmd->tx_cmd_sz, at91_getaddr, &addr, 0) != 0) goto out; WR4(sc, PDC_RPR, addr); - WR4(sc, PDC_RCR, cmd->tx_cmd_sz); + WR4(sc, PDC_RCR, cmd->rx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; if (cmd->rx_data_sz > 0) { if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_data, - cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) + cmd->rx_data_sz, at91_getaddr, &addr, 0) != 0) goto out; WR4(sc, PDC_RNPR, addr); WR4(sc, PDC_RNCR, cmd->rx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; } - WR4(sc, SPI_IER, SPI_SR_ENDRX); + rxdone = sc->rxdone; +#if 0 + WR4(sc, SPI_IER, SPI_SR_RXBUFF); WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); - rxdone = sc->rxdone; do { err = msleep(&sc->rxdone, NULL, PCATCH | PZERO, "spi", hz); } while (rxdone == sc->rxdone && err != EINTR); +#else + WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); + while (!(RD4(sc, SPI_SR) & SPI_SR_RXBUFF)) + continue; + err = 0; +#endif WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); if (err == 0) { for (j = 0; j < i; j++) @@ -271,14 +278,14 @@ uint32_t sr; sr = RD4(sc, SPI_SR) & RD4(sc, SPI_IMR); - if (sr & SPI_SR_ENDRX) { + if (sr & SPI_SR_RXBUFF) { sc->rxdone++; - WR4(sc, SPI_IDR, SPI_SR_ENDRX); + WR4(sc, SPI_IDR, SPI_SR_RXBUFF); wakeup(&sc->rxdone); } - if (sr & ~SPI_SR_ENDRX) { + if (sr & ~SPI_SR_RXBUFF) { device_printf(sc->dev, "Unexpected ISR %#x\n", sr); - WR4(sc, SPI_IDR, sr & ~SPI_SR_ENDRX); + WR4(sc, SPI_IDR, sr & ~SPI_SR_RXBUFF); } } ==== //depot/projects/arm/src/sys/arm/at91/at91_spireg.h#7 (text+ko) ==== @@ -51,7 +51,7 @@ #define SPI_SR_OVRES 0x00008 #define SPI_SR_ENDRX 0x00010 #define SPI_SR_ENDTX 0x00020 -#define SPI_SR_RXBUFE 0x00040 +#define SPI_SR_RXBUFF 0x00040 #define SPI_SR_TXBUFE 0x00080 #define SPI_SR_SPIENS 0x10000 #define SPI_IER 0x14 /* IER: Interrupt Enable Regsiter */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611300137.kAU1bErj090593>