@@ -1927,6 +1927,13 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
}
}
+ /* Device DTR mode. */
+ if (of_property_read_bool(nc, "spi-tx-dtr"))
+ spi->mode |= SPI_TX_DTR;
+
+ if (of_property_read_bool(nc, "spi-rx-dtr"))
+ spi->mode |= SPI_RX_DTR;
+
if (spi_controller_is_slave(ctlr)) {
if (!of_node_name_eq(nc, "slave")) {
dev_err(&ctlr->dev, "%pOF is not called 'slave'\n",
@@ -3252,7 +3259,8 @@ int spi_setup(struct spi_device *spi)
bad_bits &= ~SPI_CS_HIGH;
ugly_bits = bad_bits &
(SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL |
- SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL);
+ SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL |
+ SPI_TX_DTR | SPI_RX_DTR);
if (ugly_bits) {
dev_warn(&spi->dev,
"setup: ignoring unsupported mode bits %x\n",
@@ -183,6 +183,8 @@ struct spi_device {
#define SPI_TX_OCTAL 0x2000 /* transmit with 8 wires */
#define SPI_RX_OCTAL 0x4000 /* receive with 8 wires */
#define SPI_3WIRE_HIZ 0x8000 /* high impedance turnaround */
+#define SPI_RX_DTR 0x10000 /* receive in DTR mode */
+#define SPI_TX_DTR 0x20000 /* transmit in DTR mode */
int irq;
void *controller_state;
void *controller_data;
These two DT properties express DTR receive and transmit capabilities of a SPI flash and controller. Introduce two new mode bits: SPI_RX_DTR and SPI_TX_DTR which correspond to the new DT properties. Set these bits when the two corresponding properties are present in the device tree. Also update the detection of unsupported mode bits to include the new bits. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> --- drivers/spi/spi.c | 10 +++++++++- include/linux/spi/spi.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-)