Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4985433img; Tue, 26 Mar 2019 23:00:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxoS8+sJEPxSkUeVjAipbXjFOXBr3qdAqRLzmiJJD5zqszhUI66I6ar81Dj883+p2npBoDL X-Received: by 2002:a17:902:7c94:: with SMTP id y20mr33431481pll.263.1553666427299; Tue, 26 Mar 2019 23:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553666427; cv=none; d=google.com; s=arc-20160816; b=GkjFoYLvpW4KqbzIcVDfqwVYKiZM04Q+LgtAYSzW3/4q5Na1k8BTUY451R1trzUNaN c5KyEaSlvMjlosQvIqyKyR65p5ZEuYFRVDLsOiEDyNqvVSlTLtXX+h8uyz3e4g8oA1ye QzWwjLEz2IQv8YgovB8NdNIuMhAeEUFLP0WUCO4rBxtwKj8FSLSFKCBIyL52zpZ4diO7 JmuIn9kuol+c1WSsQUW6rgwxqFGt1wvj3woQ/anG0fMzHlLtWcPjrhQO6OKfOMUDOmiW UOYUhG64MsW0jBWsD4UzJqFNa7ixSccOqqREqu2VYSpCx0NoVCjrpW0URNMtGRlM8voM 86+Q== 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=s3KHjtXt1zgMVIUGUGMHh6JDkD3XIJDHG16DAqm1T5E=; b=BM9aStkGQK1P7GtTDQzyI8LeUX6FWfHco0rEzzPC8vur8mNZX+JWLTqoscVFv24cPI KTmwqHCbbV6DQ8/FPFfSc8FiKWdRQF2lgVjYH9l1cCtkzXqXUCL1v2KSwPxL7TxwIj1X Yd6/Qwh9zOXkigKzbYNcDhzoY5zcoJuvC/Y27fgqi+aLWvo+x6iQLP7ER+1dBNVK/C/0 Gz++GD72Ze77wBhr/1eUnpBZbHLtiNcY8C709cEJ/evItCxyQsP/Z9ToRGuxrP8ZHQm7 QxtsrFwB1+JwPTL/JpAf1xh/gM9apkONoWm9GPhoPR5Lsq5vLKtIMNKRYeuDmF/3ZpPO pBLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=mQNFKuSW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z20si18228363pgf.324.2019.03.26.23.00.12; Tue, 26 Mar 2019 23:00:27 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=mQNFKuSW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2387579AbfC0F7M (ORCPT + 99 others); Wed, 27 Mar 2019 01:59:12 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:6222 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732984AbfC0F5R (ORCPT ); Wed, 27 Mar 2019 01:57:17 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 26 Mar 2019 22:57:15 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 26 Mar 2019 22:57:16 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 26 Mar 2019 22:57:16 -0700 Received: from HQMAIL108.nvidia.com (172.18.146.13) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 27 Mar 2019 05:57:16 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 27 Mar 2019 05:57:16 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.161.83]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 26 Mar 2019 22:57:15 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , Subject: [PATCH V1 09/26] spi: tegra114: dump SPI registers during timeout Date: Tue, 26 Mar 2019 22:56:30 -0700 Message-ID: <1553666207-11414-9-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553666207-11414-1-git-send-email-skomatineni@nvidia.com> References: <1553666207-11414-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1553666235; bh=s3KHjtXt1zgMVIUGUGMHh6JDkD3XIJDHG16DAqm1T5E=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=mQNFKuSWUt7o8ySMVu83+C+6TThCIQ+08xb1KF5FDL4ECUs+ok4epFohew92dasaU gAIGVk8TK8dUGXCYEz5M4gEoL4xlhHu0x9/LIRE0bhhGQoQ7oPxhdFsInCcYwpgjT4 WXM3y2FjxSOwm79zfY2wlKwtvbw35FFXEx6dhcfoulWWo76jc8JGIU4EiuxgpsgvuX /rgwq6hI0VmVj/0aYzMRoNjVfCgn0InF9P2+uGlSqQZV+oLFTvo0RUNtfiHYWVDqgm TuFPvKJLexhDNfEDACcm1d1O8doIpwhBFfrOl4GeTgnCrhJSm/xqn1OqjiB08f3e9K mXndgojDE+jkA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch dumps SPI registers on DMA or transfer timeout for debug purpose. Signed-off-by: Sowjanya Komatineni --- drivers/spi/spi-tegra114.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index b7e71676a506..268a790a663e 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -858,6 +858,20 @@ static void tegra_spi_transfer_delay(int delay) udelay(delay % 1000); } +static void tegra_spi_dump_regs(struct tegra_spi_data *tspi) +{ + dev_dbg(tspi->dev, "============ SPI REGISTER DUMP ============\n"); + dev_dbg(tspi->dev, "Command1: 0x%08x | Command2: 0x%08x\n", + tegra_spi_readl(tspi, SPI_COMMAND1), + tegra_spi_readl(tspi, SPI_COMMAND2)); + dev_dbg(tspi->dev, "DMA_CTL: 0x%08x | DMA_BLK: 0x%08x\n", + tegra_spi_readl(tspi, SPI_DMA_CTL), + tegra_spi_readl(tspi, SPI_DMA_BLK)); + dev_dbg(tspi->dev, "TRANS_STAT: 0x%08x | FIFO_STATUS: 0x%08x\n", + tegra_spi_readl(tspi, SPI_TRANS_STATUS), + tegra_spi_readl(tspi, SPI_FIFO_STATUS)); +} + static int tegra_spi_transfer_one_message(struct spi_master *master, struct spi_message *msg) { @@ -904,6 +918,7 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, (tspi->cur_direction & DATA_DIR_RX)) dmaengine_terminate_all(tspi->rx_dma_chan); ret = -EIO; + tegra_spi_dump_regs(tspi); tegra_spi_flush_fifos(tspi); reset_control_assert(tspi->rst); udelay(2); @@ -913,6 +928,7 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, if (tspi->tx_status || tspi->rx_status) { dev_err(tspi->dev, "Error in Transfer\n"); + tegra_spi_dump_regs(tspi); ret = -EIO; goto complete_xfer; } @@ -958,6 +974,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_spi_data *tspi) tspi->status_reg); dev_err(tspi->dev, "CpuXfer 0x%08x:0x%08x\n", tspi->command1_reg, tspi->dma_control_reg); + tegra_spi_dump_regs(tspi); tegra_spi_flush_fifos(tspi); reset_control_assert(tspi->rst); udelay(2); @@ -1031,6 +1048,7 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_spi_data *tspi) tspi->status_reg); dev_err(tspi->dev, "DmaXfer 0x%08x:0x%08x\n", tspi->command1_reg, tspi->dma_control_reg); + tegra_spi_dump_regs(tspi); tegra_spi_flush_fifos(tspi); reset_control_assert(tspi->rst); udelay(2); -- 2.7.4