spi: mvebu_a3700_spi: add support for cs-gpios
authorGeorge Hilliard <ghilliar@amazon.com>
Wed, 30 Sep 2020 14:28:21 +0000 (09:28 -0500)
committerStefan Roese <sr@denx.de>
Wed, 14 Oct 2020 05:55:56 +0000 (07:55 +0200)
commit2df286390a8009238ab9ccf5694ac088f3f90da3
tree98fdd96ea2feeb61751c3105c22d3c6c70e84d28
parent87c220d0419a6073bd20184cbb81e15214affda0
spi: mvebu_a3700_spi: add support for cs-gpios

The device tree has a way to specify GPIO lines as chip selects.  From
the binding docs:

    So if for example the controller has 2 CS lines, and the cs-gpios
    property looks like this:

    cs-gpios = <&gpio1 0 0> <0> <&gpio1 1 0> <&gpio1 2 0>;

    Then it should be configured so that num_chipselect = 4 with the
    following mapping:

    cs0 : &gpio1 0 0
    cs1 : native
    cs2 : &gpio1 1 0
    cs3 : &gpio1 2 0

Add support for this, while retaining backward-compatibility with
existing device trees; the driver will preserve existing behavior if a
cs-gpios list is not given, or if a particular line is specified as <0>
(native).

This implementation is inspired by similar implementations in
neighboring drivers for other platforms: atmega, mxc, etc.

Signed-off-by: George Hilliard <ghilliar@amazon.com>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/spi/mvebu_a3700_spi.c