sdm845: qspi: Add Dual SPI support
This patch adds support for the Dual SPI feature (SDR 2-bit in Qualcomm terminology) to the QSPI controller. Change-Id: I7aed2ccd9627f5de5dd760b418f74d56d2c031d3 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/33284 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
99e45ceb35
commit
127a55e91d
|
@ -116,4 +116,6 @@ int sdm845_setup_bus(const struct spi_slave *slave);
|
||||||
void sdm845_release_bus(const struct spi_slave *slave);
|
void sdm845_release_bus(const struct spi_slave *slave);
|
||||||
int sdm845_xfer(const struct spi_slave *slave, const void *dout,
|
int sdm845_xfer(const struct spi_slave *slave, const void *dout,
|
||||||
size_t out_bytes, void *din, size_t in_bytes);
|
size_t out_bytes, void *din, size_t in_bytes);
|
||||||
|
int sdm845_xfer_dual(const struct spi_slave *slave, const void *dout,
|
||||||
|
size_t out_bytes, void *din, size_t in_bytes);
|
||||||
#endif /* __SOC_QUALCOMM_SDM845_QSPI_H__ */
|
#endif /* __SOC_QUALCOMM_SDM845_QSPI_H__ */
|
||||||
|
|
|
@ -277,11 +277,9 @@ void sdm845_release_bus(const struct spi_slave *slave)
|
||||||
cs_change(CS_DEASSERT);
|
cs_change(CS_DEASSERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sdm845_xfer(const struct spi_slave *slave, const void *dout,
|
static int xfer(enum qspi_mode mode, const void *dout, size_t out_bytes,
|
||||||
size_t out_bytes, void *din, size_t in_bytes)
|
void *din, size_t in_bytes)
|
||||||
{
|
{
|
||||||
enum qspi_mode mode = SDR_1BIT;
|
|
||||||
|
|
||||||
if ((out_bytes && !dout) || (in_bytes && !din) ||
|
if ((out_bytes && !dout) || (in_bytes && !din) ||
|
||||||
(in_bytes && out_bytes)) {
|
(in_bytes && out_bytes)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -294,3 +292,15 @@ int sdm845_xfer(const struct spi_slave *slave, const void *dout,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sdm845_xfer(const struct spi_slave *slave, const void *dout,
|
||||||
|
size_t out_bytes, void *din, size_t in_bytes)
|
||||||
|
{
|
||||||
|
return xfer(SDR_1BIT, dout, out_bytes, din, in_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
int sdm845_xfer_dual(const struct spi_slave *slave, const void *dout,
|
||||||
|
size_t out_bytes, void *din, size_t in_bytes)
|
||||||
|
{
|
||||||
|
return xfer(SDR_2BIT, dout, out_bytes, din, in_bytes);
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ static const struct spi_ctrlr spi_ctrlr = {
|
||||||
.claim_bus = sdm845_claim_bus,
|
.claim_bus = sdm845_claim_bus,
|
||||||
.release_bus = sdm845_release_bus,
|
.release_bus = sdm845_release_bus,
|
||||||
.xfer = sdm845_xfer,
|
.xfer = sdm845_xfer,
|
||||||
|
.xfer_dual = sdm845_xfer_dual,
|
||||||
.max_xfer_size = QSPI_MAX_PACKET_COUNT,
|
.max_xfer_size = QSPI_MAX_PACKET_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue