-+ tail = bcm_spi_readb(bs, SPI_MSG_TAIL);
-+
-+ while ((tail < bs->fifo_size) && (bs->remaining_bytes > 0)) {
-+ if (bs->tx_ptr)
-+ bcm_spi_writeb(bs, *bs->tx_ptr++, SPI_MSG_DATA);
-+ else
-+ bcm_spi_writeb(bs, 0, SPI_MSG_DATA);
-+
-+ bs->remaining_bytes--;
-+ tail = bcm_spi_readb(bs, SPI_MSG_TAIL);
-+ }
++ size = bs->remaining_bytes < bs->fifo_size ? bs->remaining_bytes :
++ bs->fifo_size;
++ memcpy_toio(bs->tx_io, bs->tx_ptr, size);
++ bs->remaining_bytes -= size;