Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1721848yba; Thu, 4 Apr 2019 17:17:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTWykUWp8rqyMHKjggLH/HP6s1NSvZa4VR2/0izW6JZMu+mLUn4xEo31FYoMB9WPoLqj/O X-Received: by 2002:a17:902:2a89:: with SMTP id j9mr9570807plb.272.1554423424131; Thu, 04 Apr 2019 17:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554423424; cv=none; d=google.com; s=arc-20160816; b=pL9m+Nodz3sUsxSvRIgL3P8sAnRqkPtRzQOyA9HJsG6BGPcp/B1yDjPOZw5Ib9QiOJ L3AB07+jvB1Bb9mEwMyqi2G43Spf/0AasdvO4kkK7esRJQ/VtwsiNxMWxRltkO3iCGyw WrmGnK+5+BoJ5bnqOm7rRyU01T9tkElmo/LqzfHm5q5UNERhwTJzn0nUVuBZ2L7SyY3d sWDNPST9zsZL5d1zEyPB7QkNW93SLAHwXvy1rdwnQIJltu5RJoo2nU6Hrd5jpobg34t0 cF9ehZklAW2MfqsLqtvZneNfemZEz7J1zKTn4gMSBE/3GU4vpwVg8scblNkAvGAy4sHA WdRg== 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=C8/q/A8GIH9xcJFybB+7dkihJTAhAi0KGae3smUb564=; b=doGfZH0YYcnEfbLChBWiGIKT/c2S3WQ73T+92JWl4olBkNJsrGMhh8peq2uePnm03J MU1rErrgbUpG/yp3bPVL0xtmaJeU+s6DsyV7NhdM8xsFKoH5XNpfZEFEZJeHbaS2X/uo HYtVgPVntVGAWShIbqkMq/eunRkpYzAB3X+Rk4ypxL5fLs3ZGoG8SeImPhvRDKh7rSsr sQy7AT1vEPydGp61crkoIOnyX8tMm9uri7gVyaqa2+EZQPnD/L99JNUREAcdhrYghXcd jbu2Icrz84ls5eP4mYOPuOf7L2gfbYdXYE0EGnZu/ONJiGEZSbLMmvpzsr4Dws4mg8vW nD3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=IZOQAVE9; 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 cv17si15118644plb.380.2019.04.04.17.16.48; Thu, 04 Apr 2019 17:17:04 -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=IZOQAVE9; 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 S1730578AbfDEAO3 (ORCPT + 99 others); Thu, 4 Apr 2019 20:14:29 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:6443 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730476AbfDEAO0 (ORCPT ); Thu, 4 Apr 2019 20:14:26 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 04 Apr 2019 17:14:30 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 04 Apr 2019 17:14:25 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 04 Apr 2019 17:14:25 -0700 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 5 Apr 2019 00:14:25 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 5 Apr 2019 00:14:25 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.103.48]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 04 Apr 2019 17:14:24 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , Subject: [PATCH V2 05/20] spi: tegra114: dump SPI registers during timeout Date: Thu, 4 Apr 2019 17:14:04 -0700 Message-ID: <1554423259-26056-5-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554423259-26056-1-git-send-email-skomatineni@nvidia.com> References: <1554423259-26056-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=1554423270; bh=C8/q/A8GIH9xcJFybB+7dkihJTAhAi0KGae3smUb564=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=IZOQAVE9+EzXq3ErJcPFBrqofjILHFAP/71t8hC3tID87+ZiU6Gfu73Tp+QvMfSAE PYPYltg/g8P8f3pwI5CbODuBy/aZRX96a7hRU97pr1blEvn9zJOkDIN0CiufLMTQxC 0YuqPFw1nFQuwpm0xbEKNsaOdF0ZPYcBj17vf8MSm0bX3M8GWHVBh4eaROwWkIQG08 wpzyEnU6Znwh18n7pvN3dOhtPwby/VWe0T6RXbuX4rbaxyRD0Qd6MaGGoirvrY3oQi yRXfVUzCeUkDFDOOIaLVQdi09GFroz2sv/la/kBrS3sn3CduN+wS/SE1SUNDbHYExe zDMXUMFmoOIkQ== 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 transfer error or 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 d928a2c92a3d..e0f20fad5df2 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -876,6 +876,20 @@ static void tegra_spi_transfer_end(struct spi_device *spi) tegra_spi_writel(tspi, tspi->def_command1_reg, SPI_COMMAND1); } +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) { @@ -922,6 +936,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); @@ -932,6 +947,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"); ret = -EIO; + tegra_spi_dump_regs(tspi); goto complete_xfer; } msg->actual_length += xfer->len; @@ -973,6 +989,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); complete(&tspi->xfer_completion); spin_unlock_irqrestore(&tspi->lock, flags); @@ -1047,6 +1064,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); complete(&tspi->xfer_completion); spin_unlock_irqrestore(&tspi->lock, flags); -- 2.7.4