From 33a23a92436ce8e76372c68f501ebb9147ada4eb Mon Sep 17 00:00:00 2001 From: Kiran Gunda Date: Thu, 10 Jan 2013 17:03:33 +0530 Subject: [PATCH] slim_msm: Reading the smaller length messages properly If the smaller length messages(<= 4 Bytes) like REPORT_ABSENT are received over slimbus, the master driver is reading the excessive length than required. Due to that the next messages over slimbus are getting corrupted. This patch fixes this issue and also handles the REPORT_ABSENT message sent by the third party slimbus client devices. CRs-Fixed: 431529 Change-Id: I7b3c07a94603482a6a9a7645ade70228144703bc Signed-off-by: Kiran Gunda --- drivers/slimbus/slim-msm-ctrl.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/slimbus/slim-msm-ctrl.c b/drivers/slimbus/slim-msm-ctrl.c index 9b0b8b4a68f..9a864aa80a9 100644 --- a/drivers/slimbus/slim-msm-ctrl.c +++ b/drivers/slimbus/slim-msm-ctrl.c @@ -263,6 +263,17 @@ static irqreturn_t msm_slim_interrupt(int irq, void *d) */ mb(); complete(&dev->rx_msgq_notify); + } else if (mt == SLIM_MSG_MT_CORE && + mc == SLIM_MSG_MC_REPORT_ABSENT) { + writel_relaxed(MGR_INT_RX_MSG_RCVD, dev->base + + MGR_INT_CLR); + /* + * Guarantee that CLR bit write goes through + * before signalling completion + */ + mb(); + complete(&dev->rx_msgq_notify); + } else if (mc == SLIM_MSG_MC_REPLY_INFORMATION || mc == SLIM_MSG_MC_REPLY_VALUE) { msm_slim_rx_enqueue(dev, rx_buf, len); @@ -975,6 +986,10 @@ send_capability: txn.wbuf = wbuf; gen_ack = true; ret = msm_xfer_msg(&dev->ctrl, &txn); + break; + case SLIM_MSG_MC_REPORT_ABSENT: + dev_info(dev->dev, "Received Report Absent Message\n"); + break; default: break; } @@ -1087,7 +1102,8 @@ static int msm_slim_rx_msgq_thread(void *data) laddr = (u8)((buffer[0] >> 16) & 0xff); sat = addr_to_sat(dev, laddr); } - } else if ((index * 4) >= msg_len) { + } + if ((index * 4) >= msg_len) { index = 0; if (sat) { msm_sat_enqueue(sat, buffer, msg_len);