From patchwork Fri Nov 27 23:16:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Bondarenko X-Patchwork-Id: 7715841 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 86727BEEE1 for ; Fri, 27 Nov 2015 23:20:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94B6520676 for ; Fri, 27 Nov 2015 23:20:38 +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 C23BD20648 for ; Fri, 27 Nov 2015 23:20:37 +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 1a2SI2-0002m1-6E; Fri, 27 Nov 2015 23:18:54 +0000 Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a2SFq-0001St-DK for linux-arm-kernel@lists.infradead.org; Fri, 27 Nov 2015 23:16:39 +0000 Received: by lfdl133 with SMTP id l133so141784469lfd.2 for ; Fri, 27 Nov 2015 15:16:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DBiPWf8A/48vmXTEsU8rncoV7dFdBIiaEL0TypyE+W4=; b=TJBP/Nusn0Ycvogzq87fn532z3eBTXgMDF2P95Z2j8gQq5gkEqLTZYoeEL+yRmf2Nx /dPz5d5cGdk++Zgj293GvakoiXuMX1qiCoTm9od8/98Sxkau+kmSri/rJNTOHkcUx7uS 4bkh/FGURPsk3Z1I5+KEbOFSK2CXfvJYsh4xCI7eshZR2xKZdC1tgE0Zzm2rt3yGYHnZ RwCyyzaG+8R9IeQJDi3BzJ5rxihQk2nHFt4crbFu7AatKgsCwsCE1+7sfVadXcNHa+5A UcvWTRkQyuC1Hp9jMOw3FeYHoHEA6cXQfLxhTthOWvXDctA2bOFZoS+PxJlnMfnVMGln qLHA== X-Received: by 10.112.54.229 with SMTP id m5mr21386509lbp.125.1448666176535; Fri, 27 Nov 2015 15:16:16 -0800 (PST) Received: from localhost.localdomain (c-89-233-200-205.cust.bredband2.com. [89.233.200.205]) by smtp.gmail.com with ESMTPSA id ru9sm254625lbb.3.2015.11.27.15.16.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Nov 2015 15:16:16 -0800 (PST) From: Anton Bondarenko To: broonie@kernel.org, b38343@freescale.com, s.hauer@pengutronix.de Subject: [PATCH v4 7/7] spi: imx: defer spi initialization, if DMA engine is pending Date: Sat, 28 Nov 2015 00:16:05 +0100 Message-Id: <1448666165-7473-8-git-send-email-anton.bondarenko.sama@gmail.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448666165-7473-1-git-send-email-anton.bondarenko.sama@gmail.com> References: <1448666165-7473-1-git-send-email-anton.bondarenko.sama@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151127_151638_847930_F9033217 X-CRM114-Status: GOOD ( 11.89 ) X-Spam-Score: -2.7 (--) 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: , Cc: jiada_wang@mentor.com, vladimir_zapolskiy@mentor.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org 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=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 If SPI device supports DMA mode, but DMA controller is not yet available due to e.g. a delay in the corresponding kernel module initialization, retry to initialize SPI driver later on instead of falling back into PIO only mode. Signed-off-by: Vladimir Zapolskiy Signed-off-by: Anton Bondarenko --- drivers/spi/spi-imx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index aaa32c2..c2edd0f 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1341,9 +1341,15 @@ static int spi_imx_probe(struct platform_device *pdev) * Only validated on i.mx6 now, can remove the constrain if validated on * other chips. */ - if (is_imx51_ecspi(spi_imx) && - spi_imx_sdma_init(&pdev->dev, spi_imx, master)) - dev_err(&pdev->dev, "dma setup error,use pio instead\n"); + if (is_imx51_ecspi(spi_imx)) { + ret = spi_imx_sdma_init(&pdev->dev, spi_imx, master); + if (ret == -EPROBE_DEFER) + goto out_clk_put; + + if (ret < 0) + dev_err(&pdev->dev, "dma setup error %d, use pio\n", + ret); + } spi_imx->devtype_data->reset(spi_imx);