From patchwork Wed Sep 6 07:05:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9940015 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 43E0F6038C for ; Wed, 6 Sep 2017 07:05:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3364628AFA for ; Wed, 6 Sep 2017 07:05:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2830028B00; Wed, 6 Sep 2017 07:05:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F06E728AFD for ; Wed, 6 Sep 2017 07:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbdIFHFS (ORCPT ); Wed, 6 Sep 2017 03:05:18 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:57102 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbdIFHFN (ORCPT ); Wed, 6 Sep 2017 03:05:13 -0400 Received: from vsmta13.fe.internet.bosch.com (unknown [10.4.98.53]) by imta24.fe.bosch.de (Postfix) with ESMTP id 3701DD80227; Wed, 6 Sep 2017 09:04:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1504681483; bh=JbLYvlyOc+H/3b2ur7aNFVMicCuJNJVOtVEm8wJtcNA=; l=10; h=From:From:Reply-To:Sender; b=wZ4iHHv5eF0Xx7g2BBX+d7HfctaXzM858HP4+iWVyKGSBYlYBc73lxl9YsZfOiPqP LEZ8kERgKq7JaGNvMApTOvxvbUH51M3FBXIZR20mO0X33OH6+WOBi//ICPdVwBxxz9 +vbyWNa1mqCjgfO+oB2yYMHCCDoaf4I/xd2i2/Ys= Received: from FE-HUB1000.de.bosch.com (vsgw24.fe.internet.bosch.com [10.4.98.24]) by vsmta13.fe.internet.bosch.com (Postfix) with ESMTP id 20A322E403DB; Wed, 6 Sep 2017 09:05:12 +0200 (CEST) Received: from HI-Z0EVG.hi.de.bosch.com (10.34.218.219) by FE-HUB1000.de.bosch.com (10.4.103.107) with Microsoft SMTP Server id 14.3.319.2; Wed, 6 Sep 2017 09:05:10 +0200 Received: from HI-Z0EVG.hi.de.bosch.com (localhost [IPv6:::1]) by HI-Z0EVG.hi.de.bosch.com (Postfix) with ESMTP id 9DF971B46B0E; Wed, 6 Sep 2017 09:05:10 +0200 (CEST) From: Dirk Behme To: , , Geert Uytterhoeven CC: Hiromitsu Yamasaki , Dirk Behme Subject: [PATCH 1/8] spi: sh-msiof: Add sleep before master transfer for test Date: Wed, 6 Sep 2017 09:05:00 +0200 Message-ID: <20170906070507.26223-2-dirk.behme@de.bosch.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170906070507.26223-1-dirk.behme@de.bosch.com> References: <20170906070507.26223-1-dirk.behme@de.bosch.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-23304.006 X-TMASE-MatchedRID: i5oLG4c28XxOTfTnTIOpbvOHbIp2eXtYu61nNMV5D9ruc7XfuTYENtn7 b/+Y15IvjopcgE+WIdSwx5tV1a1qfqQwY5oHNbZB7spMO3HwKCDWme/MypByxutWujepyp3z+ng nwPoAiFbGwXLVCGStmgv65e2b5uyTDPIzF4wRfrAURSScn+QSXt0H8LFZNFG7CKFCmhdu5cU8Kj ifwaaDjQDqj0kkShn/ky/tOJdtq4ch0RK44ReStGr0ym1N2RivQKJi3kQrivWiA2t+15ODauQnh /VoEHL+uvx4vRWqWiAb1mWuENC5Oqcmqg40BkLbjineMlypRVEY61dnw7QU7J6oP1a0mRIj Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hiromitsu Yamasaki This patch is for debug of transfer between master and slave. Since the slave needs to complete a preparation in data transfer before the master working, the sleep wait is put before the data transfer of the master. Signed-off-by: Hiromitsu Yamasaki Signed-off-by: Dirk Behme --- drivers/spi/Kconfig | 20 ++++++++++++++++++++ drivers/spi/spi-sh-msiof.c | 15 +++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index a75f2a2cf780..0139ecf8f42e 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -600,6 +600,26 @@ config SPI_SH_MSIOF help SPI driver for SuperH and SH Mobile MSIOF blocks. +config SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG + bool "Transfer Synchronization Debug support for MSIOF" + depends on SPI_SH_MSIOF + default n + help + In data transfer, the slave needs to have completed + a transfer preparation before the master. + As a test environment, it was to be able to put a sleep wait + before the data transfer of the master. + +config SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG_MSLEEP + int "Master of sleep latency (msec time)" + default 1 + depends on SPI_SH_MSIOF && SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG + help + Select Sleep latency of the previous data transfer + at the time of master mode. + Examples: + N => N msec + config SPI_SH tristate "SuperH SPI controller" depends on SUPERH || COMPILE_TEST diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 0eb1e9583485..2b4d3a520176 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -41,6 +41,10 @@ struct sh_msiof_chipdata { u16 min_div; }; +#ifdef CONFIG_SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG +#define TRANSFAR_SYNC_DELAY (CONFIG_SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG_MSLEEP) +#endif /* CONFIG_SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG */ + struct sh_msiof_spi_priv { struct spi_master *master; void __iomem *mapbase; @@ -910,6 +914,11 @@ static int sh_msiof_transfer_one(struct spi_master *master, if (tx_buf) copy32(p->tx_dma_page, tx_buf, l / 4); +#ifdef CONFIG_SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG + if (p->mode == SPI_MSIOF_MASTER) + msleep(TRANSFAR_SYNC_DELAY); +#endif /* CONFIG_SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG */ + ret = sh_msiof_dma_once(p, tx_buf, rx_buf, l); if (ret == -EAGAIN) { pr_warn_once("%s %s: DMA not available, falling back to PIO\n", @@ -983,6 +992,12 @@ static int sh_msiof_transfer_one(struct spi_master *master, words = len / bytes_per_word; while (words > 0) { + +#ifdef CONFIG_SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG + if (p->mode == SPI_MSIOF_MASTER) + msleep(TRANSFAR_SYNC_DELAY); +#endif /* CONFIG_SPI_SH_MSIOF_TRANSFER_SYNC_DEBUG */ + n = sh_msiof_spi_txrx_once(p, tx_fifo, rx_fifo, tx_buf, rx_buf, words, bits); if (n < 0)