]> git.baikalelectronics.ru Git - kernel.git/commit
mfd: cros ec: Lock the SPI bus while holding chipselect
authorNicolas Boichat <drinkcat@chromium.org>
Wed, 25 Nov 2015 05:51:07 +0000 (13:51 +0800)
committerLee Jones <lee.jones@linaro.org>
Mon, 11 Jan 2016 06:07:51 +0000 (06:07 +0000)
commit98a7be3f5f308ac8ebb1b64c53191141038d0bfb
treef8ee3aeb287378449363c39526e13cfa51264e02
parentf171d4ede124a079faa01099d6775c06f61128d7
mfd: cros ec: Lock the SPI bus while holding chipselect

cros_ec_cmd_xfer_spi and cros_ec_pkt_xfer_spi generally work like
this:
 - Pull CS down (active), wait a bit, then send a command
 - Wait for response (multiple requests)
 - Wait a while, pull CS up (inactive)

These operations, individually, lock the SPI bus, but there is
nothing preventing the SPI framework from interleaving messages
intended for other devices as the bus is unlocked in between.

This is a problem as the EC expects CS to be held low for the
whole duration.

Solution: Lock the SPI bus during the whole transaction, to make
sure that no other messages can be interleaved.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/cros_ec_spi.c