From patchwork Tue Jul 28 09:37:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 6881751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E6849F749 for ; Tue, 28 Jul 2015 09:48:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A7AE2039C for ; Tue, 28 Jul 2015 09:48:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34A7A2037E for ; Tue, 28 Jul 2015 09:47:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZK1SR-0004pS-JI; Tue, 28 Jul 2015 09:45:59 +0000 Received: from dec59.ruk.cuni.cz ([2001:718:1e03:4::11]) by bombadil.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZK1K8-0002wM-4A for linux-arm-kernel@lists.infradead.org; Tue, 28 Jul 2015 09:37:31 +0000 Received: (qmail 16399 invoked by uid 2313); 28 Jul 2015 09:37:03 -0000 Date: 28 Jul 2015 09:37:03 -0000 MBOX-Line: From 8b628c8d38c4a01f5c4657a4213984d98789d757 Mon Sep 17 00:00:00 2001 Message-Id: <8b628c8d38c4a01f5c4657a4213984d98789d757.1438075797.git.hramrach@gmail.com> In-Reply-To: References: From: Michal Suchanek Subject: [PATCH v2 2/2] spi: s3c64xx: add more debug prints. To: Kukjin Kim , Krzysztof Kozlowski , Mark Brown , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150728_023725_042610_16972812 X-CRM114-Status: UNSURE ( 7.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.3 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SPI transfers can mysteriously fail so add more debug prints about SPI parameters set by the driver. The hardware specific SPI driver is the only place where the programmed SPI parameters are known so there is no other reasonable place for these prints. Signed-off-by: Michal Suchanek --- - simplify by using dev_dbg and %pC --- drivers/spi/spi-s3c64xx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index cd1cfac..3574525 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -469,6 +469,7 @@ static int wait_for_dma(struct s3c64xx_spi_driver_data *sdd, { void __iomem *regs = sdd->regs; unsigned long val; + unsigned long start, end; u32 status; int ms; @@ -476,8 +477,17 @@ static int wait_for_dma(struct s3c64xx_spi_driver_data *sdd, ms = xfer->len * 8 * 1000 / sdd->cur_speed; ms += 10; /* some tolerance */ + dev_dbg(&sdd->master->dev, + "%s: waiting for %ims transferring %zubytes@%iHz", + __func__, ms, xfer->len, sdd->cur_speed); + val = msecs_to_jiffies(ms) + 10; + start = jiffies; val = wait_for_completion_timeout(&sdd->xfer_completion, val); + end = jiffies; + + dev_dbg(&sdd->master->dev, "%s: waited %u ms", + __func__, jiffies_to_msecs(end - start)); /* * If the previous xfer was completed within timeout, then @@ -576,6 +586,13 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) void __iomem *regs = sdd->regs; u32 val; + dev_dbg(&sdd->master->dev, + "%s: clk_from_cmu %i src_clk %pC mode%s%s bpw %i", + __func__, sdd->port_conf->clk_from_cmu, sdd->src_clk, + (sdd->cur_mode & SPI_CPOL) ? " SPI_CPOL" : "", + (sdd->cur_mode & SPI_CPHA) ? " SPI_CPHA" : "", + sdd->cur_bpw); + /* Disable Clock */ if (sdd->port_conf->clk_from_cmu) { clk_disable_unprepare(sdd->src_clk); @@ -678,6 +695,9 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, unsigned long flags; int use_dma; + dev_dbg(&master->dev, "%s %s: xfer bpw %i speed %i", + dev_name(&spi->dev), __func__, + xfer->bits_per_word, xfer->speed_hz); reinit_completion(&sdd->xfer_completion); /* Only BPW and Speed may change across transfers */ @@ -696,6 +716,9 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, (sdd->rx_dma.ch && sdd->tx_dma.ch && (xfer->len > ((FIFO_LVL_MASK(sdd) >> 1) + 1)))) use_dma = 1; + dev_dbg(&master->dev, "%s %s: %susing dma", + dev_name(&spi->dev), __func__, + use_dma ? "" : "not "); spin_lock_irqsave(&sdd->lock, flags);