OSDN Git Service

spi: spi-mem: fallback to using transfers when CS gpios are used
authorChris Packham <chris.packham@alliedtelesis.co.nz>
Thu, 7 Nov 2019 04:42:35 +0000 (17:42 +1300)
committerMark Brown <broonie@kernel.org>
Thu, 7 Nov 2019 13:11:18 +0000 (13:11 +0000)
Devices with chip selects driven via GPIO are not compatible with the
spi-mem operations. Fallback to using standard spi transfers when the
device is connected with a gpio CS.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20191107044235.4864-3-chris.packham@alliedtelesis.co.nz
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-mem.c

index 9f0fa9f..e5a46f0 100644 (file)
@@ -286,7 +286,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
        if (!spi_mem_internal_supports_op(mem, op))
                return -ENOTSUPP;
 
-       if (ctlr->mem_ops) {
+       if (ctlr->mem_ops && !mem->spi->cs_gpiod) {
                ret = spi_mem_access_start(mem);
                if (ret)
                        return ret;