Lines Matching +full:spi +full:- +full:slave

2  * Chromium OS cros_ec driver - SPI interface
6 * SPDX-License-Identifier: GPL-2.0+
20 #include <spi.h>
27 struct spi_slave *slave = dev_get_parent_priv(dev->dev); in cros_ec_spi_packet() local
33 if (spi_claim_bus(slave)) { in cros_ec_spi_packet()
34 debug("%s: Cannot claim SPI bus\n", __func__); in cros_ec_spi_packet()
35 return -1; in cros_ec_spi_packet()
38 rv = spi_xfer(slave, out_bytes * 8, dev->dout, NULL, SPI_XFER_BEGIN); in cros_ec_spi_packet()
43 rv = spi_xfer(slave, 8, NULL, &byte, 0); in cros_ec_spi_packet()
49 rv = -ETIMEDOUT; in cros_ec_spi_packet()
54 rv = spi_xfer(slave, in_bytes * 8, NULL, dev->din, 0); in cros_ec_spi_packet()
56 spi_xfer(slave, 0, NULL, NULL, SPI_XFER_END); in cros_ec_spi_packet()
57 spi_release_bus(slave); in cros_ec_spi_packet()
60 debug("%s: Cannot complete SPI transfer\n", __func__); in cros_ec_spi_packet()
61 return -1; in cros_ec_spi_packet()
80 * @return number of bytes in response, or -1 on error
87 struct spi_slave *slave = dev_get_parent_priv(dev->dev); in cros_ec_spi_command() local
94 if (dev->protocol_version != 2) { in cros_ec_spi_command()
96 __func__, dev->protocol_version); in cros_ec_spi_command()
97 return -1; in cros_ec_spi_command()
101 * Sanity-check input size to make sure it plus transaction overhead in cros_ec_spi_command()
104 if (in_bytes > sizeof(dev->din)) { in cros_ec_spi_command()
106 return -1; in cros_ec_spi_command()
112 return -1; in cros_ec_spi_command()
118 memset(dev->din, '\0', in_bytes); in cros_ec_spi_command()
120 if (spi_claim_bus(slave)) { in cros_ec_spi_command()
121 debug("%s: Cannot claim SPI bus\n", __func__); in cros_ec_spi_command()
122 return -1; in cros_ec_spi_command()
125 out = dev->dout; in cros_ec_spi_command()
138 p = dev->din + sizeof(int64_t) - 2; in cros_ec_spi_command()
141 rv = spi_xfer(slave, max(len, in_bytes) * 8, out, p, in cros_ec_spi_command()
144 spi_release_bus(slave); in cros_ec_spi_command()
147 debug("%s: Cannot complete SPI transfer\n", __func__); in cros_ec_spi_command()
148 return -1; in cros_ec_spi_command()
152 cros_ec_dump_data("in", -1, p, len + 3); in cros_ec_spi_command()
157 return -(int)(p[0]); in cros_ec_spi_command()
165 return -1; in cros_ec_spi_command()
185 { .compatible = "google,cros-ec-spi" },