From patchwork Tue Jul 14 07:36:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 51088 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7C46B202B9 for ; Tue, 14 Jul 2015 07:39:52 +0000 (UTC) Received: by lbbpo10 with SMTP id po10sf530242lbb.1 for ; Tue, 14 Jul 2015 00:39:51 -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=wxOdWXCWnMksx+yb/oMmv7o6U3bvGGVIjAesuRoD/rI=; b=M+hFbAnRuiya1YjZ5Vn9ys62t3XYYVW1XslKG/UACPAmLnU4pWC4vxCGaMelO/aotP IR7jkj+f8mELjgqNPRtIjBnNH3G/UxkYP2El8NRh/B8AOuuQ9HUQSJDthzhFKLWBioVG BKUAXlw8hyzc2RIFSQYsXbGyKqpiOi32PdeHK2u7yWdKlHSvmh6UCw4LZo31Uu3/5p9j mOPZehqaNsN8Q0EkUzY54dKg/J/89FDT/Fj7NRHlFTWlPNCZQH1N3zM34cu+eAxXCA7t IuirTlkjjm+PbvX7hqQL/8qDW1JO3lUxv4zhYjjKA3Wa2FjpE/gvHoz+1WDZr9lEOy3B PRzA== X-Gm-Message-State: ALoCoQm8HIxiBE3LyforP3qTlxDngcRy53EM/5DrKLotD8AVVeXnFxNvgpjaiQ/8C40iC4cjKiec X-Received: by 10.112.171.41 with SMTP id ar9mr20471319lbc.24.1436859591463; Tue, 14 Jul 2015 00:39:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.232 with SMTP id d8ls8705lab.13.gmail; Tue, 14 Jul 2015 00:39:51 -0700 (PDT) X-Received: by 10.112.157.36 with SMTP id wj4mr36040105lbb.115.1436859591177; Tue, 14 Jul 2015 00:39:51 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id kw7si136722lac.136.2015.07.14.00.39.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2015 00:39:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lblf12 with SMTP id f12so1080668lbl.2 for ; Tue, 14 Jul 2015 00:39:51 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr35386201lbc.41.1436859591073; Tue, 14 Jul 2015 00:39:51 -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 hn6csp2195168lbb; Tue, 14 Jul 2015 00:39:49 -0700 (PDT) X-Received: by 10.68.206.68 with SMTP id lm4mr77848788pbc.147.1436859589009; Tue, 14 Jul 2015 00:39:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id iw6si274272pbd.183.2015.07.14.00.39.48; Tue, 14 Jul 2015 00:39:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 S1751721AbbGNHjc (ORCPT + 8 others); Tue, 14 Jul 2015 03:39:32 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:33050 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753239AbbGNHj3 (ORCPT ); Tue, 14 Jul 2015 03:39:29 -0400 Received: by padck2 with SMTP id ck2so1387023pad.0 for ; Tue, 14 Jul 2015 00:39:28 -0700 (PDT) X-Received: by 10.66.136.102 with SMTP id pz6mr27727036pab.52.1436859568898; Tue, 14 Jul 2015 00:39:28 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by smtp.gmail.com with ESMTPSA id pe3sm275937pdb.55.2015.07.14.00.39.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jul 2015 00:39:27 -0700 (PDT) From: Vaibhav Hiremath To: linux-i2c@vger.kernel.org Cc: wsa@the-dreams.de, robh+dt@kernel.org, robert.jarzmik@free.fr, yizhang@marvell.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vaibhav Hiremath , "Jett.Zhou" Subject: [PATCH-v4 05/11] i2c: pxa: Update debug function to dump more info on error Date: Tue, 14 Jul 2015 13:06:44 +0530 Message-Id: <1436859410-28878-6-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436859410-28878-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1436859410-28878-1-git-send-email-vaibhav.hiremath@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.217.181 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 d0cc058..beeed7c 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.