From patchwork Sat Dec 5 16:57:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Bondarenko X-Patchwork-Id: 7775761 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 C2EECBEEE1 for ; Sat, 5 Dec 2015 16:58:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0370D204F6 for ; Sat, 5 Dec 2015 16:58:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CA29204D9 for ; Sat, 5 Dec 2015 16:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754506AbbLEQ5W (ORCPT ); Sat, 5 Dec 2015 11:57:22 -0500 Received: from mail-lf0-f42.google.com ([209.85.215.42]:35738 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754435AbbLEQ5U (ORCPT ); Sat, 5 Dec 2015 11:57:20 -0500 Received: by lfdl133 with SMTP id l133so129242303lfd.2; Sat, 05 Dec 2015 08:57:18 -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=eI6HzaOC5PrM647y0ZWMSd1KrvD6XvG+dD3+qqZ6Ajc=; b=tJm0mB4t/+duzNivKXwb9krlXUV+Z2nwIDIjlfMoWsjHgnK4zY/z1FuibKJYlU2jNs gYqz8Cy0ZE3un2jDZE/FaLibB7A7AxrL9vDPV3ck3Y1xfqZC7adA7zYZsEqTXbJ8KXAq Qt+DPGgpsOSKyUln/TgZVthOaClPIhOAhp0KXBCF8Qv+TIIdtomL7SvNyXMnq0py/k7a 67jhBSB005OjjFYtaWeIV9bc/nudlIFMOWRDm/+xhYw6lSS/Im42u8Y8jKsph90K03E0 dJlgRQDtAW54EwSRAGx3CC79A90v8RYCkKYi3FAT93zTjCNuuialQK5g59BEiDNT8vV/ 4WLg== X-Received: by 10.25.167.209 with SMTP id q200mr10629252lfe.15.1449334638850; Sat, 05 Dec 2015 08:57:18 -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 tv8sm164546lbb.27.2015.12.05.08.57.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 05 Dec 2015 08:57:18 -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 v5 06/11] spi: imx: return error from dma channel request Date: Sat, 5 Dec 2015 17:57:04 +0100 Message-Id: <1449334629-4715-7-git-send-email-anton.bondarenko.sama@gmail.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1449334629-4715-1-git-send-email-anton.bondarenko.sama@gmail.com> References: <1449334629-4715-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=unavailable 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 On SDMA initialization return exactly the same error, which is reported by dma_request_slave_channel_reason(), it is a preceding change to defer SPI DMA initialization, if SDMA module is not yet available. Signed-off-by: Vladimir Zapolskiy Signed-off-by: Anton Bondarenko --- drivers/spi/spi-imx.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 3525616..277dd75 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -846,10 +846,11 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx, spi_imx->wml = spi_imx_get_fifosize(spi_imx) / 2; /* Prepare for TX DMA: */ - master->dma_tx = dma_request_slave_channel(dev, "tx"); - if (!master->dma_tx) { - dev_err(dev, "cannot get the TX DMA channel!\n"); - ret = -EINVAL; + master->dma_tx = dma_request_slave_channel_reason(dev, "tx"); + if (IS_ERR(master->dma_tx)) { + dev_info(dev, "cannot get the TX DMA channel!\n"); + ret = PTR_ERR(master->dma_tx); + master->dma_tx = NULL; goto err; } @@ -864,10 +865,11 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx, } /* Prepare for RX : */ - master->dma_rx = dma_request_slave_channel(dev, "rx"); - if (!master->dma_rx) { - dev_dbg(dev, "cannot get the DMA channel.\n"); - ret = -EINVAL; + master->dma_rx = dma_request_slave_channel_reason(dev, "rx"); + if (IS_ERR(master->dma_rx)) { + dev_info(dev, "cannot get the DMA channel.\n"); + ret = PTR_ERR(master->dma_rx); + master->dma_rx = NULL; goto err; } @@ -1217,9 +1219,12 @@ 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, res)) - 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, res); + if (ret < 0) + dev_err(&pdev->dev, "dma setup error %d, use pio\n", + ret); + } spi_imx->devtype_data->reset(spi_imx);