]> www.infradead.org Git - users/jedix/linux-maple.git/commit
spi: bcm2835: set up spi-mode before asserting cs-gpio
authorMartin Sperl <kernel@martin.sperl.org>
Tue, 28 Jul 2015 14:03:12 +0000 (14:03 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Sep 2015 17:05:34 +0000 (10:05 -0700)
commit7f3f69a695fe2d10a9afad4419c68d731f775b94
treed41932543818f455d9e786795b7ba2dddc0fcd3d
parenta1ff8fe3a5387ac0c33b2a4677690e322bec8c04
spi: bcm2835: set up spi-mode before asserting cs-gpio

commit acace73df2c1913a526c1b41e4741a4a6704c863 upstream.

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 did not show when using native-CS, as the same register
is used to control cs as well as polarity, so the changes came
into effect at the same time. Unfortunately this is not true
with gpio-cs.

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.

Also fixes resetting 3-wire mode after use of rx-mode, so that
a 3-Wire sequence TX, RX, TX works as well (right now it runs
TX, RX, RX instead)

Reported-by: Noralf Tronnes <noralf@tronnes.org>
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi-bcm2835.c