spi: spi-msm-geni: Add support of ftrace logging for SPI/I2C & geni_se
Currently IPC logging is enabled for debug build only,so it is very difficult to analyze the SPI/I2C and common driver issues if IPC logging is not present. To overcome this issue we have added the support of ftrace logging. Here we have created the different events to print the logs for different types using TRACE_EVENT macro. The ftrace output will be present in below mentioned paths. cat /sys/kernel/tracing/instances/spi_qup/trace. cat /sys/kernel/tracing/instances/i2c_qup/trace. cat /sys/kernel/tracing/instances/qupv3_common/trace. Change-Id: I99b339c73464ee99b4f2a79128ed588f5367ce5c Signed-off-by: Anil Veshala <aveshala@codeaurora.org>
This commit is contained in:
parent
3f203f5206
commit
5e1bf53915
@ -77,6 +77,36 @@
|
||||
|
||||
#define MAX_SE 20
|
||||
|
||||
#define I2C_LOG_DBG(log_ctx, print, dev, x...) do { \
|
||||
GENI_SE_DBG(log_ctx, print, dev, x); \
|
||||
if (dev) \
|
||||
i2c_trace_log(dev, x); \
|
||||
} while (0)
|
||||
|
||||
#define I2C_LOG_ERR(log_ctx, print, dev, x...) do { \
|
||||
GENI_SE_ERR(log_ctx, print, dev, x); \
|
||||
if (dev) \
|
||||
i2c_trace_log(dev, x); \
|
||||
} while (0)
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "i2c-qup-trace.h"
|
||||
|
||||
/* FTRACE Logging */
|
||||
void i2c_trace_log(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
struct va_format vaf = {
|
||||
.fmt = fmt,
|
||||
};
|
||||
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
vaf.va = &args;
|
||||
trace_i2c_log_info(dev_name(dev), &vaf);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
enum i2c_se_mode {
|
||||
UNINITIALIZED,
|
||||
FIFO_SE_DMA,
|
||||
@ -227,11 +257,11 @@ static inline void qcom_geni_i2c_calc_timeout(struct geni_i2c_dev *gi2c)
|
||||
static void geni_i2c_err(struct geni_i2c_dev *gi2c, int err)
|
||||
{
|
||||
if (err == I2C_NACK || err == GENI_ABORT_DONE) {
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n",
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n",
|
||||
gi2c_log[err].msg);
|
||||
goto err_ret;
|
||||
} else {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev, "%s\n",
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev, "%s\n",
|
||||
gi2c_log[err].msg);
|
||||
}
|
||||
geni_se_dump_dbg_regs(&gi2c->i2c_rsc, gi2c->base, gi2c->ipcl);
|
||||
@ -257,7 +287,7 @@ static int geni_i2c_prepare(struct geni_i2c_dev *gi2c)
|
||||
if (se_mode) {
|
||||
gi2c->se_mode = GSI_ONLY;
|
||||
geni_se_select_mode(gi2c->base, GSI_DMA);
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"i2c in GSI ONLY mode\n");
|
||||
} else {
|
||||
int gi2c_tx_depth = get_tx_fifo_depth(gi2c->base);
|
||||
@ -268,7 +298,7 @@ static int geni_i2c_prepare(struct geni_i2c_dev *gi2c)
|
||||
geni_se_init(gi2c->base, gi2c->tx_wm, gi2c_tx_depth);
|
||||
qcom_geni_i2c_conf(gi2c, 0);
|
||||
se_config_packing(gi2c->base, 8, 4, true);
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"i2c fifo/se-dma mode. fifo depth:%d\n",
|
||||
gi2c_tx_depth);
|
||||
}
|
||||
@ -289,7 +319,7 @@ static irqreturn_t geni_i2c_irq(int irq, void *dev)
|
||||
|
||||
if (!cur) {
|
||||
geni_se_dump_dbg_regs(&gi2c->i2c_rsc, gi2c->base, gi2c->ipcl);
|
||||
GENI_SE_ERR(gi2c->ipcl, false, gi2c->dev, "Spurious irq\n");
|
||||
I2C_LOG_ERR(gi2c->ipcl, false, gi2c->dev, "Spurious irq\n");
|
||||
goto irqret;
|
||||
}
|
||||
|
||||
@ -418,7 +448,7 @@ static void gi2c_ev_cb(struct dma_chan *ch, struct msm_gpi_cb const *cb_str,
|
||||
break;
|
||||
}
|
||||
if (cb_str->cb_event != MSM_GPI_QUP_NOTIFY)
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"GSI QN err:0x%x, status:0x%x, err:%d\n",
|
||||
cb_str->error_log.error_code,
|
||||
m_stat, cb_str->cb_event);
|
||||
@ -430,7 +460,7 @@ static void gi2c_gsi_cb_err(struct msm_gpi_dma_async_tx_cb_param *cb,
|
||||
struct geni_i2c_dev *gi2c = cb->userdata;
|
||||
|
||||
if (cb->status & DM_I2C_CB_ERR) {
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"%s TCE Unexpected Err, stat:0x%x\n",
|
||||
xfer, cb->status);
|
||||
if (cb->status & (BIT(GP_IRQ1) << 5))
|
||||
@ -469,7 +499,7 @@ static int geni_i2c_gsi_request_channel(struct geni_i2c_dev *gi2c)
|
||||
if (!gi2c->tx_c) {
|
||||
gi2c->tx_c = dma_request_slave_channel(gi2c->dev, "tx");
|
||||
if (!gi2c->tx_c) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"tx dma req slv chan ret :%d\n", ret);
|
||||
return -EIO;
|
||||
}
|
||||
@ -478,7 +508,7 @@ static int geni_i2c_gsi_request_channel(struct geni_i2c_dev *gi2c)
|
||||
if (!gi2c->rx_c) {
|
||||
gi2c->rx_c = dma_request_slave_channel(gi2c->dev, "rx");
|
||||
if (!gi2c->rx_c) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"rx dma req slv chan ret :%d\n", ret);
|
||||
dma_release_channel(gi2c->tx_c);
|
||||
return -EIO;
|
||||
@ -491,7 +521,7 @@ static int geni_i2c_gsi_request_channel(struct geni_i2c_dev *gi2c)
|
||||
gi2c->tx_c->private = &gi2c->tx_ev;
|
||||
ret = dmaengine_slave_config(gi2c->tx_c, NULL);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"tx dma slave config ret :%d\n", ret);
|
||||
goto dmaengine_slave_config_fail;
|
||||
}
|
||||
@ -502,7 +532,7 @@ static int geni_i2c_gsi_request_channel(struct geni_i2c_dev *gi2c)
|
||||
gi2c->rx_c->private = &gi2c->rx_ev;
|
||||
ret = dmaengine_slave_config(gi2c->rx_c, NULL);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"rx dma slave config ret :%d\n", ret);
|
||||
goto dmaengine_slave_config_fail;
|
||||
}
|
||||
@ -647,7 +677,7 @@ static struct dma_async_tx_descriptor *geni_i2c_prep_desc
|
||||
segs, DMA_MEM_TO_DEV,
|
||||
(DMA_PREP_INTERRUPT | DMA_CTRL_ACK));
|
||||
if (!geni_desc) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"prep_slave_sg for tx failed\n");
|
||||
gi2c->err = -ENOMEM;
|
||||
return NULL;
|
||||
@ -659,7 +689,7 @@ static struct dma_async_tx_descriptor *geni_i2c_prep_desc
|
||||
&gi2c->rx_sg, 1, DMA_DEV_TO_MEM,
|
||||
(DMA_PREP_INTERRUPT | DMA_CTRL_ACK));
|
||||
if (!geni_desc) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"prep_slave_sg for rx failed\n");
|
||||
gi2c->err = -ENOMEM;
|
||||
return NULL;
|
||||
@ -702,7 +732,7 @@ static int geni_i2c_lock_bus(struct geni_i2c_dev *gi2c)
|
||||
|
||||
timeout = wait_for_completion_timeout(&gi2c->xfer, HZ);
|
||||
if (!timeout) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s timedout\n", __func__);
|
||||
geni_se_dump_dbg_regs(&gi2c->i2c_rsc, gi2c->base,
|
||||
gi2c->ipcl);
|
||||
@ -747,7 +777,7 @@ static void geni_i2c_unlock_bus(struct geni_i2c_dev *gi2c)
|
||||
|
||||
timeout = wait_for_completion_timeout(&gi2c->xfer, HZ);
|
||||
if (!timeout) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s failed\n", __func__);
|
||||
geni_se_dump_dbg_regs(&gi2c->i2c_rsc, gi2c->base,
|
||||
gi2c->ipcl);
|
||||
@ -838,14 +868,14 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
||||
sizeof(gi2c->go_t));
|
||||
|
||||
if (msgs[i].flags & I2C_M_RD) {
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"msg[%d].len:%d R\n", i, gi2c->cur->len);
|
||||
sg_init_table(&gi2c->rx_sg, 1);
|
||||
ret = geni_se_iommu_map_buf(rx_dev, &gi2c->rx_ph,
|
||||
dma_buf, msgs[i].len,
|
||||
DMA_FROM_DEVICE);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"geni_se_iommu_map_buf for rx failed :%d\n",
|
||||
ret);
|
||||
i2c_put_dma_safe_msg_buf(dma_buf, &msgs[i],
|
||||
@ -874,13 +904,13 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
||||
rx_cookie = dmaengine_submit(gi2c->rx_desc);
|
||||
dma_async_issue_pending(gi2c->rx_c);
|
||||
} else {
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"msg[%d].len:%d W\n", i, gi2c->cur->len);
|
||||
ret = geni_se_iommu_map_buf(tx_dev, &gi2c->tx_ph,
|
||||
dma_buf, msgs[i].len,
|
||||
DMA_TO_DEVICE);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"geni_se_iommu_map_buf for tx failed :%d\n",
|
||||
ret);
|
||||
i2c_put_dma_safe_msg_buf(dma_buf, &msgs[i],
|
||||
@ -919,7 +949,7 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
||||
timeout = wait_for_completion_timeout(&gi2c->xfer,
|
||||
gi2c->xfer_timeout);
|
||||
if (!timeout) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"I2C gsi xfer timeout:%u flags:%d addr:0x%x\n",
|
||||
gi2c->xfer_timeout, gi2c->cur->flags,
|
||||
gi2c->cur->addr);
|
||||
@ -938,7 +968,7 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
||||
if (ret) {
|
||||
gi2c->gpi_reset = true;
|
||||
gi2c->err = ret;
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"Channel cancel failed\n");
|
||||
goto geni_i2c_gsi_xfer_out;
|
||||
}
|
||||
@ -976,7 +1006,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
|
||||
/* Client to respect system suspend */
|
||||
if (!pm_runtime_enabled(gi2c->dev)) {
|
||||
GENI_SE_ERR(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, false, gi2c->dev,
|
||||
"%s: System suspended\n", __func__);
|
||||
return -EACCES;
|
||||
}
|
||||
@ -984,7 +1014,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
if (!gi2c->is_le_vm) {
|
||||
ret = pm_runtime_get_sync(gi2c->dev);
|
||||
if (ret < 0) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"error turning SE resources:%d\n", ret);
|
||||
pm_runtime_put_noidle(gi2c->dev);
|
||||
/* Set device in suspended since resume failed */
|
||||
@ -993,7 +1023,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
}
|
||||
}
|
||||
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"n:%d addr:0x%x\n", num, msgs[0].addr);
|
||||
|
||||
gi2c->dbg_num = num;
|
||||
@ -1001,7 +1031,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
gi2c->dbg_buf_ptr =
|
||||
kcalloc(num, sizeof(struct dbg_buf_ctxt), GFP_KERNEL);
|
||||
if (!gi2c->dbg_buf_ptr)
|
||||
GENI_SE_ERR(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, false, gi2c->dev,
|
||||
"Buf logging pointer not available\n");
|
||||
|
||||
if (gi2c->se_mode == GSI_ONLY) {
|
||||
@ -1046,7 +1076,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
}
|
||||
|
||||
if (msgs[i].flags & I2C_M_RD) {
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"msgs[%d].len:%d R\n", i, msgs[i].len);
|
||||
geni_write_reg(msgs[i].len,
|
||||
gi2c->base, SE_I2C_RX_TRANS_LEN);
|
||||
@ -1070,7 +1100,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"msgs[%d].len:%d W\n", i, msgs[i].len);
|
||||
geni_write_reg(msgs[i].len, gi2c->base,
|
||||
SE_I2C_TX_TRANS_LEN);
|
||||
@ -1102,7 +1132,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
timeout = wait_for_completion_timeout(&gi2c->xfer,
|
||||
gi2c->xfer_timeout);
|
||||
if (!timeout) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"I2C xfer timeout: %d\n", gi2c->xfer_timeout);
|
||||
geni_i2c_err(gi2c, GENI_TIMEOUT);
|
||||
}
|
||||
@ -1112,7 +1142,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
geni_cancel_m_cmd(gi2c->base);
|
||||
timeout = wait_for_completion_timeout(&gi2c->xfer, HZ);
|
||||
if (!timeout) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"Abort\n");
|
||||
geni_abort_m_cmd(gi2c->base);
|
||||
}
|
||||
@ -1138,7 +1168,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
}
|
||||
ret = gi2c->err;
|
||||
if (gi2c->err) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"i2c error :%d\n", gi2c->err);
|
||||
break;
|
||||
}
|
||||
@ -1153,7 +1183,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
||||
}
|
||||
gi2c->cur = NULL;
|
||||
gi2c->err = 0;
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"i2c txn ret:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@ -1364,7 +1394,7 @@ static int geni_i2c_resume_early(struct device *device)
|
||||
{
|
||||
struct geni_i2c_dev *gi2c = dev_get_drvdata(device);
|
||||
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1391,7 +1421,7 @@ static int geni_i2c_runtime_suspend(struct device *dev)
|
||||
} else {
|
||||
se_geni_resources_off(&gi2c->i2c_rsc);
|
||||
}
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1438,13 +1468,13 @@ static int geni_i2c_runtime_resume(struct device *dev)
|
||||
|
||||
ret = geni_i2c_lock_bus(gi2c);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s failed: %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1454,16 +1484,16 @@ static int geni_i2c_suspend_late(struct device *device)
|
||||
struct geni_i2c_dev *gi2c = dev_get_drvdata(device);
|
||||
int ret;
|
||||
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev, "%s\n", __func__);
|
||||
/* Make sure no transactions are pending */
|
||||
ret = i2c_trylock_bus(&gi2c->adap, I2C_LOCK_SEGMENT);
|
||||
if (!ret) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
I2C_LOG_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"late I2C transaction request\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
if (!pm_runtime_status_suspended(device)) {
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
I2C_LOG_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"%s: Force suspend\n", __func__);
|
||||
geni_i2c_runtime_suspend(device);
|
||||
pm_runtime_disable(device);
|
||||
|
46
drivers/i2c/busses/i2c-qup-trace.h
Normal file
46
drivers/i2c/busses/i2c-qup-trace.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM qup_i2c_trace
|
||||
|
||||
#if !defined(_TRACE_I2C_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_I2C_TRACE_H
|
||||
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
#define MAX_MSG_LEN 256
|
||||
|
||||
TRACE_EVENT(i2c_log_info,
|
||||
|
||||
TP_PROTO(const char *name, struct va_format *vaf),
|
||||
|
||||
TP_ARGS(name, vaf),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, name)
|
||||
__dynamic_array(char, msg, MAX_MSG_LEN)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
|
||||
MAX_MSG_LEN, vaf->fmt,
|
||||
*vaf->va) >= MAX_MSG_LEN);
|
||||
),
|
||||
|
||||
TP_printk("%s: %s", __get_str(name), __get_str(msg))
|
||||
);
|
||||
|
||||
#endif /* _TRACE_I2C_TRACE_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
#define TRACE_INCLUDE_FILE i2c-qup-trace
|
||||
#include <trace/define_trace.h>
|
||||
|
||||
|
@ -33,6 +33,23 @@
|
||||
#define CONV_TO_BW(x) (x*4)
|
||||
#define NUM_LOG_PAGES 2
|
||||
#define MAX_CLK_PERF_LEVEL 32
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "qup-common-trace.h"
|
||||
|
||||
#define GENI_LOG_DBG(log_ctx, print, dev, x...) do { \
|
||||
GENI_SE_DBG(log_ctx, print, dev, x); \
|
||||
if (dev) \
|
||||
geni_trace_log(dev, x); \
|
||||
} while (0)
|
||||
|
||||
#define GENI_LOG_ERR(log_ctx, print, dev, x...) do { \
|
||||
GENI_SE_ERR(log_ctx, print, dev, x); \
|
||||
if (dev) \
|
||||
geni_trace_log(dev, x); \
|
||||
} while (0)
|
||||
|
||||
|
||||
static unsigned long default_bus_bw_set[] = {0, 19200000, 50000000,
|
||||
100000000, 150000000, 200000000, 236000000};
|
||||
|
||||
@ -111,6 +128,22 @@ struct geni_se_device {
|
||||
#define HW_VER_MINOR_SHFT 16
|
||||
#define HW_VER_STEP_MASK GENMASK(15, 0)
|
||||
|
||||
/* FTRACE Logging */
|
||||
void geni_trace_log(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
struct va_format vaf = {
|
||||
.fmt = fmt,
|
||||
};
|
||||
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
vaf.va = &args;
|
||||
trace_geni_log_info(dev_name(dev), &vaf);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* geni_read_reg_nolog() - Helper function to read from a GENI register
|
||||
* @base: Base address of the serial engine's register block.
|
||||
@ -742,7 +775,7 @@ static int geni_se_rmv_ab_ib(struct geni_se_device *geni_se_dev,
|
||||
geni_se_dev->vectors[0].ab,
|
||||
geni_se_dev->vectors[0].ib);
|
||||
|
||||
GENI_SE_DBG(geni_se_dev->log_ctx, false, NULL,
|
||||
GENI_LOG_DBG(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: cur_ab_ib(%lu:%lu) req_ab_ib(%lu:%lu) %d\n",
|
||||
__func__, dev_name(rsc->ctrl_dev), geni_se_dev->cur_ab,
|
||||
geni_se_dev->cur_ib, rsc->ab, rsc->ib, bus_bw_update);
|
||||
@ -775,7 +808,7 @@ static int geni_se_rmv_ab_ib(struct geni_se_device *geni_se_dev,
|
||||
geni_se_dev->vectors[1].ab,
|
||||
geni_se_dev->vectors[1].ib);
|
||||
|
||||
GENI_SE_DBG(geni_se_dev->log_ctx, false, NULL,
|
||||
GENI_LOG_DBG(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: cur_ab_ib_noc(%lu:%lu) req_ab_ib_noc(%lu:%lu) %d\n",
|
||||
__func__, dev_name(rsc->ctrl_dev),
|
||||
geni_se_dev->cur_ab_noc, geni_se_dev->cur_ib_noc,
|
||||
@ -810,8 +843,9 @@ int se_geni_clks_off(struct se_geni_rsc *rsc)
|
||||
|
||||
ret = geni_se_rmv_ab_ib(geni_se_dev, rsc);
|
||||
if (ret)
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error %d during bus_bw_update\n", __func__, ret);
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: Error %d during bus_bw_update\n", __func__,
|
||||
dev_name(rsc->ctrl_dev), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -838,12 +872,14 @@ int se_geni_resources_off(struct se_geni_rsc *rsc)
|
||||
|
||||
ret = se_geni_clks_off(rsc);
|
||||
if (ret)
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error %d turning off clocks\n", __func__, ret);
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: Error %d turning off clocks\n", __func__,
|
||||
dev_name(rsc->ctrl_dev), ret);
|
||||
ret = pinctrl_select_state(rsc->geni_pinctrl, rsc->geni_gpio_sleep);
|
||||
if (ret)
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error %d pinctrl_select_state\n", __func__, ret);
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: Error %d pinctrl_select_state\n", __func__,
|
||||
dev_name(rsc->ctrl_dev), ret);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(se_geni_resources_off);
|
||||
@ -889,7 +925,7 @@ static int geni_se_add_ab_ib(struct geni_se_device *geni_se_dev,
|
||||
geni_se_dev->vectors[0].ab,
|
||||
geni_se_dev->vectors[0].ib);
|
||||
|
||||
GENI_SE_DBG(geni_se_dev->log_ctx, false, NULL,
|
||||
GENI_LOG_DBG(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: cur_ab_ib(%lu:%lu) req_ab_ib(%lu:%lu) %d\n",
|
||||
__func__, dev_name(rsc->ctrl_dev),
|
||||
geni_se_dev->cur_ab, geni_se_dev->cur_ib,
|
||||
@ -922,7 +958,7 @@ static int geni_se_add_ab_ib(struct geni_se_device *geni_se_dev,
|
||||
geni_se_dev->vectors[1].ab,
|
||||
geni_se_dev->vectors[1].ib);
|
||||
|
||||
GENI_SE_DBG(geni_se_dev->log_ctx, false, NULL,
|
||||
GENI_LOG_DBG(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: cur_ab_ib_noc(%lu:%lu) req_ab_ib_noc(%lu:%lu) %d\n",
|
||||
__func__, dev_name(rsc->ctrl_dev),
|
||||
geni_se_dev->cur_ab_noc, geni_se_dev->cur_ib_noc,
|
||||
@ -953,8 +989,9 @@ int se_geni_clks_on(struct se_geni_rsc *rsc)
|
||||
|
||||
ret = geni_se_add_ab_ib(geni_se_dev, rsc);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error %d during bus_bw_update\n", __func__, ret);
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: Error %d during bus_bw_update\n", __func__,
|
||||
dev_name(rsc->ctrl_dev), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1002,15 +1039,17 @@ int se_geni_resources_on(struct se_geni_rsc *rsc)
|
||||
|
||||
ret = pinctrl_select_state(rsc->geni_pinctrl, rsc->geni_gpio_active);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error %d pinctrl_select_state\n", __func__, ret);
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: Error %d pinctrl_select_state\n", __func__,
|
||||
dev_name(rsc->ctrl_dev), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = se_geni_clks_on(rsc);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error %d during clks_on\n", __func__, ret);
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: Error %d during clks_on\n", __func__,
|
||||
dev_name(rsc->ctrl_dev), ret);
|
||||
pinctrl_select_state(rsc->geni_pinctrl, rsc->geni_gpio_sleep);
|
||||
}
|
||||
|
||||
@ -1045,9 +1084,9 @@ int geni_se_resources_init(struct se_geni_rsc *rsc,
|
||||
if (IS_ERR_OR_NULL(geni_se_dev->bus_bw)) {
|
||||
geni_se_dev->bus_bw = of_icc_get(geni_se_dev->dev, "qup-core");
|
||||
if (IS_ERR_OR_NULL(geni_se_dev->bus_bw)) {
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error Get Path: (Core2x), %ld\n",
|
||||
__func__, PTR_ERR(geni_se_dev->bus_bw));
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s Error Get Path: (Core2x), %ld\n",
|
||||
__func__, dev_name(rsc->ctrl_dev), PTR_ERR(geni_se_dev->bus_bw));
|
||||
|
||||
return geni_se_dev->bus_bw ?
|
||||
PTR_ERR(geni_se_dev->bus_bw) : -ENOENT;
|
||||
@ -1061,9 +1100,9 @@ int geni_se_resources_init(struct se_geni_rsc *rsc,
|
||||
geni_se_dev->bus_bw_noc =
|
||||
of_icc_get(geni_se_dev->dev, "qup-ddr");
|
||||
if (IS_ERR_OR_NULL(geni_se_dev->bus_bw_noc)) {
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
"%s: Error Get Path: (DDR), %ld\n",
|
||||
__func__,
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: %s: Error Get Path: (DDR), %ld\n",
|
||||
__func__, dev_name(rsc->ctrl_dev),
|
||||
PTR_ERR(geni_se_dev->bus_bw_noc));
|
||||
icc_put(geni_se_dev->bus_bw);
|
||||
geni_se_dev->bus_bw = NULL;
|
||||
@ -1435,7 +1474,7 @@ void *geni_se_iommu_alloc_buf(struct device *wrapper_dev, dma_addr_t *iova,
|
||||
|
||||
buf = dma_alloc_coherent(cb_dev, size, iova, GFP_KERNEL);
|
||||
if (!buf)
|
||||
GENI_SE_ERR(geni_se_dev->log_ctx, false, NULL,
|
||||
GENI_LOG_ERR(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: Failed dma_alloc_coherent\n", __func__);
|
||||
return buf;
|
||||
}
|
||||
@ -1550,7 +1589,8 @@ void geni_se_dump_dbg_regs(struct se_geni_rsc *rsc, void __iomem *base,
|
||||
if (!geni_se_dev)
|
||||
return;
|
||||
if (unlikely(list_empty(&rsc->ab_list) || list_empty(&rsc->ib_list))) {
|
||||
GENI_SE_DBG(ipc, false, NULL, "%s: Clocks not on\n", __func__);
|
||||
GENI_LOG_DBG(ipc, false, geni_se_dev->dev, "%s: %s: Clocks not on\n",
|
||||
__func__, dev_name(rsc->ctrl_dev));
|
||||
return;
|
||||
}
|
||||
m_cmd0 = geni_read_reg(base, SE_GENI_M_CMD0);
|
||||
@ -1574,21 +1614,22 @@ void geni_se_dump_dbg_regs(struct se_geni_rsc *rsc, void __iomem *base,
|
||||
geni_dma_tx_irq_en = geni_read_reg(base, SE_DMA_TX_IRQ_EN);
|
||||
geni_dma_rx_irq_en = geni_read_reg(base, SE_DMA_RX_IRQ_EN);
|
||||
|
||||
GENI_SE_DBG(ipc, false, NULL,
|
||||
"%s: m_cmd0:0x%x, m_irq_status:0x%x, geni_status:0x%x, geni_ios:0x%x\n",
|
||||
__func__, m_cmd0, m_irq_status, geni_status, geni_ios);
|
||||
GENI_SE_DBG(ipc, false, NULL,
|
||||
"dma_rx_irq:0x%x, dma_tx_irq:0x%x, rx_fifo_sts:0x%x, tx_fifo_sts:0x%x\n"
|
||||
, dma_rx_irq, dma_tx_irq, rx_fifo_status, tx_fifo_status);
|
||||
GENI_SE_DBG(ipc, false, NULL,
|
||||
"se_dma_dbg:0x%x, m_cmd_ctrl:0x%x, dma_rxlen:0x%x, dma_rxlen_in:0x%x\n",
|
||||
se_dma_dbg, m_cmd_ctrl, se_dma_rx_len, se_dma_rx_len_in);
|
||||
GENI_SE_DBG(ipc, false, NULL,
|
||||
"dma_txlen:0x%x, dma_txlen_in:0x%x s_irq_status:0x%x\n",
|
||||
se_dma_tx_len, se_dma_tx_len_in, s_irq_status);
|
||||
GENI_SE_DBG(ipc, false, NULL,
|
||||
"dma_txirq_en:0x%x, dma_rxirq_en:0x%x geni_m_irq_en:0x%x geni_s_irq_en:0x%x\n",
|
||||
geni_dma_tx_irq_en, geni_dma_rx_irq_en, geni_m_irq_en, geni_s_irq_en);
|
||||
GENI_LOG_DBG(ipc, false, geni_se_dev->dev,
|
||||
"%s: %s: m_cmd0:0x%x, m_irq_status:0x%x, geni_status:0x%x, geni_ios:0x%x\n",
|
||||
__func__, dev_name(rsc->ctrl_dev), m_cmd0, m_irq_status, geni_status, geni_ios);
|
||||
GENI_LOG_DBG(ipc, false, geni_se_dev->dev,
|
||||
"%s: dma_rx_irq:0x%x, dma_tx_irq:0x%x, rx_fifo_sts:0x%x, tx_fifo_sts:0x%x\n",
|
||||
dev_name(rsc->ctrl_dev), dma_rx_irq, dma_tx_irq, rx_fifo_status, tx_fifo_status);
|
||||
GENI_LOG_DBG(ipc, false, geni_se_dev->dev,
|
||||
"%s: se_dma_dbg:0x%x, m_cmd_ctrl:0x%x, dma_rxlen:0x%x, dma_rxlen_in:0x%x\n",
|
||||
dev_name(rsc->ctrl_dev), se_dma_dbg, m_cmd_ctrl, se_dma_rx_len, se_dma_rx_len_in);
|
||||
GENI_LOG_DBG(ipc, false, geni_se_dev->dev,
|
||||
"%s: dma_txlen:0x%x, dma_txlen_in:0x%x s_irq_status:0x%x\n",
|
||||
dev_name(rsc->ctrl_dev), se_dma_tx_len, se_dma_tx_len_in, s_irq_status);
|
||||
GENI_LOG_DBG(ipc, false, geni_se_dev->dev,
|
||||
"%s: dma_txirq_en:0x%x, dma_rxirq_en:0x%x geni_m_irq_en:0x%x geni_s_irq_en:0x%x\n",
|
||||
dev_name(rsc->ctrl_dev), geni_dma_tx_irq_en, geni_dma_rx_irq_en, geni_m_irq_en,
|
||||
geni_s_irq_en);
|
||||
}
|
||||
EXPORT_SYMBOL(geni_se_dump_dbg_regs);
|
||||
|
||||
@ -1616,7 +1657,7 @@ static int geni_se_iommu_probe(struct device *dev)
|
||||
geni_se_dev = dev_get_drvdata(dev->parent);
|
||||
geni_se_dev->cb_dev = dev;
|
||||
|
||||
GENI_SE_DBG(geni_se_dev->log_ctx, false, NULL,
|
||||
GENI_LOG_DBG(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: Probe successful\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
@ -1707,7 +1748,7 @@ static int geni_se_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
GENI_SE_DBG(geni_se_dev->log_ctx, false, NULL,
|
||||
GENI_LOG_DBG(geni_se_dev->log_ctx, false, geni_se_dev->dev,
|
||||
"%s: Probe successful\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
46
drivers/platform/msm/qup-common-trace.h
Normal file
46
drivers/platform/msm/qup-common-trace.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM qup_common_trace
|
||||
|
||||
#if !defined(_TRACE_GENI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_GENI_TRACE_H
|
||||
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
#define MAX_MSG_LEN 256
|
||||
|
||||
TRACE_EVENT(geni_log_info,
|
||||
|
||||
TP_PROTO(const char *name, struct va_format *vaf),
|
||||
|
||||
TP_ARGS(name, vaf),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, name)
|
||||
__dynamic_array(char, msg, MAX_MSG_LEN)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
|
||||
MAX_MSG_LEN, vaf->fmt,
|
||||
*vaf->va) >= MAX_MSG_LEN);
|
||||
),
|
||||
|
||||
TP_printk("%s: %s", __get_str(name), __get_str(msg))
|
||||
);
|
||||
|
||||
#endif /* _TRACE_GENI_TRACE_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
#define TRACE_INCLUDE_FILE qup-common-trace
|
||||
#include <trace/define_trace.h>
|
||||
|
||||
|
@ -104,6 +104,36 @@
|
||||
#define RX_IO_EN2CORE_EN_DELAY_SHFT 8
|
||||
#define RX_SI_EN2IO_DELAY_SHFT 12
|
||||
|
||||
#define SPI_LOG_DBG(log_ctx, print, dev, x...) do { \
|
||||
GENI_SE_DBG(log_ctx, print, dev, x); \
|
||||
if (dev) \
|
||||
spi_trace_log(dev, x); \
|
||||
} while (0)
|
||||
|
||||
#define SPI_LOG_ERR(log_ctx, print, dev, x...) do { \
|
||||
GENI_SE_ERR(log_ctx, print, dev, x); \
|
||||
if (dev) \
|
||||
spi_trace_log(dev, x); \
|
||||
} while (0)
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "spi-qup-trace.h"
|
||||
|
||||
/* FTRACE Logging */
|
||||
void spi_trace_log(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
struct va_format vaf = {
|
||||
.fmt = fmt,
|
||||
};
|
||||
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
vaf.va = &args;
|
||||
trace_spi_log_info(dev_name(dev), &vaf);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
struct gsi_desc_cb {
|
||||
struct spi_master *spi;
|
||||
struct spi_transfer *xfer;
|
||||
@ -240,7 +270,7 @@ static void spi_setup_word_len(struct spi_geni_master *mas, u32 mode,
|
||||
geni_write_reg(word_len, mas->base, SE_SPI_WORD_LEN);
|
||||
se_get_packing_config(bits_per_word, pack_words, msb_first,
|
||||
&cfg0, &cfg1);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s: cfg0 %lu cfg1 %lu bpw %d pack_words %d\n", __func__,
|
||||
cfg0, cfg1, bits_per_word, pack_words);
|
||||
}
|
||||
@ -317,10 +347,10 @@ static int setup_fifo_params(struct spi_device *spi_slv,
|
||||
geni_write_reg(clk_sel, mas->base, SE_GENI_CLK_SEL);
|
||||
geni_write_reg(m_clk_cfg, mas->base, GENI_SER_M_CLK_CFG);
|
||||
geni_write_reg(spi_delay_params, mas->base, SE_SPI_DELAY_COUNTERS);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s:Loopback%d demux_sel0x%x demux_op_inv 0x%x clk_cfg 0x%x\n",
|
||||
__func__, loopback_cfg, demux_sel, demux_output_inv, m_clk_cfg);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s:clk_sel 0x%x cpol %d cpha %d delay 0x%x\n", __func__,
|
||||
clk_sel, cpol, cpha, spi_delay_params);
|
||||
/* Ensure message level attributes are written before returning */
|
||||
@ -414,10 +444,10 @@ static struct msm_gpi_tre *setup_config0_tre(struct spi_transfer *xfer,
|
||||
inter_words_delay);
|
||||
c0_tre->dword[2] = MSM_GPI_SPI_CONFIG0_TRE_DWORD2(idx, div);
|
||||
c0_tre->dword[3] = MSM_GPI_SPI_CONFIG0_TRE_DWORD3(0, 0, 0, 0, 1);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s: flags 0x%x word %d pack %d idx %d div %d\n",
|
||||
__func__, flags, word_len, pack, idx, div);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s: cs_clk_delay %d inter_words_delay %d\n", __func__,
|
||||
cs_clk_delay, inter_words_delay);
|
||||
return c0_tre;
|
||||
@ -451,7 +481,7 @@ static struct msm_gpi_tre *setup_go_tre(int cmd, int cs, int rx_len, int flags,
|
||||
link_rx = 1;
|
||||
go_tre->dword[3] = MSM_GPI_SPI_GO_TRE_DWORD3(link_rx, 0, eot, eob,
|
||||
chain);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s: rx len %d flags 0x%x cs %d cmd %d eot %d eob %d chain %d\n",
|
||||
__func__, rx_len, flags, cs, cmd, eot, eob, chain);
|
||||
return go_tre;
|
||||
@ -494,7 +524,7 @@ static void spi_gsi_ch_cb(struct dma_chan *ch, struct msm_gpi_cb const *cb,
|
||||
switch (cb->cb_event) {
|
||||
case MSM_GPI_QUP_NOTIFY:
|
||||
case MSM_GPI_QUP_MAX_EVENT:
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s:cb_ev%d status%llu ts%llu count%llu\n",
|
||||
__func__, cb->cb_event, cb->status,
|
||||
cb->timestamp, cb->count);
|
||||
@ -505,11 +535,11 @@ static void spi_gsi_ch_cb(struct dma_chan *ch, struct msm_gpi_cb const *cb,
|
||||
case MSM_GPI_QUP_PENDING_EVENT:
|
||||
case MSM_GPI_QUP_EOT_DESC_MISMATCH:
|
||||
case MSM_GPI_QUP_SW_ERROR:
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: cb_ev %d status %llu ts %llu count %llu\n",
|
||||
__func__, cb->cb_event, cb->status,
|
||||
cb->timestamp, cb->count);
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"err.routine %u, err.type %u, err.code %u\n",
|
||||
cb->error_log.routine,
|
||||
cb->error_log.type,
|
||||
@ -533,16 +563,16 @@ static void spi_gsi_rx_callback(void *cb)
|
||||
|
||||
if (xfer->rx_buf) {
|
||||
if (cb_param->status == MSM_GPI_TCE_UNEXP_ERR) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: Unexpected GSI CB error\n", __func__);
|
||||
return;
|
||||
}
|
||||
if (cb_param->length == xfer->len) {
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s\n", __func__);
|
||||
complete(&mas->rx_cb);
|
||||
} else {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: Length mismatch. Expected %d Callback %d\n",
|
||||
__func__, xfer->len, cb_param->length);
|
||||
}
|
||||
@ -565,7 +595,7 @@ static void spi_gsi_tx_callback(void *cb)
|
||||
* callback for lock/unlock tre being submitted.
|
||||
*/
|
||||
if (!xfer) {
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"Lock/unlock IEOB received %s\n", __func__);
|
||||
complete(&mas->tx_cb);
|
||||
return;
|
||||
@ -573,16 +603,16 @@ static void spi_gsi_tx_callback(void *cb)
|
||||
|
||||
if (xfer->tx_buf) {
|
||||
if (cb_param->status == MSM_GPI_TCE_UNEXP_ERR) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: Unexpected GSI CB error\n", __func__);
|
||||
return;
|
||||
}
|
||||
if (cb_param->length == xfer->len) {
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s\n", __func__);
|
||||
complete(&mas->tx_cb);
|
||||
} else {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: Length mismatch. Expected %d Callback %d\n",
|
||||
__func__, xfer->len, cb_param->length);
|
||||
}
|
||||
@ -608,7 +638,7 @@ static int spi_geni_lock_bus(struct spi_master *spi)
|
||||
|
||||
reinit_completion(&mas->tx_cb);
|
||||
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev, "%s\n", __func__);
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev, "%s\n", __func__);
|
||||
|
||||
lock_t = setup_lock_tre(mas);
|
||||
sg_init_table(xfer_tx_sg, 1);
|
||||
@ -637,7 +667,7 @@ static int spi_geni_lock_bus(struct spi_master *spi)
|
||||
timeout = wait_for_completion_timeout(&mas->tx_cb,
|
||||
msecs_to_jiffies(SPI_XFER_TIMEOUT_MS));
|
||||
if (timeout <= 0) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s failed\n", __func__);
|
||||
geni_se_dump_dbg_regs(&mas->spi_rsc, mas->base, mas->ipc);
|
||||
ret = -ETIMEDOUT;
|
||||
@ -660,10 +690,10 @@ static void spi_geni_unlock_bus(struct spi_master *spi)
|
||||
|
||||
reinit_completion(&mas->tx_cb);
|
||||
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev, "%s\n", __func__);
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev, "%s\n", __func__);
|
||||
|
||||
if (mas->gpi_reset) {
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev, "GPI Reset required\n");
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev, "GPI Reset required\n");
|
||||
goto err_spi_geni_unlock_bus;
|
||||
}
|
||||
|
||||
@ -694,7 +724,7 @@ static void spi_geni_unlock_bus(struct spi_master *spi)
|
||||
timeout = wait_for_completion_timeout(&mas->tx_cb,
|
||||
msecs_to_jiffies(SPI_XFER_TIMEOUT_MS));
|
||||
if (timeout <= 0) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s failed\n", __func__);
|
||||
geni_se_dump_dbg_regs(&mas->spi_rsc, mas->base, mas->ipc);
|
||||
ret = -ETIMEDOUT;
|
||||
@ -866,7 +896,7 @@ static int spi_geni_map_buf(struct spi_geni_master *mas,
|
||||
&xfer->rx_dma, xfer->rx_buf,
|
||||
xfer->len, DMA_FROM_DEVICE);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: Mapping Rx buffer %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -878,7 +908,7 @@ static int spi_geni_map_buf(struct spi_geni_master *mas,
|
||||
(void *)xfer->tx_buf,
|
||||
xfer->len, DMA_TO_DEVICE);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: Mapping Tx buffer %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -913,7 +943,7 @@ static int spi_geni_prepare_message(struct spi_master *spi,
|
||||
if (mas->setup) {
|
||||
/* Client to respect system suspend */
|
||||
if (!pm_runtime_enabled(mas->dev)) {
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"%s: System suspended\n", __func__);
|
||||
return -EACCES;
|
||||
}
|
||||
@ -935,7 +965,7 @@ static int spi_geni_prepare_message(struct spi_master *spi,
|
||||
count =
|
||||
atomic_read(&mas->dev->power.usage_count);
|
||||
if (count <= 0)
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"resume usage count mismatch:%d",
|
||||
count);
|
||||
}
|
||||
@ -946,7 +976,7 @@ static int spi_geni_prepare_message(struct spi_master *spi,
|
||||
if (mas->shared_se) {
|
||||
ret = spi_geni_lock_bus(spi);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s failed: %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -992,7 +1022,7 @@ static int spi_geni_unprepare_message(struct spi_master *spi_mas,
|
||||
pm_runtime_put_sync(mas->dev);
|
||||
count = atomic_read(&mas->dev->power.usage_count);
|
||||
if (count < 0)
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"suspend usage count mismatch:%d",
|
||||
count);
|
||||
} else {
|
||||
@ -1049,7 +1079,7 @@ static void spi_geni_set_sampling_rate(struct spi_geni_master *mas,
|
||||
cfg_reg109 = geni_read_reg(mas->base, SE_GENI_CFG_REG109);
|
||||
cfg_seq_start = geni_read_reg(mas->base, SE_GENI_CFG_SEQ_START);
|
||||
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s cfg108: 0x%x cfg109: 0x%x cfg_seq_start: 0x%x\n",
|
||||
__func__, cfg_reg108, cfg_reg109, cfg_seq_start);
|
||||
}
|
||||
@ -1177,7 +1207,7 @@ static int spi_geni_mas_setup(struct spi_master *spi)
|
||||
else {
|
||||
if ((major == 1) && (minor == 0))
|
||||
mas->oversampling = 2;
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s:Major:%d Minor:%d step:%dos%d\n",
|
||||
__func__, major, minor, step, mas->oversampling);
|
||||
}
|
||||
@ -1185,7 +1215,7 @@ static int spi_geni_mas_setup(struct spi_master *spi)
|
||||
spi_geni_set_sampling_rate(mas, major, minor);
|
||||
|
||||
if (mas->dis_autosuspend)
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"Auto Suspend is disabled\n");
|
||||
return ret;
|
||||
}
|
||||
@ -1209,7 +1239,7 @@ static int spi_geni_prepare_transfer_hardware(struct spi_master *spi)
|
||||
|
||||
/* Client to respect system suspend */
|
||||
if (!pm_runtime_enabled(mas->dev)) {
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"%s: System suspended\n", __func__);
|
||||
return -EACCES;
|
||||
}
|
||||
@ -1222,7 +1252,7 @@ static int spi_geni_prepare_transfer_hardware(struct spi_master *spi)
|
||||
ret = pinctrl_select_state(rsc->geni_pinctrl,
|
||||
rsc->geni_gpio_active);
|
||||
if (ret)
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"%s: Error %d pinctrl_select_state\n", __func__, ret);
|
||||
}
|
||||
|
||||
@ -1242,7 +1272,7 @@ static int spi_geni_prepare_transfer_hardware(struct spi_master *spi)
|
||||
if (!mas->setup) {
|
||||
ret = spi_geni_mas_setup(spi);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s mas_setup failed: %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -1252,7 +1282,7 @@ static int spi_geni_prepare_transfer_hardware(struct spi_master *spi)
|
||||
if (mas->dis_autosuspend) {
|
||||
count = atomic_read(&mas->dev->power.usage_count);
|
||||
if (count <= 0)
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"resume usage count mismatch:%d", count);
|
||||
}
|
||||
}
|
||||
@ -1280,7 +1310,7 @@ static int spi_geni_unprepare_transfer_hardware(struct spi_master *spi)
|
||||
ret = pinctrl_select_state(rsc->geni_pinctrl,
|
||||
rsc->geni_gpio_sleep);
|
||||
if (ret)
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"%s: Error %d pinctrl_select_state\n", __func__, ret);
|
||||
}
|
||||
|
||||
@ -1288,7 +1318,7 @@ static int spi_geni_unprepare_transfer_hardware(struct spi_master *spi)
|
||||
pm_runtime_put_sync(mas->dev);
|
||||
count = atomic_read(&mas->dev->power.usage_count);
|
||||
if (count < 0)
|
||||
GENI_SE_ERR(mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(mas->ipc, false, mas->dev,
|
||||
"suspend usage count mismatch:%d", count);
|
||||
} else {
|
||||
pm_runtime_mark_last_busy(mas->dev);
|
||||
@ -1383,7 +1413,7 @@ static int setup_fifo_xfer(struct spi_transfer *xfer,
|
||||
|
||||
geni_write_reg(spi_tx_cfg, mas->base, SE_SPI_TRANS_CFG);
|
||||
geni_setup_m_cmd(mas->base, m_cmd, m_param);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s: trans_len %d xferlen%d tx_cfg 0x%x cmd 0x%x cs%d mode%d\n",
|
||||
__func__, trans_len, xfer->len, spi_tx_cfg, m_cmd,
|
||||
xfer->cs_change, mas->cur_xfer_mode);
|
||||
@ -1391,7 +1421,7 @@ static int setup_fifo_xfer(struct spi_transfer *xfer,
|
||||
ret = geni_se_rx_dma_prep(mas->wrapper_dev, mas->base,
|
||||
xfer->rx_buf, xfer->len, &xfer->rx_dma);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"Failed to setup Rx dma %d\n", ret);
|
||||
xfer->rx_dma = 0;
|
||||
return ret;
|
||||
@ -1406,7 +1436,7 @@ static int setup_fifo_xfer(struct spi_transfer *xfer,
|
||||
(void *)xfer->tx_buf, xfer->len,
|
||||
&xfer->tx_dma);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"Failed to setup tx dma %d\n", ret);
|
||||
xfer->tx_dma = 0;
|
||||
return ret;
|
||||
@ -1497,7 +1527,7 @@ static int spi_geni_transfer_one(struct spi_master *spi,
|
||||
* to not allow system suspend to trigger.
|
||||
*/
|
||||
if (pm_runtime_status_suspended(mas->dev)) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"%s: device is PM suspended\n", __func__);
|
||||
return -EACCES;
|
||||
}
|
||||
@ -1506,7 +1536,7 @@ static int spi_geni_transfer_one(struct spi_master *spi,
|
||||
reinit_completion(&mas->xfer_done);
|
||||
ret = setup_fifo_xfer(xfer, mas, slv->mode, spi);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"setup_fifo_xfer failed: %d\n", ret);
|
||||
mas->cur_xfer = NULL;
|
||||
goto err_fifo_geni_transfer_one;
|
||||
@ -1515,7 +1545,7 @@ static int spi_geni_transfer_one(struct spi_master *spi,
|
||||
timeout = wait_for_completion_timeout(&mas->xfer_done,
|
||||
msecs_to_jiffies(SPI_XFER_TIMEOUT_MS));
|
||||
if (!timeout) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"Xfer[len %d tx %pK rx %pK n %d] timed out.\n",
|
||||
xfer->len, xfer->tx_buf,
|
||||
xfer->rx_buf,
|
||||
@ -1542,7 +1572,7 @@ static int spi_geni_transfer_one(struct spi_master *spi,
|
||||
|
||||
ret = setup_gsi_xfer(xfer, mas, slv, spi);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"setup_gsi_xfer failed: %d\n", ret);
|
||||
mas->cur_xfer = NULL;
|
||||
goto err_gsi_geni_transfer_one;
|
||||
@ -1558,7 +1588,7 @@ static int spi_geni_transfer_one(struct spi_master *spi,
|
||||
&mas->tx_cb,
|
||||
msecs_to_jiffies(SPI_XFER_TIMEOUT_MS));
|
||||
if (timeout <= 0) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"Tx[%d] timeout%lu\n", i, timeout);
|
||||
ret = -ETIMEDOUT;
|
||||
goto err_gsi_geni_transfer_one;
|
||||
@ -1570,7 +1600,7 @@ static int spi_geni_transfer_one(struct spi_master *spi,
|
||||
&mas->rx_cb,
|
||||
msecs_to_jiffies(SPI_XFER_TIMEOUT_MS));
|
||||
if (timeout <= 0) {
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"Rx[%d] timeout%lu\n", i, timeout);
|
||||
ret = -ETIMEDOUT;
|
||||
goto err_gsi_geni_transfer_one;
|
||||
@ -1593,7 +1623,7 @@ static int spi_geni_transfer_one(struct spi_master *spi,
|
||||
ret = dmaengine_pause(mas->tx);
|
||||
if (ret) {
|
||||
mas->gpi_reset = true;
|
||||
GENI_SE_ERR(mas->ipc, true, mas->dev,
|
||||
SPI_LOG_ERR(mas->ipc, true, mas->dev,
|
||||
"Channel cancel failed\n");
|
||||
}
|
||||
}
|
||||
@ -1710,7 +1740,7 @@ static irqreturn_t geni_spi_irq(int irq, void *data)
|
||||
u32 m_irq = 0;
|
||||
|
||||
if (pm_runtime_status_suspended(mas->dev)) {
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s: device is suspended\n", __func__);
|
||||
goto exit_geni_spi_irq;
|
||||
}
|
||||
@ -1737,13 +1767,13 @@ static irqreturn_t geni_spi_irq(int irq, void *data)
|
||||
if (mas->tx_rem_bytes) {
|
||||
geni_write_reg(0, mas->base,
|
||||
SE_GENI_TX_WATERMARK_REG);
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s:Premature Done.tx_rem%d bpw%d\n",
|
||||
__func__, mas->tx_rem_bytes,
|
||||
mas->cur_word_len);
|
||||
}
|
||||
if (mas->rx_rem_bytes)
|
||||
GENI_SE_DBG(mas->ipc, false, mas->dev,
|
||||
SPI_LOG_DBG(mas->ipc, false, mas->dev,
|
||||
"%s:Premature Done.rx_rem%d bpw%d\n",
|
||||
__func__, mas->rx_rem_bytes,
|
||||
mas->cur_word_len);
|
||||
@ -2046,7 +2076,7 @@ static int spi_geni_runtime_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
GENI_SE_DBG(geni_mas->ipc, false, NULL, "%s:\n", __func__);
|
||||
SPI_LOG_DBG(geni_mas->ipc, false, geni_mas->dev, "%s:\n", __func__);
|
||||
/* Do not unconfigure the GPIOs for a shared_se usecase */
|
||||
if (geni_mas->shared_ee && !geni_mas->shared_se)
|
||||
goto exit_rt_suspend;
|
||||
@ -2054,7 +2084,7 @@ static int spi_geni_runtime_suspend(struct device *dev)
|
||||
if (geni_mas->gsi_mode) {
|
||||
ret = se_geni_clks_off(&geni_mas->spi_rsc);
|
||||
if (ret)
|
||||
GENI_SE_ERR(geni_mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(geni_mas->ipc, false, geni_mas->dev,
|
||||
"%s: Error %d turning off clocks\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -2074,7 +2104,7 @@ static int spi_geni_runtime_resume(struct device *dev)
|
||||
if (!geni_mas->setup) {
|
||||
ret = spi_geni_mas_setup(spi);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(geni_mas->ipc, true, NULL,
|
||||
SPI_LOG_ERR(geni_mas->ipc, true, geni_mas->dev,
|
||||
"%s mas_setup failed: %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -2082,7 +2112,7 @@ static int spi_geni_runtime_resume(struct device *dev)
|
||||
|
||||
ret = spi_geni_lock_bus(spi);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(geni_mas->ipc, true, NULL,
|
||||
SPI_LOG_ERR(geni_mas->ipc, true, geni_mas->dev,
|
||||
"%s lock_bus failed: %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -2090,7 +2120,7 @@ static int spi_geni_runtime_resume(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
GENI_SE_DBG(geni_mas->ipc, false, NULL, "%s:\n", __func__);
|
||||
SPI_LOG_DBG(geni_mas->ipc, false, geni_mas->dev, "%s:\n", __func__);
|
||||
|
||||
if (geni_mas->shared_ee)
|
||||
goto exit_rt_resume;
|
||||
@ -2098,7 +2128,7 @@ static int spi_geni_runtime_resume(struct device *dev)
|
||||
if (geni_mas->gsi_mode) {
|
||||
ret = se_geni_clks_on(&geni_mas->spi_rsc);
|
||||
if (ret)
|
||||
GENI_SE_ERR(geni_mas->ipc, false, NULL,
|
||||
SPI_LOG_ERR(geni_mas->ipc, false, geni_mas->dev,
|
||||
"%s: Error %d turning on clocks\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -2122,11 +2152,11 @@ static int spi_geni_suspend(struct device *dev)
|
||||
struct spi_geni_master *geni_mas = spi_master_get_devdata(spi);
|
||||
|
||||
if (list_empty(&spi->queue) && !spi->cur_msg) {
|
||||
GENI_SE_ERR(geni_mas->ipc, true, dev,
|
||||
SPI_LOG_ERR(geni_mas->ipc, true, dev,
|
||||
"%s: Force suspend", __func__);
|
||||
ret = spi_geni_runtime_suspend(dev);
|
||||
if (ret) {
|
||||
GENI_SE_ERR(geni_mas->ipc, true, dev,
|
||||
SPI_LOG_ERR(geni_mas->ipc, true, dev,
|
||||
"Force suspend Failed:%d", ret);
|
||||
} else {
|
||||
pm_runtime_disable(dev);
|
||||
|
46
drivers/spi/spi-qup-trace.h
Normal file
46
drivers/spi/spi-qup-trace.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM qup_spi_trace
|
||||
|
||||
#if !defined(_TRACE_SPI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_SPI_TRACE_H
|
||||
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
#define MAX_MSG_LEN 256
|
||||
|
||||
TRACE_EVENT(spi_log_info,
|
||||
|
||||
TP_PROTO(const char *name, struct va_format *vaf),
|
||||
|
||||
TP_ARGS(name, vaf),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, name)
|
||||
__dynamic_array(char, msg, MAX_MSG_LEN)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
|
||||
MAX_MSG_LEN, vaf->fmt,
|
||||
*vaf->va) >= MAX_MSG_LEN);
|
||||
),
|
||||
|
||||
TP_printk("%s: %s", __get_str(name), __get_str(msg))
|
||||
);
|
||||
|
||||
#endif /* _TRACE_SPI_TRACE_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
#define TRACE_INCLUDE_FILE spi-qup-trace
|
||||
#include <trace/define_trace.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user