spi: bcm2835aux: set up spi-mode before asserting cs-gpio
authorStephan Olbrich <stephanolbrich@gmx.de>
Sun, 14 Feb 2016 10:04:28 +0000 (11:04 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 15 Feb 2016 20:45:19 +0000 (20:45 +0000)
commitb4e2adef62062cf716d1c81adc12ad6def516f72
treec18a2f0cfccffb6f23757cb9552e9d4e9fe60d54
parentf29ab1845f3e2684ba1c6de6c3bd5198e4b1459c
spi: bcm2835aux: set up spi-mode before asserting cs-gpio

When using reverse polarity for clock (spi-cpol) on a device
the clock line gets altered after chip-select has been asserted
resulting in an additional clock beat, which confuses hardware.

This happens due to the fact, the the hardware was initialized
and reset at the begin and end of each transfer which results
in default state for all lines except chip-select which is
handled by the spi-subsystem as gpio-cs is used.

To avoid this situation this patch moves the setup of polarity
(spi-cpol and spi-cpha) outside of the chip-select into
prepare_message, which is run prior to asserting chip-select.

Signed-off-by: Stephan Olbrich <stephanolbrich@gmx.de>
Reviewed-by: Martin Sperl <kernel@martin.sperl.org>
Tested-by: Martin Sperl <kernel@martin.sperl.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-bcm2835aux.c