devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
To: linux-i2c@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, wsa@the-dreams.de,
	robert.jarzmik@free.fr, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	Vaibhav Hiremath <vaibhav.hiremath@linaro.org>,
	"Jett.Zhou" <jtzhou@marvell.com>
Subject: [PATCH-v3 05/11] i2c: pxa: Update debug function to dump more info on error
Date: Tue,  7 Jul 2015 00:54:49 +0530	[thread overview]
Message-ID: <1436210695-19159-6-git-send-email-vaibhav.hiremath@linaro.org> (raw)
In-Reply-To: <1436210695-19159-1-git-send-email-vaibhav.hiremath@linaro.org>

Update i2c_pxa_scream_blue_murder() fn to print more information
in case of error.
Also, use dev_err variants instead of printk.

Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Cc: Wolfram Sang <wsa@the-dreams.de>
---
 drivers/i2c/busses/i2c-pxa.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 4c92694..040effa 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -132,6 +132,7 @@ struct pxa_i2c {
 	unsigned int		msg_idx;
 	unsigned int		msg_ptr;
 	unsigned int		slave_addr;
+	unsigned int		req_slave_addr;
 
 	struct i2c_adapter	adap;
 	struct clk		*clk;
@@ -253,15 +254,20 @@ static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname)
 static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
 {
 	unsigned int i;
-	printk(KERN_ERR "i2c: error: %s\n", why);
-	printk(KERN_ERR "i2c: msg_num: %d msg_idx: %d msg_ptr: %d\n",
+	struct device *dev = &i2c->adap.dev;
+
+	dev_err(dev, "slave_0x%x error: %s\n",
+		i2c->req_slave_addr >> 1, why);
+	dev_err(dev, "msg_num: %d msg_idx: %d msg_ptr: %d\n",
 		i2c->msg_num, i2c->msg_idx, i2c->msg_ptr);
-	printk(KERN_ERR "i2c: ICR: %08x ISR: %08x\n",
-	       readl(_ICR(i2c)), readl(_ISR(i2c)));
-	printk(KERN_DEBUG "i2c: log: ");
+	dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n",
+		readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)),
+		readl(_ISR(i2c)));
+	dev_dbg(dev, "log: ");
 	for (i = 0; i < i2c->irqlogidx; i++)
-		printk("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]);
-	printk("\n");
+		pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]);
+
+	pr_debug("\n");
 }
 
 #else /* ifdef DEBUG */
@@ -638,6 +644,7 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
 	 * Step 1: target slave address into IDBR
 	 */
 	writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
+	i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
 
 	/*
 	 * Step 2: initiate the write.
@@ -951,6 +958,7 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
 		 * Write the next address.
 		 */
 		writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
+		i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
 
 		/*
 		 * And trigger a repeated start, and send the byte.
-- 
1.9.1

  parent reply	other threads:[~2015-07-06 19:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 19:24 [PATCH-v3 00/11] i2c: pxa: Fixes, cleanup and support for pxa910 family Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 01/11] i2c: pxa: keep i2c irq ON in suspend Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 02/11] i2c: pxa: No need to set slave addr for i2c master mode reset Vaibhav Hiremath
     [not found]   ` <1436210695-19159-3-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:11     ` Wolfram Sang
2015-07-10 12:38       ` Vaibhav Hiremath
     [not found]         ` <559FBCD3.4050402-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10 14:14           ` Wolfram Sang
2015-07-10 14:25             ` Vaibhav Hiremath
     [not found]               ` <559FD5DB.9030308-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10 14:56                 ` Wolfram Sang
2015-07-13  7:09                   ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 04/11] i2c: pxa: Remove compile warnning in 64bit mode Vaibhav Hiremath
     [not found]   ` <1436210695-19159-5-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:13     ` Wolfram Sang
2015-07-10 13:01       ` Vaibhav Hiremath
2015-07-10  8:25     ` Uwe Kleine-König
2015-07-06 19:24 ` Vaibhav Hiremath [this message]
2015-07-06 19:24 ` [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function Vaibhav Hiremath
     [not found]   ` <1436210695-19159-7-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:18     ` Wolfram Sang
2015-07-06 19:24 ` [PATCH-v3 07/11] i2c: pxa: enable/disable i2c module across msg xfer Vaibhav Hiremath
     [not found]   ` <1436210695-19159-8-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-10  8:24     ` Wolfram Sang
2015-07-13 16:41       ` Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 08/11] Documentation: binding: add new property 'disable_after_xfer' to i2c-pxa Vaibhav Hiremath
     [not found] ` <1436210695-19159-1-git-send-email-vaibhav.hiremath-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-06 19:24   ` [PATCH-v3 03/11] i2c: pxa: Return I2C_RETRY when timeout in pio mode Vaibhav Hiremath
2015-07-06 19:24   ` [PATCH-v3 09/11] i2c: pxa: Add support for pxa910/988 & new configuration features Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 10/11] i2c: pxa: Add ILCR (tLow & tHigh) configuration support Vaibhav Hiremath
2015-07-06 19:24 ` [PATCH-v3 11/11] Documentation: binding: add sclk adjustment properties to i2c-pxa Vaibhav Hiremath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436210695-19159-6-git-send-email-vaibhav.hiremath@linaro.org \
    --to=vaibhav.hiremath@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jtzhou@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.jarzmik@free.fr \
    --cc=robh+dt@kernel.org \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).