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: 7715731 Return-Path: X-Original-To: patchwork-linux-spi@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 8C5FABEEE1 for ; Fri, 27 Nov 2015 23:18:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8C752067A for ; Fri, 27 Nov 2015 23:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E139420676 for ; Fri, 27 Nov 2015 23:18:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751606AbbK0XRI (ORCPT ); Fri, 27 Nov 2015 18:17:08 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:33754 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751230AbbK0XQS (ORCPT ); Fri, 27 Nov 2015 18:16:18 -0500 Received: by lfaz4 with SMTP id z4so142471651lfa.0; 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 Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, vladimir_zapolskiy@mentor.com, jiada_wang@mentor.com 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> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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);