From patchwork Thu Feb 27 12:37:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 183944 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4465470ile; Thu, 27 Feb 2020 04:42:23 -0800 (PST) X-Google-Smtp-Source: APXvYqx3txR9wgYza4hu4bYsJu/xn9wa/FEUTma/XFiIv30Q8AsooPaXusJNXYPif/Vl3TMP+Ywc X-Received: by 2002:a17:90a:6c26:: with SMTP id x35mr4618628pjj.126.1582807343327; Thu, 27 Feb 2020 04:42:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582807343; cv=none; d=google.com; s=arc-20160816; b=1Aer9I6NaTHU56UDBEOhkMoYeptOGoRvKAI0MPwNNgrKoUPIV0o8uLGpoYTgGd1f2T 2m4Jb//zjmngq+olWTTAjII79fyrWuZvLS6sjEZsrG1NkLchGHOYkSKZdVF0duY+ri7H 81eyZuvB4M5msrvTz4JLdqCHTGXnO842HdvulALXyUOUh6xK1EJ85K06Fw9VOJM7ImzV ++7gUJK2lf+zVgpaLgjuzAxqtVP9kSui104vLT1ZY/1tKwtr4rT2h7xN9t0EHIuTQPeV oPtfvvHmjD9/XlF9/5/XRIladLl3Q8Q0dKtxhGVVduvCla/RFyxCfuj7JH6IZN1WnGid fShw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=10gXdAGgoDNxPKv2kihpNjkzKhBnLVqVkRmJLzcYlAE=; b=lWk0yOzGqQXdt9E7HJ/9WZUhpCzsO1bxzIoGRHJRTmZ9H7eerRxHgOlAlVqu9wcPxm iDyVhCDaTS4Km2okSqKh+aVkp/N0HYo97hFgKoOqlt6yy1HUWAzlZg1tZN5MnifZg7fn yLSmSXCmYX1K3/Tcl3Jkg/wh3ErdKNLSWdImDECeWhEjjW+BAzqNlKFnie4XoynBfT1P Td8pCV5oMvNoId/+ekaTnzfEE+OKTgBUKJyrOqcTLTdvMaEM0OMNQtHYzj5Uxk9aB2Up 51i4tkMMjQNCOc+dFHaHbQF2484iwIyRwaeiviwqvYIYHX0Yn3FhKzvmTiNTMhqAqsf6 MlAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=Ud8HGdpl; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=LGPj3ilO; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id d23si2871527pfo.76.2020.02.27.04.42.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 04:42:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=Ud8HGdpl; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=LGPj3ilO; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=10gXdAGgoDNxPKv2kihpNjkzKhBnLVqVkRmJLzcYlAE=; b=Ud8HGdpleZi1de 02oawLUj8hqbyInGbxTy6J3Wv5gnPiwGmEgp3blVjpTeTdAbDwvcy6I/G4uoJN8ro5dCGNZ/AkQxD J858wsKNqlhc8y0fcjAShr7/8WYC4RfUGOf0mPVq9GioCHJnSxfE/HHY9s5nTS68UIEIrvUgTFDpI 0bTqvW603V1mE9CHZbqfK14bE/LrtGHvwb7i16k1yu4UK4lXsXl1ke2yFx2qDHBBa6p/jXHzUHYd5 XYSTI3vPDLE/TW1p7Q9AJoFfh1wf9PRj1BIocaclE8S1Fh4ik+mVY+SZ3vDW1RmC87/k7jrhW4QwT KqmzK49JVz6RCU3T71ag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IUY-0006al-PY; Thu, 27 Feb 2020 12:42:14 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7IQo-0001xU-Kp; Thu, 27 Feb 2020 12:38:24 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01RCcFCs060774; Thu, 27 Feb 2020 06:38:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1582807095; bh=oZwRKKvJx/G8CRNhVZ7kLkdfzgNJ4E/mi5KsY0jh8pM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=LGPj3ilOH+EuYGqvyVZX0Bpj5e6SFcaJeVANJdnB3tc+r1ATu2fWeSQ2pS4Efzckr HYJ1AreHkJXbOWhPXhym+ZC4mPKkA5EBk2CE/6Zs/6Hevtab9eyFKQ2vyrJTp4Ho0h fHAOBISG5nuRA750+8G4N/PPjCkgoqoOk72q0D58= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 01RCcFFj117513 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 27 Feb 2020 06:38:15 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 27 Feb 2020 06:38:14 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 27 Feb 2020 06:38:14 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01RCbnvU100207; Thu, 27 Feb 2020 06:38:11 -0600 From: Peter Ujfalusi To: , , , , , , , Subject: [PATCH 7/7] mtd: rawnand: stm32_fmc2: Use dma_request_chan() instead dma_request_slave_channel() Date: Thu, 27 Feb 2020 14:37:49 +0200 Message-ID: <20200227123749.24064-8-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227123749.24064-1-peter.ujfalusi@ti.com> References: <20200227123749.24064-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200227_043822_812578_63974D7B X-CRM114-Status: GOOD ( 14.32 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.47.19.142 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vkoul@kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code. Use using dma_request_chan() directly and inform user of error in case the DMA request failed. Signed-off-by: Peter Ujfalusi --- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 44 ++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 3ba73f18841f..b6d45cd911ae 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -1606,15 +1606,36 @@ static int stm32_fmc2_setup_interface(struct nand_chip *chip, int chipnr, /* DMA configuration */ static int stm32_fmc2_dma_setup(struct stm32_fmc2_nfc *fmc2) { - int ret; + int ret = 0; - fmc2->dma_tx_ch = dma_request_slave_channel(fmc2->dev, "tx"); - fmc2->dma_rx_ch = dma_request_slave_channel(fmc2->dev, "rx"); - fmc2->dma_ecc_ch = dma_request_slave_channel(fmc2->dev, "ecc"); + fmc2->dma_tx_ch = dma_request_chan(fmc2->dev, "tx"); + if (IS_ERR(fmc2->dma_tx_ch)) { + ret = PTR_ERR(fmc2->dma_tx_ch); + if (ret != -ENODEV) + dev_err(fmc2->dev, + "failed to request tx DMA channel: %d\n", ret); + fmc2->dma_tx_ch = NULL; + goto err_dma; + } - if (!fmc2->dma_tx_ch || !fmc2->dma_rx_ch || !fmc2->dma_ecc_ch) { - dev_warn(fmc2->dev, "DMAs not defined in the device tree, polling mode is used\n"); - return 0; + fmc2->dma_rx_ch = dma_request_chan(fmc2->dev, "rx"); + if (IS_ERR(fmc2->dma_rx_ch)) { + ret = PTR_ERR(fmc2->dma_rx_ch); + if (ret != -ENODEV) + dev_err(fmc2->dev, + "failed to request rx DMA channel: %d\n", ret); + fmc2->dma_rx_ch = NULL; + goto err_dma; + } + + fmc2->dma_ecc_ch = dma_request_chan(fmc2->dev, "ecc"); + if (IS_ERR(fmc2->dma_ecc_ch)) { + ret = PTR_ERR(fmc2->dma_ecc_ch); + if (ret != -ENODEV) + dev_err(fmc2->dev, + "failed to request ecc DMA channel: %d\n", ret); + fmc2->dma_ecc_ch = NULL; + goto err_dma; } ret = sg_alloc_table(&fmc2->dma_ecc_sg, FMC2_MAX_SG, GFP_KERNEL); @@ -1635,6 +1656,15 @@ static int stm32_fmc2_dma_setup(struct stm32_fmc2_nfc *fmc2) init_completion(&fmc2->dma_ecc_complete); return 0; + +err_dma: + if (ret == -ENODEV) { + dev_warn(fmc2->dev, + "DMAs not defined in the DT, polling mode is used\n"); + ret = 0; + } + + return ret; } /* NAND callbacks setup */