spi: s3c64xx: Revert "spi: s3c64xx: Added provision for dedicated cs pin"
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Wed, 16 Jul 2014 15:19:07 +0000 (17:19 +0200)
committerMark Brown <broonie@linaro.org>
Thu, 17 Jul 2014 18:37:41 +0000 (19:37 +0100)
commite2689b946a42acaad9ba94bf3a0bf4caa6509b9e
tree2b2af8e08ea2150a4e5e92cdcba00ea0e6170768
parent7171511eaec5bf23fb06078f59784a3a0626b38f
spi: s3c64xx: Revert "spi: s3c64xx: Added provision for dedicated cs pin"

This reverts commit 3146beec21b64f4551fcf0ac148381d54dc41b1b.

This commit resulted in a DT backward compatibility breakage.

Some devices use the native chip select (CS) instead of a GPIO
pin to drive the CS line. But the SPI driver made it mandatory
to specify a GPIO pin in the SPI device node controller-data.
So, using the built-in CS was not possible with the driver.

Commit 3146bee tried to fix that by adding a "cs-gpio" property
which could be defined in the SPI device node to make the driver
request the GPIO from the controller-data node.

Unfortunately that changed the old DT binding semantics since
now it's mandatory to have the "cs-gpio" property defined in
the SPI device node in order to use a GPIO pin to drive the CS.

As an example, a SPI device was defined before the commit with:

spi@12d20000 {
    slave-node@0 {
        controller-data {
             cs-gpio = <&gpb1 2 0>;
        }
   }
}

and after the commit, the following DTS snippet must be used:

spi@12d20000 {
    cs-gpio;
    slave-node@0 {
        controller-data {
             cs-gpio = <&gpb1 2 0>;
        }
   }
}

So, after commit 3146bee the driver does not look for the GPIO
by default and it only looks for it if the top level "cs-gpio"
property is defined while the default used to be the opposite.
To always request the GPIO defined in the controller-data node.

This means that old FDT that of course didn't have this added
"cs-gpio" DT property in the SPI node broke after this change.

The offending commit can't be reverted cleanly since more than
a year have passed and other changes were made in the meantime
but this patch partially reverts the driver to it's original
state so old FDT can work again.

This patch will break Device Trees that were relying on the new
behavior of course but the patch should be reverted because:

a) There aren't DTS in mainline that use this new property.
b) They were relying on a behavior that broke DT compatibility.
c) The new binding is awkard, needing two properties with the
   same name (cs-gpio) on different nodes is confusing at least.
d) The new property was not added to the DT binding doc:
   Documentation/devicetree/bindings/spi/spi-samsung.txt

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-s3c64xx.c