spi: bcm53xx: simplify reading SPI data
authorRafał Miłecki <rafal@milecki.pl>
Fri, 29 Dec 2017 13:48:02 +0000 (14:48 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 3 Jan 2018 11:39:16 +0000 (11:39 +0000)
commit3a41092709a14c8efc84571deacc95a24b7fd6b3
tree992a37e28aa08a89441ff708581e0dd394aaea20
parent4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323
spi: bcm53xx: simplify reading SPI data

This commit makes transfer function use spi_transfer_is_last to
determine if currently processed transfer is the last one. Thanks to
that we finally set hardware registers properly and it makes controller
behave the way it's expected to.

This allows simplifying read function which can now simply start reading
from the slot 0 instead of the last saved offset. It has been
successfully tested using spi_write_then_read.

Moreover this change fixes handling messages with two writing transfers.
It's important for SPI flash devices as their drivers commonly use one
transfer for a command and another one for data.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-bcm53xx.c