From patchwork Mon Jul 6 19:24:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 50783 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0EA85229FC for ; Mon, 6 Jul 2015 19:28:25 +0000 (UTC) Received: by wguu7 with SMTP id u7sf53481536wgu.0 for ; Mon, 06 Jul 2015 12:28:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=utWbcH4BScWQRpyiYJXvXfWRX0wupslw+f1uxqUjF7c=; b=ik0evX3t5qA0voND6JaTSjzuUCxdkPjDhrd3E0fNVE68TSFAZBRiDHvr4irueNn9rP mjgqIUXg4cFCP3SY3aJYGOJjpzPT8NKG4obLmHpjd+yMZ9eHTm5Biul5RrW5rZzTsRCv kY+LquYeV42nMMlT0GsAeFDZ5CxEqhXeJI/1L0qneoxb5wGt4+6zoDcfcDqh9cXLvmGP olJNlpAo4+yXd1VCpsDKc9Vr5kkAJF8ZbI+DbFT1qk0pjPQFGnKTGyXW87m8t0BnaxsJ Q9B0myZ6XG6k4h41aUgyBmcCmm0nLMGAOUciRDrHEa/lnvaAqExNYpnyFqZnM1851eCx jCog== X-Gm-Message-State: ALoCoQlS0vP1H18iivPQlAFk3+UdZNtvSNXyZKLe5jGcHXAKEGitlpxlPxSbDMdlJRVrffbPlwlY X-Received: by 10.112.188.233 with SMTP id gd9mr216723lbc.12.1436210904156; Mon, 06 Jul 2015 12:28:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.184.168 with SMTP id ev8ls702607lac.44.gmail; Mon, 06 Jul 2015 12:28:23 -0700 (PDT) X-Received: by 10.152.234.42 with SMTP id ub10mr441482lac.60.1436210903867; Mon, 06 Jul 2015 12:28:23 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id ld20si14052461lbb.61.2015.07.06.12.28.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 12:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lagc2 with SMTP id c2so166982405lag.3 for ; Mon, 06 Jul 2015 12:28:23 -0700 (PDT) X-Received: by 10.152.88.77 with SMTP id be13mr354558lab.112.1436210903330; Mon, 06 Jul 2015 12:28:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1921273lbb; Mon, 6 Jul 2015 12:28:22 -0700 (PDT) X-Received: by 10.66.221.163 with SMTP id qf3mr722890pac.129.1436210899931; Mon, 06 Jul 2015 12:28:19 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k16si30478462pdm.244.2015.07.06.12.28.18; Mon, 06 Jul 2015 12:28:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755169AbbGFT2E (ORCPT + 29 others); Mon, 6 Jul 2015 15:28:04 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34045 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755005AbbGFT17 (ORCPT ); Mon, 6 Jul 2015 15:27:59 -0400 Received: by pabvl15 with SMTP id vl15so99976654pab.1 for ; Mon, 06 Jul 2015 12:27:59 -0700 (PDT) X-Received: by 10.66.65.228 with SMTP id a4mr786805pat.65.1436210878956; Mon, 06 Jul 2015 12:27:58 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id x7sm19293964pas.28.2015.07.06.12.27.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 12:27:57 -0700 (PDT) From: Vaibhav Hiremath 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 , "Jett.Zhou" 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 Message-Id: <1436210695-19159-6-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436210695-19159-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1436210695-19159-1-git-send-email-vaibhav.hiremath@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vaibhav.hiremath@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Signed-off-by: Vaibhav Hiremath Cc: Wolfram Sang --- 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.