soc{broadcom,imgtec,mediatek,qualcomm}: stop using spi_xfer_two_vectors

On a second look broadcom/cygnus and imgtec/pistachio appear to
support full duplex. Therefore, remove the use of spi_xfer_two_vectors().

For mediatek/mt8173 and qualcomm/ipq40xx, the driver is written in such
a way that it does not support full duplex. Remove the use of
spi_xfer_two_vectors() and explicitly error out when a full duplex
transaction is requested.

Change-Id: I8689bc9bb2b27563d25e9f165487d38881c0b059
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/25742
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Aaron Durbin 2018-04-19 16:58:13 -06:00 committed by Patrick Georgi
parent 2a466cc283
commit 9a1bb36137
4 changed files with 8 additions and 4 deletions

View File

@ -313,7 +313,6 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus, .claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus, .release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer, .xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
.max_xfer_size = 65535, .max_xfer_size = 65535,
}; };

View File

@ -572,7 +572,6 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus, .claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus, .release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer, .xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
.max_xfer_size = IMGTEC_SPI_MAX_TRANSFER_SIZE, .max_xfer_size = IMGTEC_SPI_MAX_TRANSFER_SIZE,
}; };

View File

@ -253,6 +253,10 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t min_size = 0; size_t min_size = 0;
int ret; int ret;
/* Driver implementation does not support full duplex. */
if (bytes_in && bytes_out)
return -1;
while (bytes_out || bytes_in) { while (bytes_out || bytes_in) {
if (bytes_in && bytes_out) if (bytes_in && bytes_out)
min_size = MIN(MIN(bytes_out, bytes_in), MTK_FIFO_DEPTH); min_size = MIN(MIN(bytes_out, bytes_in), MTK_FIFO_DEPTH);
@ -307,7 +311,6 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus, .claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus, .release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer, .xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
.max_xfer_size = 65535, .max_xfer_size = 65535,
}; };

View File

@ -611,6 +611,10 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
u8 *rxp = (u8 *)din; u8 *rxp = (u8 *)din;
int ret; int ret;
/* Driver implementation does not support full duplex. */
if (dout && din)
return -1;
ret = config_spi_state(ds, QUP_STATE_RESET); ret = config_spi_state(ds, QUP_STATE_RESET);
if (ret != SUCCESS) if (ret != SUCCESS)
return ret; return ret;
@ -687,7 +691,6 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus, .claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus, .release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer, .xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
.max_xfer_size = MAX_PACKET_COUNT, .max_xfer_size = MAX_PACKET_COUNT,
}; };