[rtems commit] cpukit/spi: Allow driver specific ioctl
Christian Mauderer
christianm at rtems.org
Thu Jan 21 09:26:34 UTC 2021
Module: rtems
Branch: master
Commit: b2f265ab9f54bf8b53c198bc6d370bc672119b7a
Changeset: http://git.rtems.org/rtems/commit/?id=b2f265ab9f54bf8b53c198bc6d370bc672119b7a
Author: Christian Mauderer <christian.mauderer at embedded-brains.de>
Date: Mon Dec 14 14:10:24 2020 +0100
cpukit/spi: Allow driver specific ioctl
This allows a SPI driver to add a hardware specific ioctl.
---
cpukit/dev/spi/spi-bus.c | 3 +++
cpukit/include/dev/spi/spi.h | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/cpukit/dev/spi/spi-bus.c b/cpukit/dev/spi/spi-bus.c
index 5308603..42b70aa 100644
--- a/cpukit/dev/spi/spi-bus.c
+++ b/cpukit/dev/spi/spi-bus.c
@@ -199,6 +199,8 @@ static int spi_bus_ioctl(
arg,
IOCPARM_LEN(command) / sizeof(struct spi_ioc_transfer)
);
+ } else if (bus->ioctl != NULL) {
+ err = (*bus->ioctl)(bus, command, arg);
} else {
err = -EINVAL;
}
@@ -300,6 +302,7 @@ static int spi_bus_do_init(
bus->transfer = spi_bus_transfer_default;
bus->setup = spi_bus_setup_default;
bus->destroy = destroy;
+ bus->ioctl = NULL;
bus->bits_per_word = 8;
return 0;
diff --git a/cpukit/include/dev/spi/spi.h b/cpukit/include/dev/spi/spi.h
index dfe9cf5..8850b28 100644
--- a/cpukit/include/dev/spi/spi.h
+++ b/cpukit/include/dev/spi/spi.h
@@ -141,6 +141,13 @@ struct spi_bus {
* devices.
*/
uint16_t delay_usecs;
+
+ /**
+ * @brief Driver specific ioctl.
+ *
+ * @param[in] bus The bus control.
+ */
+ int (*ioctl)(spi_bus *bus, ioctl_command_t command, void *arg);
};
/**
More information about the vc
mailing list