svn commit: r298268 - head/sys/dev/spibus
Ruslan Bukin
br at FreeBSD.org
Tue Apr 19 14:18:13 UTC 2016
Author: br
Date: Tue Apr 19 14:18:12 2016
New Revision: 298268
URL: https://svnweb.freebsd.org/changeset/base/298268
Log:
Add optional chip_select/deselect methods. This is required
when we want to keep CS asserted for multiple transfers.
Modified:
head/sys/dev/spibus/spibus.c
head/sys/dev/spibus/spibus_if.m
Modified: head/sys/dev/spibus/spibus.c
==============================================================================
--- head/sys/dev/spibus/spibus.c Tue Apr 19 13:36:31 2016 (r298267)
+++ head/sys/dev/spibus/spibus.c Tue Apr 19 14:18:12 2016 (r298268)
@@ -185,9 +185,24 @@ spibus_hinted_child(device_t bus, const
static int
spibus_transfer_impl(device_t dev, device_t child, struct spi_command *cmd)
{
+
return (SPIBUS_TRANSFER(device_get_parent(dev), child, cmd));
}
+static int
+spibus_chip_select_impl(device_t dev, device_t child)
+{
+
+ return (SPIBUS_CHIP_SELECT(device_get_parent(dev), child));
+}
+
+static int
+spibus_chip_deselect_impl(device_t dev, device_t child)
+{
+
+ return (SPIBUS_CHIP_DESELECT(device_get_parent(dev), child));
+}
+
static device_method_t spibus_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, spibus_probe),
@@ -208,6 +223,8 @@ static device_method_t spibus_methods[]
/* spibus interface */
DEVMETHOD(spibus_transfer, spibus_transfer_impl),
+ DEVMETHOD(spibus_chip_select, spibus_chip_select_impl),
+ DEVMETHOD(spibus_chip_deselect, spibus_chip_deselect_impl),
DEVMETHOD_END
};
Modified: head/sys/dev/spibus/spibus_if.m
==============================================================================
--- head/sys/dev/spibus/spibus_if.m Tue Apr 19 13:36:31 2016 (r298267)
+++ head/sys/dev/spibus/spibus_if.m Tue Apr 19 14:18:12 2016 (r298268)
@@ -39,3 +39,19 @@ METHOD int transfer {
device_t child;
struct spi_command *cmd;
};
+
+#
+# Assert chip select
+#
+METHOD int chip_select {
+ device_t dev;
+ device_t child;
+};
+
+#
+# Deassert chip select
+#
+METHOD int chip_deselect {
+ device_t dev;
+ device_t child;
+};
More information about the svn-src-head
mailing list