Merge remote-tracking branch 'spi/topic/master' into spi-next
This commit is contained in:
commit
9d540b0d49
|
@ -1,17 +1,23 @@
|
|||
SPI (Serial Peripheral Interface) busses
|
||||
|
||||
SPI busses can be described with a node for the SPI master device
|
||||
and a set of child nodes for each SPI slave on the bus. For this
|
||||
discussion, it is assumed that the system's SPI controller is in
|
||||
SPI master mode. This binding does not describe SPI controllers
|
||||
in slave mode.
|
||||
SPI busses can be described with a node for the SPI controller device
|
||||
and a set of child nodes for each SPI slave on the bus. The system's SPI
|
||||
controller may be described for use in SPI master mode or in SPI slave mode,
|
||||
but not for both at the same time.
|
||||
|
||||
The SPI master node requires the following properties:
|
||||
The SPI controller node requires the following properties:
|
||||
- compatible - Name of SPI bus controller following generic names
|
||||
recommended practice.
|
||||
|
||||
In master mode, the SPI controller node requires the following additional
|
||||
properties:
|
||||
- #address-cells - number of cells required to define a chip select
|
||||
address on the SPI bus.
|
||||
- #size-cells - should be zero.
|
||||
- compatible - name of SPI bus controller following generic names
|
||||
recommended practice.
|
||||
|
||||
In slave mode, the SPI controller node requires one additional property:
|
||||
- spi-slave - Empty property.
|
||||
|
||||
No other properties are required in the SPI bus node. It is assumed
|
||||
that a driver for an SPI bus device will understand that it is an SPI bus.
|
||||
However, the binding does not attempt to define the specific method for
|
||||
|
@ -21,7 +27,7 @@ assumption that board specific platform code will be used to manage
|
|||
chip selects. Individual drivers can define additional properties to
|
||||
support describing the chip select layout.
|
||||
|
||||
Optional properties:
|
||||
Optional properties (master mode only):
|
||||
- cs-gpios - gpios chip select.
|
||||
- num-cs - total number of chipselects.
|
||||
|
||||
|
@ -41,28 +47,36 @@ cs1 : native
|
|||
cs2 : &gpio1 1 0
|
||||
cs3 : &gpio1 2 0
|
||||
|
||||
SPI slave nodes must be children of the SPI master node and can
|
||||
contain the following properties.
|
||||
- reg - (required) chip select address of device.
|
||||
- compatible - (required) name of SPI device following generic names
|
||||
recommended practice.
|
||||
- spi-max-frequency - (required) Maximum SPI clocking speed of device in Hz.
|
||||
- spi-cpol - (optional) Empty property indicating device requires
|
||||
inverse clock polarity (CPOL) mode.
|
||||
- spi-cpha - (optional) Empty property indicating device requires
|
||||
shifted clock phase (CPHA) mode.
|
||||
- spi-cs-high - (optional) Empty property indicating device requires
|
||||
chip select active high.
|
||||
- spi-3wire - (optional) Empty property indicating device requires
|
||||
3-wire mode.
|
||||
- spi-lsb-first - (optional) Empty property indicating device requires
|
||||
LSB first mode.
|
||||
- spi-tx-bus-width - (optional) The bus width (number of data wires) that is
|
||||
used for MOSI. Defaults to 1 if not present.
|
||||
- spi-rx-bus-width - (optional) The bus width (number of data wires) that is
|
||||
used for MISO. Defaults to 1 if not present.
|
||||
- spi-rx-delay-us - (optional) Microsecond delay after a read transfer.
|
||||
- spi-tx-delay-us - (optional) Microsecond delay after a write transfer.
|
||||
|
||||
SPI slave nodes must be children of the SPI controller node.
|
||||
|
||||
In master mode, one or more slave nodes (up to the number of chip selects) can
|
||||
be present. Required properties are:
|
||||
- compatible - Name of SPI device following generic names recommended
|
||||
practice.
|
||||
- reg - Chip select address of device.
|
||||
- spi-max-frequency - Maximum SPI clocking speed of device in Hz.
|
||||
|
||||
In slave mode, the (single) slave node is optional.
|
||||
If present, it must be called "slave". Required properties are:
|
||||
- compatible - Name of SPI device following generic names recommended
|
||||
practice.
|
||||
|
||||
All slave nodes can contain the following optional properties:
|
||||
- spi-cpol - Empty property indicating device requires inverse clock
|
||||
polarity (CPOL) mode.
|
||||
- spi-cpha - Empty property indicating device requires shifted clock
|
||||
phase (CPHA) mode.
|
||||
- spi-cs-high - Empty property indicating device requires chip select
|
||||
active high.
|
||||
- spi-3wire - Empty property indicating device requires 3-wire mode.
|
||||
- spi-lsb-first - Empty property indicating device requires LSB first mode.
|
||||
- spi-tx-bus-width - The bus width (number of data wires) that is used for MOSI.
|
||||
Defaults to 1 if not present.
|
||||
- spi-rx-bus-width - The bus width (number of data wires) that is used for MISO.
|
||||
Defaults to 1 if not present.
|
||||
- spi-rx-delay-us - Microsecond delay after a read transfer.
|
||||
- spi-tx-delay-us - Microsecond delay after a write transfer.
|
||||
|
||||
Some SPI controllers and devices support Dual and Quad SPI transfer mode.
|
||||
It allows data in the SPI system to be transferred using 2 wires (DUAL) or 4
|
||||
|
|
|
@ -62,8 +62,8 @@ chips described as using "three wire" signaling: SCK, data, nCSx.
|
|||
(That data line is sometimes called MOMI or SISO.)
|
||||
|
||||
Microcontrollers often support both master and slave sides of the SPI
|
||||
protocol. This document (and Linux) currently only supports the master
|
||||
side of SPI interactions.
|
||||
protocol. This document (and Linux) supports both the master and slave
|
||||
sides of SPI interactions.
|
||||
|
||||
|
||||
Who uses it? On what kinds of systems?
|
||||
|
@ -154,9 +154,8 @@ control audio interfaces, present touchscreen sensors as input interfaces,
|
|||
or monitor temperature and voltage levels during industrial processing.
|
||||
And those might all be sharing the same controller driver.
|
||||
|
||||
A "struct spi_device" encapsulates the master-side interface between
|
||||
those two types of driver. At this writing, Linux has no slave side
|
||||
programming interface.
|
||||
A "struct spi_device" encapsulates the controller-side interface between
|
||||
those two types of drivers.
|
||||
|
||||
There is a minimal core of SPI programming interfaces, focussing on
|
||||
using the driver model to connect controller and protocol drivers using
|
||||
|
@ -177,10 +176,24 @@ shows up in sysfs in several locations:
|
|||
/sys/bus/spi/drivers/D ... driver for one or more spi*.* devices
|
||||
|
||||
/sys/class/spi_master/spiB ... symlink (or actual device node) to
|
||||
a logical node which could hold class related state for the
|
||||
controller managing bus "B". All spiB.* devices share one
|
||||
a logical node which could hold class related state for the SPI
|
||||
master controller managing bus "B". All spiB.* devices share one
|
||||
physical SPI bus segment, with SCLK, MOSI, and MISO.
|
||||
|
||||
/sys/devices/.../CTLR/slave ... virtual file for (un)registering the
|
||||
slave device for an SPI slave controller.
|
||||
Writing the driver name of an SPI slave handler to this file
|
||||
registers the slave device; writing "(null)" unregisters the slave
|
||||
device.
|
||||
Reading from this file shows the name of the slave device ("(null)"
|
||||
if not registered).
|
||||
|
||||
/sys/class/spi_slave/spiB ... symlink (or actual device node) to
|
||||
a logical node which could hold class related state for the SPI
|
||||
slave controller on bus "B". When registered, a single spiB.*
|
||||
device is present here, possible sharing the physical SPI bus
|
||||
segment with other SPI slave devices.
|
||||
|
||||
Note that the actual location of the controller's class state depends
|
||||
on whether you enabled CONFIG_SYSFS_DEPRECATED or not. At this time,
|
||||
the only class-specific state is the bus number ("B" in "spiB"), so
|
||||
|
|
|
@ -785,6 +785,30 @@ config SPI_TLE62X0
|
|||
|
||||
endif # SPI_MASTER
|
||||
|
||||
# (slave support would go here)
|
||||
#
|
||||
# SLAVE side ... listening to other SPI masters
|
||||
#
|
||||
|
||||
config SPI_SLAVE
|
||||
bool "SPI slave protocol handlers"
|
||||
help
|
||||
If your system has a slave-capable SPI controller, you can enable
|
||||
slave protocol handlers.
|
||||
|
||||
if SPI_SLAVE
|
||||
|
||||
config SPI_SLAVE_TIME
|
||||
tristate "SPI slave handler reporting boot up time"
|
||||
help
|
||||
SPI slave handler responding with the time of reception of the last
|
||||
SPI message.
|
||||
|
||||
config SPI_SLAVE_SYSTEM_CONTROL
|
||||
tristate "SPI slave handler controlling system state"
|
||||
help
|
||||
SPI slave handler to allow remote control of system reboot, power
|
||||
off, halt, and suspend.
|
||||
|
||||
endif # SPI_SLAVE
|
||||
|
||||
endif # SPI
|
||||
|
|
|
@ -105,3 +105,7 @@ obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o
|
|||
obj-$(CONFIG_SPI_XLP) += spi-xlp.o
|
||||
obj-$(CONFIG_SPI_XTENSA_XTFPGA) += spi-xtensa-xtfpga.o
|
||||
obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o
|
||||
|
||||
# SPI slave protocol handlers
|
||||
obj-$(CONFIG_SPI_SLAVE_TIME) += spi-slave-time.o
|
||||
obj-$(CONFIG_SPI_SLAVE_SYSTEM_CONTROL) += spi-slave-system-control.o
|
||||
|
|
154
drivers/spi/spi-slave-system-control.c
Normal file
154
drivers/spi/spi-slave-system-control.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* SPI slave handler controlling system state
|
||||
*
|
||||
* This SPI slave handler allows remote control of system reboot, power off,
|
||||
* halt, and suspend.
|
||||
*
|
||||
* Copyright (C) 2016-2017 Glider bvba
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
|
||||
* system):
|
||||
*
|
||||
* # reboot='\x7c\x50'
|
||||
* # poweroff='\x71\x3f'
|
||||
* # halt='\x38\x76'
|
||||
* # suspend='\x1b\x1b'
|
||||
* # spidev_test -D /dev/spidev2.0 -p $suspend # or $reboot, $poweroff, $halt
|
||||
*/
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
/*
|
||||
* The numbers are chosen to display something human-readable on two 7-segment
|
||||
* displays connected to two 74HC595 shift registers
|
||||
*/
|
||||
#define CMD_REBOOT 0x7c50 /* rb */
|
||||
#define CMD_POWEROFF 0x713f /* OF */
|
||||
#define CMD_HALT 0x3876 /* HL */
|
||||
#define CMD_SUSPEND 0x1b1b /* ZZ */
|
||||
|
||||
struct spi_slave_system_control_priv {
|
||||
struct spi_device *spi;
|
||||
struct completion finished;
|
||||
struct spi_transfer xfer;
|
||||
struct spi_message msg;
|
||||
__be16 cmd;
|
||||
};
|
||||
|
||||
static
|
||||
int spi_slave_system_control_submit(struct spi_slave_system_control_priv *priv);
|
||||
|
||||
static void spi_slave_system_control_complete(void *arg)
|
||||
{
|
||||
struct spi_slave_system_control_priv *priv = arg;
|
||||
u16 cmd;
|
||||
int ret;
|
||||
|
||||
if (priv->msg.status)
|
||||
goto terminate;
|
||||
|
||||
cmd = be16_to_cpu(priv->cmd);
|
||||
switch (cmd) {
|
||||
case CMD_REBOOT:
|
||||
dev_info(&priv->spi->dev, "Rebooting system...\n");
|
||||
kernel_restart(NULL);
|
||||
|
||||
case CMD_POWEROFF:
|
||||
dev_info(&priv->spi->dev, "Powering off system...\n");
|
||||
kernel_power_off();
|
||||
break;
|
||||
|
||||
case CMD_HALT:
|
||||
dev_info(&priv->spi->dev, "Halting system...\n");
|
||||
kernel_halt();
|
||||
break;
|
||||
|
||||
case CMD_SUSPEND:
|
||||
dev_info(&priv->spi->dev, "Suspending system...\n");
|
||||
pm_suspend(PM_SUSPEND_MEM);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_warn(&priv->spi->dev, "Unknown command 0x%x\n", cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = spi_slave_system_control_submit(priv);
|
||||
if (ret)
|
||||
goto terminate;
|
||||
|
||||
return;
|
||||
|
||||
terminate:
|
||||
dev_info(&priv->spi->dev, "Terminating\n");
|
||||
complete(&priv->finished);
|
||||
}
|
||||
|
||||
static
|
||||
int spi_slave_system_control_submit(struct spi_slave_system_control_priv *priv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
spi_message_init_with_transfers(&priv->msg, &priv->xfer, 1);
|
||||
|
||||
priv->msg.complete = spi_slave_system_control_complete;
|
||||
priv->msg.context = priv;
|
||||
|
||||
ret = spi_async(priv->spi, &priv->msg);
|
||||
if (ret)
|
||||
dev_err(&priv->spi->dev, "spi_async() failed %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int spi_slave_system_control_probe(struct spi_device *spi)
|
||||
{
|
||||
struct spi_slave_system_control_priv *priv;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->spi = spi;
|
||||
init_completion(&priv->finished);
|
||||
priv->xfer.rx_buf = &priv->cmd;
|
||||
priv->xfer.len = sizeof(priv->cmd);
|
||||
|
||||
ret = spi_slave_system_control_submit(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
spi_set_drvdata(spi, priv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_slave_system_control_remove(struct spi_device *spi)
|
||||
{
|
||||
struct spi_slave_system_control_priv *priv = spi_get_drvdata(spi);
|
||||
|
||||
spi_slave_abort(spi);
|
||||
wait_for_completion(&priv->finished);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct spi_driver spi_slave_system_control_driver = {
|
||||
.driver = {
|
||||
.name = "spi-slave-system-control",
|
||||
},
|
||||
.probe = spi_slave_system_control_probe,
|
||||
.remove = spi_slave_system_control_remove,
|
||||
};
|
||||
module_spi_driver(spi_slave_system_control_driver);
|
||||
|
||||
MODULE_AUTHOR("Geert Uytterhoeven <geert+renesas@glider.be>");
|
||||
MODULE_DESCRIPTION("SPI slave handler controlling system state");
|
||||
MODULE_LICENSE("GPL v2");
|
129
drivers/spi/spi-slave-time.c
Normal file
129
drivers/spi/spi-slave-time.c
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* SPI slave handler reporting uptime at reception of previous SPI message
|
||||
*
|
||||
* This SPI slave handler sends the time of reception of the last SPI message
|
||||
* as two 32-bit unsigned integers in binary format and in network byte order,
|
||||
* representing the number of seconds and fractional seconds (in microseconds)
|
||||
* since boot up.
|
||||
*
|
||||
* Copyright (C) 2016-2017 Glider bvba
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
|
||||
* system):
|
||||
*
|
||||
* # spidev_test -D /dev/spidev2.0 -p dummy-8B
|
||||
* spi mode: 0x0
|
||||
* bits per word: 8
|
||||
* max speed: 500000 Hz (500 KHz)
|
||||
* RX | 00 00 04 6D 00 09 5B BB ...
|
||||
* ^^^^^ ^^^^^^^^
|
||||
* seconds microseconds
|
||||
*/
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched/clock.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
|
||||
struct spi_slave_time_priv {
|
||||
struct spi_device *spi;
|
||||
struct completion finished;
|
||||
struct spi_transfer xfer;
|
||||
struct spi_message msg;
|
||||
__be32 buf[2];
|
||||
};
|
||||
|
||||
static int spi_slave_time_submit(struct spi_slave_time_priv *priv);
|
||||
|
||||
static void spi_slave_time_complete(void *arg)
|
||||
{
|
||||
struct spi_slave_time_priv *priv = arg;
|
||||
int ret;
|
||||
|
||||
ret = priv->msg.status;
|
||||
if (ret)
|
||||
goto terminate;
|
||||
|
||||
ret = spi_slave_time_submit(priv);
|
||||
if (ret)
|
||||
goto terminate;
|
||||
|
||||
return;
|
||||
|
||||
terminate:
|
||||
dev_info(&priv->spi->dev, "Terminating\n");
|
||||
complete(&priv->finished);
|
||||
}
|
||||
|
||||
static int spi_slave_time_submit(struct spi_slave_time_priv *priv)
|
||||
{
|
||||
u32 rem_us;
|
||||
int ret;
|
||||
u64 ts;
|
||||
|
||||
ts = local_clock();
|
||||
rem_us = do_div(ts, 1000000000) / 1000;
|
||||
|
||||
priv->buf[0] = cpu_to_be32(ts);
|
||||
priv->buf[1] = cpu_to_be32(rem_us);
|
||||
|
||||
spi_message_init_with_transfers(&priv->msg, &priv->xfer, 1);
|
||||
|
||||
priv->msg.complete = spi_slave_time_complete;
|
||||
priv->msg.context = priv;
|
||||
|
||||
ret = spi_async(priv->spi, &priv->msg);
|
||||
if (ret)
|
||||
dev_err(&priv->spi->dev, "spi_async() failed %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int spi_slave_time_probe(struct spi_device *spi)
|
||||
{
|
||||
struct spi_slave_time_priv *priv;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->spi = spi;
|
||||
init_completion(&priv->finished);
|
||||
priv->xfer.tx_buf = priv->buf;
|
||||
priv->xfer.len = sizeof(priv->buf);
|
||||
|
||||
ret = spi_slave_time_submit(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
spi_set_drvdata(spi, priv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_slave_time_remove(struct spi_device *spi)
|
||||
{
|
||||
struct spi_slave_time_priv *priv = spi_get_drvdata(spi);
|
||||
|
||||
spi_slave_abort(spi);
|
||||
wait_for_completion(&priv->finished);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct spi_driver spi_slave_time_driver = {
|
||||
.driver = {
|
||||
.name = "spi-slave-time",
|
||||
},
|
||||
.probe = spi_slave_time_probe,
|
||||
.remove = spi_slave_time_remove,
|
||||
};
|
||||
module_spi_driver(spi_slave_time_driver);
|
||||
|
||||
MODULE_AUTHOR("Geert Uytterhoeven <geert+renesas@glider.be>");
|
||||
MODULE_DESCRIPTION("SPI slave reporting uptime at previous SPI message");
|
||||
MODULE_LICENSE("GPL v2");
|
1214
drivers/spi/spi.c
1214
drivers/spi/spi.c
File diff suppressed because it is too large
Load diff
|
@ -24,13 +24,13 @@
|
|||
|
||||
struct dma_chan;
|
||||
struct property_entry;
|
||||
struct spi_master;
|
||||
struct spi_controller;
|
||||
struct spi_transfer;
|
||||
struct spi_flash_read_message;
|
||||
|
||||
/*
|
||||
* INTERFACES between SPI master-side drivers and SPI infrastructure.
|
||||
* (There's no SPI slave support for Linux yet...)
|
||||
* INTERFACES between SPI master-side drivers and SPI slave protocol handlers,
|
||||
* and SPI infrastructure.
|
||||
*/
|
||||
extern struct bus_type spi_bus_type;
|
||||
|
||||
|
@ -84,7 +84,7 @@ struct spi_statistics {
|
|||
|
||||
void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
|
||||
struct spi_transfer *xfer,
|
||||
struct spi_master *master);
|
||||
struct spi_controller *ctlr);
|
||||
|
||||
#define SPI_STATISTICS_ADD_TO_FIELD(stats, field, count) \
|
||||
do { \
|
||||
|
@ -98,13 +98,14 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
|
|||
SPI_STATISTICS_ADD_TO_FIELD(stats, field, 1)
|
||||
|
||||
/**
|
||||
* struct spi_device - Master side proxy for an SPI slave device
|
||||
* struct spi_device - Controller side proxy for an SPI slave device
|
||||
* @dev: Driver model representation of the device.
|
||||
* @master: SPI controller used with the device.
|
||||
* @controller: SPI controller used with the device.
|
||||
* @master: Copy of controller, for backwards compatibility.
|
||||
* @max_speed_hz: Maximum clock rate to be used with this chip
|
||||
* (on this board); may be changed by the device's driver.
|
||||
* The spi_transfer.speed_hz can override this for each transfer.
|
||||
* @chip_select: Chipselect, distinguishing chips handled by @master.
|
||||
* @chip_select: Chipselect, distinguishing chips handled by @controller.
|
||||
* @mode: The spi mode defines how data is clocked out and in.
|
||||
* This may be changed by the device's driver.
|
||||
* The "active low" default for chipselect mode can be overridden
|
||||
|
@ -140,7 +141,8 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
|
|||
*/
|
||||
struct spi_device {
|
||||
struct device dev;
|
||||
struct spi_master *master;
|
||||
struct spi_controller *controller;
|
||||
struct spi_controller *master; /* compatibility layer */
|
||||
u32 max_speed_hz;
|
||||
u8 chip_select;
|
||||
u8 bits_per_word;
|
||||
|
@ -198,7 +200,7 @@ static inline void spi_dev_put(struct spi_device *spi)
|
|||
put_device(&spi->dev);
|
||||
}
|
||||
|
||||
/* ctldata is for the bus_master driver's runtime state */
|
||||
/* ctldata is for the bus_controller driver's runtime state */
|
||||
static inline void *spi_get_ctldata(struct spi_device *spi)
|
||||
{
|
||||
return spi->controller_state;
|
||||
|
@ -292,9 +294,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
|||
spi_unregister_driver)
|
||||
|
||||
/**
|
||||
* struct spi_master - interface to SPI master controller
|
||||
* struct spi_controller - interface to SPI master or slave controller
|
||||
* @dev: device interface to this driver
|
||||
* @list: link with the global spi_master list
|
||||
* @list: link with the global spi_controller list
|
||||
* @bus_num: board-specific (and often SOC-specific) identifier for a
|
||||
* given SPI controller.
|
||||
* @num_chipselect: chipselects are used to distinguish individual
|
||||
|
@ -311,6 +313,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
|||
* @min_speed_hz: Lowest supported transfer speed
|
||||
* @max_speed_hz: Highest supported transfer speed
|
||||
* @flags: other constraints relevant to this driver
|
||||
* @slave: indicates that this is an SPI slave controller
|
||||
* @max_transfer_size: function that returns the max transfer size for
|
||||
* a &spi_device; may be %NULL, so the default %SIZE_MAX will be used.
|
||||
* @max_message_size: function that returns the max message size for
|
||||
|
@ -326,8 +329,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
|||
* the device whose settings are being modified.
|
||||
* @transfer: adds a message to the controller's transfer queue.
|
||||
* @cleanup: frees controller-specific state
|
||||
* @can_dma: determine whether this master supports DMA
|
||||
* @queued: whether this master is providing an internal message queue
|
||||
* @can_dma: determine whether this controller supports DMA
|
||||
* @queued: whether this controller is providing an internal message queue
|
||||
* @kworker: thread struct for message pump
|
||||
* @kworker_task: pointer to task for message pump kworker thread
|
||||
* @pump_messages: work struct for scheduling work to the message pump
|
||||
|
@ -374,6 +377,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
|||
* @handle_err: the subsystem calls the driver to handle an error that occurs
|
||||
* in the generic implementation of transfer_one_message().
|
||||
* @unprepare_message: undo any work done by prepare_message().
|
||||
* @slave_abort: abort the ongoing transfer request on an SPI slave controller
|
||||
* @spi_flash_read: to support spi-controller hardwares that provide
|
||||
* accelerated interface to read from flash devices.
|
||||
* @spi_flash_can_dma: analogous to can_dma() interface, but for
|
||||
|
@ -382,7 +386,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
|||
* @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
|
||||
* number. Any individual value may be -ENOENT for CS lines that
|
||||
* are not GPIOs (driven by the SPI controller itself).
|
||||
* @statistics: statistics for the spi_master
|
||||
* @statistics: statistics for the spi_controller
|
||||
* @dma_tx: DMA transmit channel
|
||||
* @dma_rx: DMA receive channel
|
||||
* @dummy_rx: dummy receive buffer for full-duplex devices
|
||||
|
@ -391,7 +395,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
|||
* what Linux expects, this optional hook can be used to translate
|
||||
* between the two.
|
||||
*
|
||||
* Each SPI master controller can communicate with one or more @spi_device
|
||||
* Each SPI controller can communicate with one or more @spi_device
|
||||
* children. These make a small bus, sharing MOSI, MISO and SCK signals
|
||||
* but not chip select signals. Each device may be configured to use a
|
||||
* different clock rate, since those shared signals are ignored unless
|
||||
|
@ -402,7 +406,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
|||
* an SPI slave device. For each such message it queues, it calls the
|
||||
* message's completion function when the transaction completes.
|
||||
*/
|
||||
struct spi_master {
|
||||
struct spi_controller {
|
||||
struct device dev;
|
||||
|
||||
struct list_head list;
|
||||
|
@ -440,12 +444,16 @@ struct spi_master {
|
|||
|
||||
/* other constraints relevant to this driver */
|
||||
u16 flags;
|
||||
#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
|
||||
#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
|
||||
#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
|
||||
#define SPI_MASTER_MUST_RX BIT(3) /* requires rx */
|
||||
#define SPI_MASTER_MUST_TX BIT(4) /* requires tx */
|
||||
#define SPI_MASTER_GPIO_SS BIT(5) /* GPIO CS must select slave */
|
||||
#define SPI_CONTROLLER_HALF_DUPLEX BIT(0) /* can't do full duplex */
|
||||
#define SPI_CONTROLLER_NO_RX BIT(1) /* can't do buffer read */
|
||||
#define SPI_CONTROLLER_NO_TX BIT(2) /* can't do buffer write */
|
||||
#define SPI_CONTROLLER_MUST_RX BIT(3) /* requires rx */
|
||||
#define SPI_CONTROLLER_MUST_TX BIT(4) /* requires tx */
|
||||
|
||||
#define SPI_MASTER_GPIO_SS BIT(5) /* GPIO CS must select slave */
|
||||
|
||||
/* flag indicating this is an SPI slave controller */
|
||||
bool slave;
|
||||
|
||||
/*
|
||||
* on some hardware transfer / message size may be constrained
|
||||
|
@ -480,8 +488,8 @@ struct spi_master {
|
|||
* any other request management
|
||||
* + To a given spi_device, message queueing is pure fifo
|
||||
*
|
||||
* + The master's main job is to process its message queue,
|
||||
* selecting a chip then transferring data
|
||||
* + The controller's main job is to process its message queue,
|
||||
* selecting a chip (for masters), then transferring data
|
||||
* + If there are multiple spi_device children, the i/o queue
|
||||
* arbitration algorithm is unspecified (round robin, fifo,
|
||||
* priority, reservations, preemption, etc)
|
||||
|
@ -494,7 +502,7 @@ struct spi_master {
|
|||
int (*transfer)(struct spi_device *spi,
|
||||
struct spi_message *mesg);
|
||||
|
||||
/* called on release() to free memory provided by spi_master */
|
||||
/* called on release() to free memory provided by spi_controller */
|
||||
void (*cleanup)(struct spi_device *spi);
|
||||
|
||||
/*
|
||||
|
@ -504,13 +512,13 @@ struct spi_master {
|
|||
* not modify or store xfer and dma_tx and dma_rx must be set
|
||||
* while the device is prepared.
|
||||
*/
|
||||
bool (*can_dma)(struct spi_master *master,
|
||||
bool (*can_dma)(struct spi_controller *ctlr,
|
||||
struct spi_device *spi,
|
||||
struct spi_transfer *xfer);
|
||||
|
||||
/*
|
||||
* These hooks are for drivers that want to use the generic
|
||||
* master transfer queueing mechanism. If these are used, the
|
||||
* controller transfer queueing mechanism. If these are used, the
|
||||
* transfer() function above must NOT be specified by the driver.
|
||||
* Over time we expect SPI drivers to be phased over to this API.
|
||||
*/
|
||||
|
@ -531,14 +539,15 @@ struct spi_master {
|
|||
struct completion xfer_completion;
|
||||
size_t max_dma_len;
|
||||
|
||||
int (*prepare_transfer_hardware)(struct spi_master *master);
|
||||
int (*transfer_one_message)(struct spi_master *master,
|
||||
int (*prepare_transfer_hardware)(struct spi_controller *ctlr);
|
||||
int (*transfer_one_message)(struct spi_controller *ctlr,
|
||||
struct spi_message *mesg);
|
||||
int (*unprepare_transfer_hardware)(struct spi_master *master);
|
||||
int (*prepare_message)(struct spi_master *master,
|
||||
int (*unprepare_transfer_hardware)(struct spi_controller *ctlr);
|
||||
int (*prepare_message)(struct spi_controller *ctlr,
|
||||
struct spi_message *message);
|
||||
int (*unprepare_message)(struct spi_master *master,
|
||||
int (*unprepare_message)(struct spi_controller *ctlr,
|
||||
struct spi_message *message);
|
||||
int (*slave_abort)(struct spi_controller *ctlr);
|
||||
int (*spi_flash_read)(struct spi_device *spi,
|
||||
struct spi_flash_read_message *msg);
|
||||
bool (*spi_flash_can_dma)(struct spi_device *spi,
|
||||
|
@ -550,9 +559,9 @@ struct spi_master {
|
|||
* of transfer_one_message() provied by the core.
|
||||
*/
|
||||
void (*set_cs)(struct spi_device *spi, bool enable);
|
||||
int (*transfer_one)(struct spi_master *master, struct spi_device *spi,
|
||||
int (*transfer_one)(struct spi_controller *ctlr, struct spi_device *spi,
|
||||
struct spi_transfer *transfer);
|
||||
void (*handle_err)(struct spi_master *master,
|
||||
void (*handle_err)(struct spi_controller *ctlr,
|
||||
struct spi_message *message);
|
||||
|
||||
/* gpio chip select */
|
||||
|
@ -569,57 +578,78 @@ struct spi_master {
|
|||
void *dummy_rx;
|
||||
void *dummy_tx;
|
||||
|
||||
int (*fw_translate_cs)(struct spi_master *master, unsigned cs);
|
||||
int (*fw_translate_cs)(struct spi_controller *ctlr, unsigned cs);
|
||||
};
|
||||
|
||||
static inline void *spi_master_get_devdata(struct spi_master *master)
|
||||
static inline void *spi_controller_get_devdata(struct spi_controller *ctlr)
|
||||
{
|
||||
return dev_get_drvdata(&master->dev);
|
||||
return dev_get_drvdata(&ctlr->dev);
|
||||
}
|
||||
|
||||
static inline void spi_master_set_devdata(struct spi_master *master, void *data)
|
||||
static inline void spi_controller_set_devdata(struct spi_controller *ctlr,
|
||||
void *data)
|
||||
{
|
||||
dev_set_drvdata(&master->dev, data);
|
||||
dev_set_drvdata(&ctlr->dev, data);
|
||||
}
|
||||
|
||||
static inline struct spi_master *spi_master_get(struct spi_master *master)
|
||||
static inline struct spi_controller *spi_controller_get(struct spi_controller *ctlr)
|
||||
{
|
||||
if (!master || !get_device(&master->dev))
|
||||
if (!ctlr || !get_device(&ctlr->dev))
|
||||
return NULL;
|
||||
return master;
|
||||
return ctlr;
|
||||
}
|
||||
|
||||
static inline void spi_master_put(struct spi_master *master)
|
||||
static inline void spi_controller_put(struct spi_controller *ctlr)
|
||||
{
|
||||
if (master)
|
||||
put_device(&master->dev);
|
||||
if (ctlr)
|
||||
put_device(&ctlr->dev);
|
||||
}
|
||||
|
||||
static inline bool spi_controller_is_slave(struct spi_controller *ctlr)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_SPI_SLAVE) && ctlr->slave;
|
||||
}
|
||||
|
||||
/* PM calls that need to be issued by the driver */
|
||||
extern int spi_master_suspend(struct spi_master *master);
|
||||
extern int spi_master_resume(struct spi_master *master);
|
||||
extern int spi_controller_suspend(struct spi_controller *ctlr);
|
||||
extern int spi_controller_resume(struct spi_controller *ctlr);
|
||||
|
||||
/* Calls the driver make to interact with the message queue */
|
||||
extern struct spi_message *spi_get_next_queued_message(struct spi_master *master);
|
||||
extern void spi_finalize_current_message(struct spi_master *master);
|
||||
extern void spi_finalize_current_transfer(struct spi_master *master);
|
||||
extern struct spi_message *spi_get_next_queued_message(struct spi_controller *ctlr);
|
||||
extern void spi_finalize_current_message(struct spi_controller *ctlr);
|
||||
extern void spi_finalize_current_transfer(struct spi_controller *ctlr);
|
||||
|
||||
/* the spi driver core manages memory for the spi_master classdev */
|
||||
extern struct spi_master *
|
||||
spi_alloc_master(struct device *host, unsigned size);
|
||||
/* the spi driver core manages memory for the spi_controller classdev */
|
||||
extern struct spi_controller *__spi_alloc_controller(struct device *host,
|
||||
unsigned int size, bool slave);
|
||||
|
||||
extern int spi_register_master(struct spi_master *master);
|
||||
extern int devm_spi_register_master(struct device *dev,
|
||||
struct spi_master *master);
|
||||
extern void spi_unregister_master(struct spi_master *master);
|
||||
static inline struct spi_controller *spi_alloc_master(struct device *host,
|
||||
unsigned int size)
|
||||
{
|
||||
return __spi_alloc_controller(host, size, false);
|
||||
}
|
||||
|
||||
extern struct spi_master *spi_busnum_to_master(u16 busnum);
|
||||
static inline struct spi_controller *spi_alloc_slave(struct device *host,
|
||||
unsigned int size)
|
||||
{
|
||||
if (!IS_ENABLED(CONFIG_SPI_SLAVE))
|
||||
return NULL;
|
||||
|
||||
return __spi_alloc_controller(host, size, true);
|
||||
}
|
||||
|
||||
extern int spi_register_controller(struct spi_controller *ctlr);
|
||||
extern int devm_spi_register_controller(struct device *dev,
|
||||
struct spi_controller *ctlr);
|
||||
extern void spi_unregister_controller(struct spi_controller *ctlr);
|
||||
|
||||
extern struct spi_controller *spi_busnum_to_master(u16 busnum);
|
||||
|
||||
/*
|
||||
* SPI resource management while processing a SPI message
|
||||
*/
|
||||
|
||||
typedef void (*spi_res_release_t)(struct spi_master *master,
|
||||
typedef void (*spi_res_release_t)(struct spi_controller *ctlr,
|
||||
struct spi_message *msg,
|
||||
void *res);
|
||||
|
||||
|
@ -644,7 +674,7 @@ extern void *spi_res_alloc(struct spi_device *spi,
|
|||
extern void spi_res_add(struct spi_message *message, void *res);
|
||||
extern void spi_res_free(void *res);
|
||||
|
||||
extern void spi_res_release(struct spi_master *master,
|
||||
extern void spi_res_release(struct spi_controller *ctlr,
|
||||
struct spi_message *message);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -828,7 +858,7 @@ struct spi_message {
|
|||
|
||||
/* for optional use by whatever driver currently owns the
|
||||
* spi_message ... between calls to spi_async and then later
|
||||
* complete(), that's the spi_master controller driver.
|
||||
* complete(), that's the spi_controller controller driver.
|
||||
*/
|
||||
struct list_head queue;
|
||||
void *state;
|
||||
|
@ -912,25 +942,27 @@ extern int spi_setup(struct spi_device *spi);
|
|||
extern int spi_async(struct spi_device *spi, struct spi_message *message);
|
||||
extern int spi_async_locked(struct spi_device *spi,
|
||||
struct spi_message *message);
|
||||
extern int spi_slave_abort(struct spi_device *spi);
|
||||
|
||||
static inline size_t
|
||||
spi_max_message_size(struct spi_device *spi)
|
||||
{
|
||||
struct spi_master *master = spi->master;
|
||||
if (!master->max_message_size)
|
||||
struct spi_controller *ctlr = spi->controller;
|
||||
|
||||
if (!ctlr->max_message_size)
|
||||
return SIZE_MAX;
|
||||
return master->max_message_size(spi);
|
||||
return ctlr->max_message_size(spi);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
spi_max_transfer_size(struct spi_device *spi)
|
||||
{
|
||||
struct spi_master *master = spi->master;
|
||||
struct spi_controller *ctlr = spi->controller;
|
||||
size_t tr_max = SIZE_MAX;
|
||||
size_t msg_max = spi_max_message_size(spi);
|
||||
|
||||
if (master->max_transfer_size)
|
||||
tr_max = master->max_transfer_size(spi);
|
||||
if (ctlr->max_transfer_size)
|
||||
tr_max = ctlr->max_transfer_size(spi);
|
||||
|
||||
/* transfer size limit must not be greater than messsage size limit */
|
||||
return min(tr_max, msg_max);
|
||||
|
@ -941,7 +973,7 @@ spi_max_transfer_size(struct spi_device *spi)
|
|||
/* SPI transfer replacement methods which make use of spi_res */
|
||||
|
||||
struct spi_replaced_transfers;
|
||||
typedef void (*spi_replaced_release_t)(struct spi_master *master,
|
||||
typedef void (*spi_replaced_release_t)(struct spi_controller *ctlr,
|
||||
struct spi_message *msg,
|
||||
struct spi_replaced_transfers *res);
|
||||
/**
|
||||
|
@ -985,7 +1017,7 @@ extern struct spi_replaced_transfers *spi_replace_transfers(
|
|||
|
||||
/* SPI transfer transformation methods */
|
||||
|
||||
extern int spi_split_transfers_maxsize(struct spi_master *master,
|
||||
extern int spi_split_transfers_maxsize(struct spi_controller *ctlr,
|
||||
struct spi_message *msg,
|
||||
size_t maxsize,
|
||||
gfp_t gfp);
|
||||
|
@ -999,8 +1031,8 @@ extern int spi_split_transfers_maxsize(struct spi_master *master,
|
|||
|
||||
extern int spi_sync(struct spi_device *spi, struct spi_message *message);
|
||||
extern int spi_sync_locked(struct spi_device *spi, struct spi_message *message);
|
||||
extern int spi_bus_lock(struct spi_master *master);
|
||||
extern int spi_bus_unlock(struct spi_master *master);
|
||||
extern int spi_bus_lock(struct spi_controller *ctlr);
|
||||
extern int spi_bus_unlock(struct spi_controller *ctlr);
|
||||
|
||||
/**
|
||||
* spi_sync_transfer - synchronous SPI data transfer
|
||||
|
@ -1185,9 +1217,9 @@ struct spi_flash_read_message {
|
|||
/* SPI core interface for flash read support */
|
||||
static inline bool spi_flash_read_supported(struct spi_device *spi)
|
||||
{
|
||||
return spi->master->spi_flash_read &&
|
||||
(!spi->master->flash_read_supported ||
|
||||
spi->master->flash_read_supported(spi));
|
||||
return spi->controller->spi_flash_read &&
|
||||
(!spi->controller->flash_read_supported ||
|
||||
spi->controller->flash_read_supported(spi));
|
||||
}
|
||||
|
||||
int spi_flash_read(struct spi_device *spi,
|
||||
|
@ -1220,7 +1252,7 @@ int spi_flash_read(struct spi_device *spi,
|
|||
* @irq: Initializes spi_device.irq; depends on how the board is wired.
|
||||
* @max_speed_hz: Initializes spi_device.max_speed_hz; based on limits
|
||||
* from the chip datasheet and board-specific signal quality issues.
|
||||
* @bus_num: Identifies which spi_master parents the spi_device; unused
|
||||
* @bus_num: Identifies which spi_controller parents the spi_device; unused
|
||||
* by spi_new_device(), and otherwise depends on board wiring.
|
||||
* @chip_select: Initializes spi_device.chip_select; depends on how
|
||||
* the board is wired.
|
||||
|
@ -1261,7 +1293,7 @@ struct spi_board_info {
|
|||
|
||||
|
||||
/* bus_num is board specific and matches the bus_num of some
|
||||
* spi_master that will probably be registered later.
|
||||
* spi_controller that will probably be registered later.
|
||||
*
|
||||
* chip_select reflects how this chip is wired to that master;
|
||||
* it's less than num_chipselect.
|
||||
|
@ -1295,7 +1327,7 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
|
|||
/* If you're hotplugging an adapter with devices (parport, usb, etc)
|
||||
* use spi_new_device() to describe each device. You can also call
|
||||
* spi_unregister_device() to start making that device vanish, but
|
||||
* normally that would be handled by spi_unregister_master().
|
||||
* normally that would be handled by spi_unregister_controller().
|
||||
*
|
||||
* You can also use spi_alloc_device() and spi_add_device() to use a two
|
||||
* stage registration sequence for each spi_device. This gives the caller
|
||||
|
@ -1304,13 +1336,13 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
|
|||
* be defined using the board info.
|
||||
*/
|
||||
extern struct spi_device *
|
||||
spi_alloc_device(struct spi_master *master);
|
||||
spi_alloc_device(struct spi_controller *ctlr);
|
||||
|
||||
extern int
|
||||
spi_add_device(struct spi_device *spi);
|
||||
|
||||
extern struct spi_device *
|
||||
spi_new_device(struct spi_master *, struct spi_board_info *);
|
||||
spi_new_device(struct spi_controller *, struct spi_board_info *);
|
||||
|
||||
extern void spi_unregister_device(struct spi_device *spi);
|
||||
|
||||
|
@ -1318,9 +1350,32 @@ extern const struct spi_device_id *
|
|||
spi_get_device_id(const struct spi_device *sdev);
|
||||
|
||||
static inline bool
|
||||
spi_transfer_is_last(struct spi_master *master, struct spi_transfer *xfer)
|
||||
spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer)
|
||||
{
|
||||
return list_is_last(&xfer->transfer_list, &master->cur_msg->transfers);
|
||||
return list_is_last(&xfer->transfer_list, &ctlr->cur_msg->transfers);
|
||||
}
|
||||
|
||||
|
||||
/* Compatibility layer */
|
||||
#define spi_master spi_controller
|
||||
|
||||
#define SPI_MASTER_HALF_DUPLEX SPI_CONTROLLER_HALF_DUPLEX
|
||||
#define SPI_MASTER_NO_RX SPI_CONTROLLER_NO_RX
|
||||
#define SPI_MASTER_NO_TX SPI_CONTROLLER_NO_TX
|
||||
#define SPI_MASTER_MUST_RX SPI_CONTROLLER_MUST_RX
|
||||
#define SPI_MASTER_MUST_TX SPI_CONTROLLER_MUST_TX
|
||||
|
||||
#define spi_master_get_devdata(_ctlr) spi_controller_get_devdata(_ctlr)
|
||||
#define spi_master_set_devdata(_ctlr, _data) \
|
||||
spi_controller_set_devdata(_ctlr, _data)
|
||||
#define spi_master_get(_ctlr) spi_controller_get(_ctlr)
|
||||
#define spi_master_put(_ctlr) spi_controller_put(_ctlr)
|
||||
#define spi_master_suspend(_ctlr) spi_controller_suspend(_ctlr)
|
||||
#define spi_master_resume(_ctlr) spi_controller_resume(_ctlr)
|
||||
|
||||
#define spi_register_master(_ctlr) spi_register_controller(_ctlr)
|
||||
#define devm_spi_register_master(_dev, _ctlr) \
|
||||
devm_spi_register_controller(_dev, _ctlr)
|
||||
#define spi_unregister_master(_ctlr) spi_unregister_controller(_ctlr)
|
||||
|
||||
#endif /* __LINUX_SPI_H */
|
||||
|
|
|
@ -7,37 +7,37 @@
|
|||
#include <linux/ktime.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_EVENT_CLASS(spi_master,
|
||||
DECLARE_EVENT_CLASS(spi_controller,
|
||||
|
||||
TP_PROTO(struct spi_master *master),
|
||||
TP_PROTO(struct spi_controller *controller),
|
||||
|
||||
TP_ARGS(master),
|
||||
TP_ARGS(controller),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( int, bus_num )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->bus_num = master->bus_num;
|
||||
__entry->bus_num = controller->bus_num;
|
||||
),
|
||||
|
||||
TP_printk("spi%d", (int)__entry->bus_num)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(spi_master, spi_master_idle,
|
||||
DEFINE_EVENT(spi_controller, spi_controller_idle,
|
||||
|
||||
TP_PROTO(struct spi_master *master),
|
||||
TP_PROTO(struct spi_controller *controller),
|
||||
|
||||
TP_ARGS(master)
|
||||
TP_ARGS(controller)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(spi_master, spi_master_busy,
|
||||
DEFINE_EVENT(spi_controller, spi_controller_busy,
|
||||
|
||||
TP_PROTO(struct spi_master *master),
|
||||
TP_PROTO(struct spi_controller *controller),
|
||||
|
||||
TP_ARGS(master)
|
||||
TP_ARGS(controller)
|
||||
|
||||
);
|
||||
|
||||
|
@ -54,7 +54,7 @@ DECLARE_EVENT_CLASS(spi_message,
|
|||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->bus_num = msg->spi->master->bus_num;
|
||||
__entry->bus_num = msg->spi->controller->bus_num;
|
||||
__entry->chip_select = msg->spi->chip_select;
|
||||
__entry->msg = msg;
|
||||
),
|
||||
|
@ -95,7 +95,7 @@ TRACE_EVENT(spi_message_done,
|
|||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->bus_num = msg->spi->master->bus_num;
|
||||
__entry->bus_num = msg->spi->controller->bus_num;
|
||||
__entry->chip_select = msg->spi->chip_select;
|
||||
__entry->msg = msg;
|
||||
__entry->frame = msg->frame_length;
|
||||
|
@ -122,7 +122,7 @@ DECLARE_EVENT_CLASS(spi_transfer,
|
|||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->bus_num = msg->spi->master->bus_num;
|
||||
__entry->bus_num = msg->spi->controller->bus_num;
|
||||
__entry->chip_select = msg->spi->chip_select;
|
||||
__entry->xfer = xfer;
|
||||
__entry->len = xfer->len;
|
||||
|
|
Loading…
Reference in a new issue