From ab45d28ce38b22cb636748fddb8424184ff76e60 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 29 Nov 2006 07:57:02 +0000 Subject: [PATCH] MFp4: correct data counts so that we clock enough data for the spi transaction. This allows complete spi transactions to happen. --- sys/arm/at91/at91_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm/at91/at91_spi.c b/sys/arm/at91/at91_spi.c index 55b8a55eefe3..6341176b81fb 100644 --- a/sys/arm/at91/at91_spi.c +++ b/sys/arm/at91/at91_spi.c @@ -223,7 +223,7 @@ at91_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) goto out; WR4(sc, PDC_TNPR, addr); - WR4(sc, PDC_TNCR, cmd->tx_cmd_sz); + WR4(sc, PDC_TNCR, cmd->tx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREWRITE); mode[i++] = BUS_DMASYNC_POSTWRITE; } @@ -234,12 +234,12 @@ at91_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) WR4(sc, PDC_RCR, cmd->tx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; - if (cmd->tx_data_sz > 0) { + 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) goto out; WR4(sc, PDC_RNPR, addr); - WR4(sc, PDC_RNCR, cmd->tx_data_sz); + WR4(sc, PDC_RNCR, cmd->rx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; }