From patchwork Sun Nov 1 14:41:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Bondarenko X-Patchwork-Id: 7532221 Return-Path: X-Original-To: patchwork-linux-spi@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 73F929F830 for ; Sun, 1 Nov 2015 14:42:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95487205F7 for ; Sun, 1 Nov 2015 14:42:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F04B206D5 for ; Sun, 1 Nov 2015 14:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752830AbbKAOmf (ORCPT ); Sun, 1 Nov 2015 09:42:35 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:33508 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752722AbbKAOlw (ORCPT ); Sun, 1 Nov 2015 09:41:52 -0500 Received: by lbbec13 with SMTP id ec13so74259975lbb.0; Sun, 01 Nov 2015 06:41:50 -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=E81GjG3nmmICk+4UeL7KjcJXLkZgAL5h5dNRGfJPI4I=; b=D1cE/3Pt0gcSCgeYiP5tgy9BeKiWe2k/kEjih9kHS56+1EtPFNAhIAh1Hy2xAHVJGW r72v84NxaYtU6Ql0Id3ocWpMk7a9PHFGhMKcSPamnYXoCkE6UWn1G6KsDmBOzZKaIQOY NRtZpa94VSQ3AnnsXHAEYzyYCsGBAG4MBvBLWNRvK2D7xPbGA2evI53vdiP8zcHX+3lA W8fJBZ82JLgDrFM1pFDjcd1d4QmTNoahs8zzuCRbixwU1GDBlJ0LgQ0syvBTyaF1nx4W ZpPZP3iGPPpLwprPsYdpM16yH7AKWToEu/uhYqTHVdFq/FtTSQTfPrBxnShpnOofCGUj IjNA== X-Received: by 10.112.199.4 with SMTP id jg4mr7518134lbc.59.1446388910838; Sun, 01 Nov 2015 06:41:50 -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 oy8sm3091607lbb.39.2015.11.01.06.41.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 01 Nov 2015 06:41:50 -0800 (PST) From: Anton Bondarenko To: broonie@kernel.org, b38343@freescale.com 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, s.hauer@pengutronix.de Subject: [PATCH v3 7/7] spi: imx: defer spi initialization, if DMA engine is pending Date: Sun, 1 Nov 2015 15:41:41 +0100 Message-Id: <1446388901-6073-8-git-send-email-anton.bondarenko.sama@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1446388901-6073-1-git-send-email-anton.bondarenko.sama@gmail.com> References: <1446388901-6073-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 From: Anton Bondarenko 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 6035ddd..d2ea731 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1354,9 +1354,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);