Skip to content

Commit

Permalink
spi: axi-spi-engine: Emit trace events for spi transfers
Browse files Browse the repository at this point in the history
As this spi host controller driver implements the
.transfer_one_message() callback, it has to care about these traces
it-self. With the transfers being compiled it's difficult to determine
where handling of one transfer ends and the next begins, so just
generate the start events in batch before the hardware fifo is fed and
the end events when their completion triggered.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241031111646.747692-2-u.kleine-koenig@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Uwe Kleine-König authored and broonie committed Oct 31, 2024
1 parent 8a9c132 commit e36eba4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/spi/spi-axi-spi-engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/overflow.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <trace/events/spi.h>

#define SPI_ENGINE_REG_RESET 0x40

Expand Down Expand Up @@ -590,6 +591,13 @@ static int spi_engine_transfer_one_message(struct spi_controller *host,

reinit_completion(&spi_engine->msg_complete);

if (trace_spi_transfer_start_enabled()) {
struct spi_transfer *xfer;

list_for_each_entry(xfer, &msg->transfers, transfer_list)
trace_spi_transfer_start(msg, xfer);
}

spin_lock_irqsave(&spi_engine->lock, flags);

if (spi_engine_write_cmd_fifo(spi_engine, msg))
Expand Down Expand Up @@ -617,6 +625,13 @@ static int spi_engine_transfer_one_message(struct spi_controller *host,
msg->status = -ETIMEDOUT;
}

if (trace_spi_transfer_stop_enabled()) {
struct spi_transfer *xfer;

list_for_each_entry(xfer, &msg->transfers, transfer_list)
trace_spi_transfer_stop(msg, xfer);
}

spi_finalize_current_message(host);

return msg->status;
Expand Down

0 comments on commit e36eba4

Please sign in to comment.