spi: atmel: add support for the internal chip-select of the spi controller
commit4820303480a18773f30e2c5ad1178d5960facdbf
authorCyrille Pitchen <cyrille.pitchen@atmel.com>
Tue, 9 Jun 2015 11:53:52 +0000 (9 13:53 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 9 Jun 2015 17:25:53 +0000 (9 18:25 +0100)
tree0ddc4f313c7bbaa3a0f7430468e75e8faaaa37db
parentb787f68c36d49bb1d9236f403813641efa74a031
spi: atmel: add support for the internal chip-select of the spi controller

This patch relies on the CSAAT (Chip Select Active After Transfer) feature
introduced by the version 2 of the spi controller. This new mode allows to
use properly the internal chip-select output pin of the spi controller
instead of using external gpios. Consequently, the "cs-gpios" device-tree
property becomes optional.

When the new CSAAT bit is set into the Chip Select Register, the internal
chip-select output pin remains asserted till both the following conditions
become true:
- the LASTXFER bit is set into the Control Register (or the Transmit Data
  Register)
- the Transmit Data Register and its shift register are empty.

WARNING: if the LASTXFER bit is set into the Control Register then new
data are written into the Transmit Data Register fast enough to keep its
shifter not empty, the chip-select output pin remains asserted. Only when
the shifter becomes empty, the chip-select output pin is unasserted.

When the CSAAT bit is clear in the Chip Select Register, the LASTXFER bit
is ignored in both the Control Register and the Transmit Data Register.
The internal chip-select output pin remains active as long as the Transmit
Data Register or its shift register are not empty.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-atmel.c