diff options
author | Tom Rini <trini@ti.com> | 2013-08-12 08:48:49 -0400 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-08-12 08:48:49 -0400 |
commit | 66ddf42b0e1bdb2fbe5d84bb5c1fde515633d028 (patch) | |
tree | 7edfb92fa148bdac387dd5db63bd9457c60bd6e8 /drivers/spi/fsl_espi.c | |
parent | a78dac79ede7fbb4c9e816abc879655540c3f076 (diff) | |
parent | 07a16f2a9cb6cbb0fbce72e649c7be214d7f801a (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-spi
Diffstat (limited to 'drivers/spi/fsl_espi.c')
-rw-r--r-- | drivers/spi/fsl_espi.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index fc0a58be29..c883d3cac0 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -221,15 +221,13 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, slave->bus, slave->cs, *(uint *) dout, dout, *(uint *) din, din, len); - num_chunks = data_len / max_tran_len + - (data_len % max_tran_len ? 1 : 0); + num_chunks = DIV_ROUND_UP(data_len, max_tran_len); while (num_chunks--) { if (data_in) din = buffer + rx_offset; dout = buffer; tran_len = min(data_len , max_tran_len); - num_blks = (tran_len + cmd_len) / 4 + - ((tran_len + cmd_len) % 4 ? 1 : 0); + num_blks = DIV_ROUND_UP(tran_len + cmd_len, 4); num_bytes = (tran_len + cmd_len) % 4; fsl->data_len = tran_len + cmd_len; spi_cs_activate(slave); |