diff options
author | Mario Six <mario.six@gdsys.cc> | 2019-04-29 01:58:50 +0530 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2019-06-10 17:59:49 +0530 |
commit | a1c178e4c7eede986a31c18d413b33095136dbae (patch) | |
tree | 261971bdd65088fbbfe6364270c5ae5872ed7c64 /drivers/spi/mpc8xxx_spi.c | |
parent | 85fa2655302bad69d5c6d19b0e8a6b188c77737d (diff) | |
download | u-boot-a1c178e4c7eede986a31c18d413b33095136dbae.tar.gz |
spi: mpc8xxx: Re-order transfer setup
Minize the time the adapter is disabled (via SPI_MODE_EN
clearing/setting) to just the character length setting, and only set up
the temporary data writing variable right before we need it, so there is
a more clear distinction between setting up the SPI adapter, and setting
up the data to be written.
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/spi/mpc8xxx_spi.c')
-rw-r--r-- | drivers/spi/mpc8xxx_spi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index 1dd5bd9799..1e7c0144c2 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -116,9 +116,6 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din, u32 tmpdout = 0; uchar xfer_bitlen = (bitlen >= 32 ? 32 : bitlen); - /* Shift data so it's msb-justified */ - tmpdout = *(u32 *)dout >> (32 - xfer_bitlen); - clrbits_be32(&spi->mode, SPI_MODE_EN); /* Set up length for this transfer */ @@ -130,14 +127,17 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din, else /* more than 16 bits -> full 32 bit transfer */ set_char_len(spi, 0); + setbits_be32(&spi->mode, SPI_MODE_EN); + + /* Shift data so it's msb-justified */ + tmpdout = *(u32 *)dout >> (32 - xfer_bitlen); + if (bitlen > 16) { /* Set up the next iteration if sending > 32 bits */ bitlen -= 32; dout += 4; } - setbits_be32(&spi->mode, SPI_MODE_EN); - /* Write the data out */ out_be32(&spi->tx, tmpdout); |