Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1290265ybh; Thu, 23 Jul 2020 05:22:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXZaILWzgsy+BrycP8katwdbaz0j1zStIeuJsAMr03c1Yfn6SAEzao5D0BuO2YEyvBVrK8 X-Received: by 2002:a17:906:408c:: with SMTP id u12mr4008617ejj.162.1595506956813; Thu, 23 Jul 2020 05:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595506956; cv=none; d=google.com; s=arc-20160816; b=q5IVMP/JKaseJfgY8VKdp6jKpxTNezdhBbOtGFmLZNbm94qNvkMmshwzPhwWBhZeOC dqi46SDPptTabaUA97m4pLNNsZrcobyfItrH1UAqa6IMRK5aAl4JjcBI67uU7voJ9Lcp OmyBxesDmQANmeyDq74oNd5aIvQ/WsiaN3fkPBkZaeysRKiDUrIzcS0QtArs7JsAB5eO 92VR3O//sMUD7SO0I1PNExYsQEHrXGu72sU3ghEFDtJyJKTkHBnkKkhGwViOM1vYukK3 6VV9X3+k/N3yIjWtewTgLZbz7Q9ddUS9H71XM8YHR904wvwITPXcH8+oflMz69TLmhFH kgEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=R11Ga9WFE2Eiv4ttDZrrlRWyR6LeF2U8LlGpsShfusY=; b=RAsH1aWHMaOL9NtJm2xok1GGUwqjY2o0pQ4iKSNE9xuqAD2nSuLPcz+gow/0jSeosV 81SSVab4WfyFohl9i6ItEwc4YdhwN0Slqx5mwkgj40RgYiFWlTWJD8I+Z0iiLVeGNCHe 0O7EyUFeYysoFHq7MdZagebWN7XVNY6bSWxw6PI0zxdlLUpvvhZ7uIJs0rSKxLMaPOS8 9433u7rNDsG+0TpkIAok3tIeUnx69OiyvUE+PExpYuOav4IISI0k4QG0ayPmEqOEcgdf zY+jhc47FiUiLbkYdmuiSCRDpQppYdereE8nWukR/KNpe/f4+ZftVo16AXAkVxxB+Pa7 t6bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=c5DauvVD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si1795707edv.245.2020.07.23.05.22.14; Thu, 23 Jul 2020 05:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=c5DauvVD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728848AbgGWMT2 (ORCPT + 99 others); Thu, 23 Jul 2020 08:19:28 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:19183 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728806AbgGWMT1 (ORCPT ); Thu, 23 Jul 2020 08:19:27 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 23 Jul 2020 05:17:24 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 23 Jul 2020 05:19:26 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 23 Jul 2020 05:19:26 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 23 Jul 2020 12:19:26 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 23 Jul 2020 12:19:26 +0000 Received: from kyarlagadda-linux.nvidia.com (Not Verified[10.19.64.169]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 23 Jul 2020 05:19:25 -0700 From: Krishna Yarlagadda To: , , CC: , , , , , , Krishna Yarlagadda Subject: [PATCH 7/7] i2c: tegra: dump I2C registers on timeout Date: Thu, 23 Jul 2020 17:48:53 +0530 Message-ID: <1595506733-10307-7-git-send-email-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595506733-10307-1-git-send-email-kyarlagadda@nvidia.com> References: <1595506733-10307-1-git-send-email-kyarlagadda@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1595506644; bh=R11Ga9WFE2Eiv4ttDZrrlRWyR6LeF2U8LlGpsShfusY=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=c5DauvVDYBkxNG6Rd4TruvpOuOmBI8mIup3ch/VzXJrwnYN42hMmTlkhxAAAVI14r H4rj/QBSFxt1N8zSYsr5Z6MiMam+697tDp4rC5I2fIO+y7ZEU8m4ZTDqw3nhRuKFU3 RBRNeAb/DUbSvpMrLRTRwRVRKgmnhgocj9h4kM3zmQN92mOvtKyOpdk0rme32WqM0i um0MCis4U5obZd9e5NP2xBle1rZ7qFheseow3ljjDvAntcATOEjtbZyT+gqm8VtDcb bLLM0azOwzw1PeYq9LE6RrpaRSkMWu1Qzc41sjPfl9tqOu9B3hucLMUSrVnzn3DfA9 uvUQ1qyWjP+oA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajesh Gumasta Dump I2C regsiters for debug when transfer timeout occurs. Signed-off-by: Rajesh Gumasta Signed-off-by: Krishna Yarlagadda --- drivers/i2c/busses/i2c-tegra.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 77198fc..cdc8664 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -126,6 +126,8 @@ #define I2C_HS_INTERFACE_TIMING_THD_STA GENMASK(13, 8) #define I2C_HS_INTERFACE_TIMING_TSU_STA GENMASK(5, 0) +#define I2C_MST_PACKET_TRANSFER_CNT_STATUS 0x0b0 + #define I2C_MST_FIFO_CONTROL 0x0b4 #define I2C_MST_FIFO_CONTROL_RX_FLUSH BIT(0) #define I2C_MST_FIFO_CONTROL_TX_FLUSH BIT(1) @@ -1178,6 +1180,33 @@ static int tegra_i2c_issue_bus_clear(struct i2c_adapter *adap) return -EAGAIN; } +static void tegra_i2c_reg_dump(struct tegra_i2c_dev *i2c_dev) +{ + dev_dbg(i2c_dev->dev, "--- register dump for debugging ----\n"); + dev_dbg(i2c_dev->dev, "I2C_CNFG - 0x%x\n", + i2c_readl(i2c_dev, I2C_CNFG)); + dev_dbg(i2c_dev->dev, "I2C_PACKET_TRANSFER_STATUS - 0x%x\n", + i2c_readl(i2c_dev, I2C_PACKET_TRANSFER_STATUS)); + dev_dbg(i2c_dev->dev, "I2C_FIFO_CONTROL - 0x%x\n", + i2c_readl(i2c_dev, I2C_FIFO_CONTROL)); + dev_dbg(i2c_dev->dev, "I2C_FIFO_STATUS - 0x%x\n", + i2c_readl(i2c_dev, I2C_FIFO_STATUS)); + + if (i2c_dev->hw->has_mst_fifo) { + dev_dbg(i2c_dev->dev, "I2C_MST_FIFO_CONTROL - 0x%x\n", + i2c_readl(i2c_dev, I2C_MST_FIFO_CONTROL)); + dev_dbg(i2c_dev->dev, "I2C_MST_FIFO_STATUS - 0x%x\n", + i2c_readl(i2c_dev, I2C_MST_FIFO_STATUS)); + dev_dbg(i2c_dev->dev, "I2C_MST_PACKET_TRANSFER_CNT - 0x%x\n", + i2c_readl(i2c_dev, + I2C_MST_PACKET_TRANSFER_CNT_STATUS)); + } + dev_dbg(i2c_dev->dev, "I2C_INT_MASK - 0x%x\n", + i2c_readl(i2c_dev, I2C_INT_MASK)); + dev_dbg(i2c_dev->dev, "I2C_INT_STATUS - 0x%x\n", + i2c_readl(i2c_dev, I2C_INT_STATUS)); +} + static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, struct i2c_msg *msg, enum msg_end_type end_state) @@ -1331,6 +1360,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, if (!time_left && !completion_done(&i2c_dev->dma_complete)) { dev_err(i2c_dev->dev, "DMA transfer timeout\n"); + tegra_i2c_reg_dump(i2c_dev); tegra_i2c_init(i2c_dev, true); return -ETIMEDOUT; } @@ -1352,6 +1382,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, if (time_left == 0) { dev_err(i2c_dev->dev, "i2c transfer timed out\n"); + tegra_i2c_reg_dump(i2c_dev); tegra_i2c_init(i2c_dev, true); return -ETIMEDOUT; } -- 2.7.4