Commit f2af60bb authored by Eddie James's avatar Eddie James Committed by Joel Stanley

fsi: Add trace events in initialization path

Add definitions for trace events to show the scanning flow.
Signed-off-by: default avatarEddie James <eajames@linux.ibm.com>
Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20220207161640.35605-1-eajames@linux.ibm.comSigned-off-by: default avatarJoel Stanley <joel@jms.id.au>
parent a1dc6308
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
#include "fsi-master.h" #include "fsi-master.h"
#define CREATE_TRACE_POINTS
#include <trace/events/fsi.h>
#define FSI_SLAVE_CONF_NEXT_MASK GENMASK(31, 31) #define FSI_SLAVE_CONF_NEXT_MASK GENMASK(31, 31)
#define FSI_SLAVE_CONF_SLOTS_MASK GENMASK(23, 16) #define FSI_SLAVE_CONF_SLOTS_MASK GENMASK(23, 16)
#define FSI_SLAVE_CONF_SLOTS_SHIFT 16 #define FSI_SLAVE_CONF_SLOTS_SHIFT 16
...@@ -95,6 +92,9 @@ struct fsi_slave { ...@@ -95,6 +92,9 @@ struct fsi_slave {
u8 t_echo_delay; u8 t_echo_delay;
}; };
#define CREATE_TRACE_POINTS
#include <trace/events/fsi.h>
#define to_fsi_master(d) container_of(d, struct fsi_master, dev) #define to_fsi_master(d) container_of(d, struct fsi_master, dev)
#define to_fsi_slave(d) container_of(d, struct fsi_slave, dev) #define to_fsi_slave(d) container_of(d, struct fsi_slave, dev)
...@@ -524,6 +524,8 @@ static int fsi_slave_scan(struct fsi_slave *slave) ...@@ -524,6 +524,8 @@ static int fsi_slave_scan(struct fsi_slave *slave)
dev->addr = engine_addr; dev->addr = engine_addr;
dev->size = slots * engine_page_size; dev->size = slots * engine_page_size;
trace_fsi_dev_init(dev);
dev_dbg(&slave->dev, dev_dbg(&slave->dev,
"engine[%i]: type %x, version %x, addr %x size %x\n", "engine[%i]: type %x, version %x, addr %x size %x\n",
dev->unit, dev->engine_type, version, dev->unit, dev->engine_type, version,
...@@ -1006,6 +1008,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) ...@@ -1006,6 +1008,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
crc = crc4(0, cfam_id, 32); crc = crc4(0, cfam_id, 32);
if (crc) { if (crc) {
trace_fsi_slave_invalid_cfam(master, link, cfam_id);
dev_warn(&master->dev, "slave %02x:%02x invalid cfam id CRC!\n", dev_warn(&master->dev, "slave %02x:%02x invalid cfam id CRC!\n",
link, id); link, id);
return -EIO; return -EIO;
...@@ -1080,6 +1083,8 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) ...@@ -1080,6 +1083,8 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
if (rc) if (rc)
goto err_free; goto err_free;
trace_fsi_slave_init(slave);
/* Create chardev for userspace access */ /* Create chardev for userspace access */
cdev_init(&slave->cdev, &cfam_fops); cdev_init(&slave->cdev, &cfam_fops);
rc = cdev_device_add(&slave->cdev, &slave->dev); rc = cdev_device_add(&slave->cdev, &slave->dev);
......
...@@ -449,11 +449,13 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *att ...@@ -449,11 +449,13 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *att
{ {
struct fsi_master_aspeed *aspeed = dev_get_drvdata(dev); struct fsi_master_aspeed *aspeed = dev_get_drvdata(dev);
trace_fsi_master_aspeed_cfam_reset(true);
mutex_lock(&aspeed->lock); mutex_lock(&aspeed->lock);
gpiod_set_value(aspeed->cfam_reset_gpio, 1); gpiod_set_value(aspeed->cfam_reset_gpio, 1);
usleep_range(900, 1000); usleep_range(900, 1000);
gpiod_set_value(aspeed->cfam_reset_gpio, 0); gpiod_set_value(aspeed->cfam_reset_gpio, 0);
mutex_unlock(&aspeed->lock); mutex_unlock(&aspeed->lock);
trace_fsi_master_aspeed_cfam_reset(false);
return count; return count;
} }
......
...@@ -122,6 +122,92 @@ TRACE_EVENT(fsi_master_break, ...@@ -122,6 +122,92 @@ TRACE_EVENT(fsi_master_break,
) )
); );
TRACE_EVENT(fsi_slave_init,
TP_PROTO(const struct fsi_slave *slave),
TP_ARGS(slave),
TP_STRUCT__entry(
__field(int, master_idx)
__field(int, master_n_links)
__field(int, idx)
__field(int, link)
__field(int, chip_id)
__field(__u32, cfam_id)
__field(__u32, size)
),
TP_fast_assign(
__entry->master_idx = slave->master->idx;
__entry->master_n_links = slave->master->n_links;
__entry->idx = slave->cdev_idx;
__entry->link = slave->link;
__entry->chip_id = slave->chip_id;
__entry->cfam_id = slave->cfam_id;
__entry->size = slave->size;
),
TP_printk("fsi%d: idx:%d link:%d/%d cid:%d cfam:%08x %08x",
__entry->master_idx,
__entry->idx,
__entry->link,
__entry->master_n_links,
__entry->chip_id,
__entry->cfam_id,
__entry->size
)
);
TRACE_EVENT(fsi_slave_invalid_cfam,
TP_PROTO(const struct fsi_master *master, int link, uint32_t cfam_id),
TP_ARGS(master, link, cfam_id),
TP_STRUCT__entry(
__field(int, master_idx)
__field(int, master_n_links)
__field(int, link)
__field(__u32, cfam_id)
),
TP_fast_assign(
__entry->master_idx = master->idx;
__entry->master_n_links = master->n_links;
__entry->link = link;
__entry->cfam_id = cfam_id;
),
TP_printk("fsi%d: cfam:%08x link:%d/%d",
__entry->master_idx,
__entry->cfam_id,
__entry->link,
__entry->master_n_links
)
);
TRACE_EVENT(fsi_dev_init,
TP_PROTO(const struct fsi_device *dev),
TP_ARGS(dev),
TP_STRUCT__entry(
__field(int, master_idx)
__field(int, link)
__field(int, type)
__field(int, unit)
__field(int, version)
__field(__u32, addr)
__field(__u32, size)
),
TP_fast_assign(
__entry->master_idx = dev->slave->master->idx;
__entry->link = dev->slave->link;
__entry->type = dev->engine_type;
__entry->unit = dev->unit;
__entry->version = dev->version;
__entry->addr = dev->addr;
__entry->size = dev->size;
),
TP_printk("fsi%d: slv%d: t:%02x u:%02x v:%02x %08x@%08x",
__entry->master_idx,
__entry->link,
__entry->type,
__entry->unit,
__entry->version,
__entry->size,
__entry->addr
)
);
#endif /* _TRACE_FSI_H */ #endif /* _TRACE_FSI_H */
......
...@@ -72,6 +72,18 @@ TRACE_EVENT(fsi_master_aspeed_opb_error, ...@@ -72,6 +72,18 @@ TRACE_EVENT(fsi_master_aspeed_opb_error,
) )
); );
TRACE_EVENT(fsi_master_aspeed_cfam_reset,
TP_PROTO(bool start),
TP_ARGS(start),
TP_STRUCT__entry(
__field(bool, start)
),
TP_fast_assign(
__entry->start = start;
),
TP_printk("%s", __entry->start ? "start" : "end")
);
#endif #endif
#include <trace/define_trace.h> #include <trace/define_trace.h>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment