From patchwork Wed Jul 12 13:40:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 9836741 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 2C4DB602BD for ; Wed, 12 Jul 2017 13:40:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C71C285CB for ; Wed, 12 Jul 2017 13:40:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10D54285EC; Wed, 12 Jul 2017 13:40:28 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham 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 6BFF2285CB for ; Wed, 12 Jul 2017 13:40:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752396AbdGLNk0 (ORCPT ); Wed, 12 Jul 2017 09:40:26 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:45723 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167AbdGLNkY (ORCPT ); Wed, 12 Jul 2017 09:40:24 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dVHsM-0005Cv-Ja; Wed, 12 Jul 2017 15:40:22 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1dVHsM-0004gd-5Q; Wed, 12 Jul 2017 15:40:22 +0200 From: Oleksij Rempel To: kernel@pengutronix.de, Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Oleksij Rempel Subject: [PATCH v1] spi: loopback-test: provide loop request option. Date: Wed, 12 Jul 2017 15:40:20 +0200 Message-Id: <20170712134020.17927-1-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.11.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-spi@vger.kernel.org Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksij Rempel Provide a module parameter to request internal loop by the SPI master controller. This should make loop testing easier without extra HW modification. Signed-off-by: Oleksij Rempel --- drivers/spi/spi-loopback-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index f4875f177df0..34e1544d7d0e 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c @@ -51,6 +51,14 @@ MODULE_PARM_DESC(loopback, "is checked to match tx_buf after the spi_message " \ "is executed"); +/* the device is jumpered for loopback - enabling some rx_buf tests */ +int loop_req; +module_param(loop_req, int, 0); +MODULE_PARM_DESC(loop_req, + "if set enable controller will be asked to enable " \ + "test loop mode. If supported, MISO and MOSI will be " \ + "jumpered by SPI controller"); + /* run only a specific test */ int run_only_test = -1; module_param(run_only_test, int, 0); @@ -313,6 +321,16 @@ static int spi_loopback_test_probe(struct spi_device *spi) { int ret; + if (loop_req) { + spi->mode = SPI_LOOP | spi->mode; + ret = spi_setup(spi); + if (ret) { + dev_err(&spi->dev, "SPI setup wasn't successful %d\n", ret); + dev_err(&spi->dev, "SPI_LOOP is not supported by SPI master."); + return -ENODEV; + } + } + dev_info(&spi->dev, "Executing spi-loopback-tests\n"); ret = spi_test_run_tests(spi, spi_tests);