unsigned int len, i, size;
unsigned *dmabuf = host->buffer;
- size = host->total_length;
+ size = data->blksz * data->blocks;
len = data->sg_len;
+ /* AT91SAM926[0/3] Data Write Operation and number of bytes erratum */
+ if (cpu_is_at91sam9260() || cpu_is_at91sam9263())
+ if (host->total_length == 12)
+ memset(dmabuf, 0, 12);
+
/*
* Just loop through all entries. Size might not
* be the entire list though so make sure that
for (index = 0; index < (amount / 4); index++)
*dmabuf++ = swab32(sgbuffer[index]);
- }
- else
+ } else {
memcpy(dmabuf, sgbuffer, amount);
+ dmabuf += amount;
+ }
kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
/* card is in IDLE mode now */
pr_debug("-> bytes_xfered %d, total_length = %d\n",
data->bytes_xfered, host->total_length);
- data->bytes_xfered = host->total_length;
+ data->bytes_xfered = data->blksz * data->blocks;
}
}
}
* Handle a write
*/
host->total_length = block_length * blocks;
+ /*
+ * AT91SAM926[0/3] Data Write Operation and
+ * number of bytes erratum
+ */
+ if (cpu_is_at91sam9260 () || cpu_is_at91sam9263())
+ if (host->total_length < 12)
+ host->total_length = 12;
host->buffer = dma_alloc_coherent(NULL,
host->total_length,
&host->physical_address, GFP_KERNEL);