summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2019-04-29 01:58:49 +0530
committerJagan Teki <jagan@amarulasolutions.com>2019-06-10 17:59:49 +0530
commit85fa2655302bad69d5c6d19b0e8a6b188c77737d (patch)
treef3e298b28c7e4dda81fcaa7e032639b897210beb /drivers/spi
parent5ccfb8a9957d1ca67082b80b27d4c9c10fc13ae0 (diff)
spi: mpc8xxx: Document LEN setting better
Instead of having a table right before the code implementing the length setting for documentation, have inline comments for the if branches actually implementing the length setting described table's entries (which is readable thanks to the set_char_len function). Signed-off-by: Mario Six <mario.six@gdsys.cc> Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/mpc8xxx_spi.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
index 63d956a295..1dd5bd9799 100644
--- a/drivers/spi/mpc8xxx_spi.c
+++ b/drivers/spi/mpc8xxx_spi.c
@@ -119,21 +119,15 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
/* Shift data so it's msb-justified */
tmpdout = *(u32 *)dout >> (32 - xfer_bitlen);
- /* The LEN field of the SPMODE register is set as follows:
- *
- * Bit length setting
- * len <= 4 3
- * 4 < len <= 16 len - 1
- * len > 16 0
- */
-
clrbits_be32(&spi->mode, SPI_MODE_EN);
- if (bitlen <= 4)
+ /* Set up length for this transfer */
+
+ if (bitlen <= 4) /* 4 bits or less */
set_char_len(spi, 3);
- else if (bitlen <= 16)
+ else if (bitlen <= 16) /* at most 16 bits */
set_char_len(spi, bitlen - 1);
- else
+ else /* more than 16 bits -> full 32 bit transfer */
set_char_len(spi, 0);
if (bitlen > 16) {