From patchwork Tue Jul 17 20:27:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142222 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp13636ljj; Tue, 17 Jul 2018 13:28:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpclTqPhDNUXmhE1+f8EbiACtIqbhf2+poIN4/tYkrAR3If8sp6P6m5QeeeQhZfXO+ugnFUA X-Received: by 2002:a62:2b4c:: with SMTP id r73-v6mr2193009pfr.134.1531859326095; Tue, 17 Jul 2018 13:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531859326; cv=none; d=google.com; s=arc-20160816; b=fw/s9J2p0t3/HJm1HNjJ1hZQ+6p5lgflf/5thAdPZ6RAcI0EJTDhDLsCUCAM0gb+xe 7nEGTIvJGbkZYxJEn1KDbNujv4fAARDN6GW24/eJyn8cD4B3PJU896W1fpAH9uwA+Tep rWAdlE4u4jDcW1EgzMUkylAwXnLL4snEmYyejBJAl7ADMnd/ZUF22tjrhI0qrf19ucdY If7zKoYi1DfVdYtQK900+myMVIxQ1Ec9FxGu5j7Bnghb/2eG+7I5BhYNsDYOAObXgOCi SvPSLXIiiV6eL059zzrN3HR8DLvfQrcgwuGE7HGHnPj/auOZh0lPmTp+MTP2/SFtquLq RXDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:dkim-signature :arc-authentication-results; bh=5clejk21SYqtH/8uEBz5zgOMGbzZMjqOiFb8x8AW+9c=; b=d1VWSzoGWNiviRbZVQpJtfgQPU5ohh2Ek+pWerAy2zveQw//F9gkTwpH1iVLMfSeQ2 XyR+v4le0858DG5j592ZMj3oIVYCkQBUSb5S13yFf05JF2q0+mKSx9GfD1vkfxqlmujW HYN1OwU8T1piJwG44alUFg8hgZzEtDor6edH7/VkSQ8n1t5UL/fxM61PkwXRTATnv+i2 L/Wq33G8Z5KYOKTIGt/4VImjV0/WdDNU8U+ixhhapIOsNOF+GBWFSDXvClk8gbKZYmIT gEQDemxhA9hJA74AQlIlndwQ0bpaj40Bn59qJeYr5du8dP1+mF27g6jMdz2agPvhd6FG 4jXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b="bqaOO/Cb"; 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" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id 6-v6si1577274pgz.592.2018.07.17.13.28.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Jul 2018 13:28:46 -0700 (PDT) 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="bqaOO/Cb"; 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" 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=5clejk21SYqtH/8uEBz5zgOMGbzZMjqOiFb8x8AW+9c=; b=bqa OO/CbitGUxBJ78kKmkjpzFfEuvs3HDIdUdejN6AE+aXNnd7OKxQzXb2sFUpBU8EcYlsNFKkR73ndr pqoXVyqBj3le/eAraxHktm6N8REgR38X3EVKleoX154gplCc9FE2O1YgjHa45c1cMUGCipuqMfaOV vvFy4j4iZOyyEj+3og0rO/J3zU+MUz0T3luQq6iS2LrPHeKLcTYyt5U2kJ5wJ9ejjjMUM+3sWBBaO ZcHEJ4ItDZ2wiGVINV/S0rhoK/5ZqADcFXyql1qojuN0OSJUVKwk9c9j2vIxC0+Q3NnyKRQ644UGj u2VlmldpY2cSoKcvwmKS6g0TUslsyxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffWaH-0003EO-IC; Tue, 17 Jul 2018 20:28:33 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffWaD-0003Cl-To for linux-mtd@lists.infradead.org; Tue, 17 Jul 2018 20:28:31 +0000 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0LlVhP-1gDUU02G1P-00bIVW; Tue, 17 Jul 2018 22:28:03 +0200 From: Arnd Bergmann To: Boris Brezillon , Miquel Raynal , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger Subject: [PATCH v2] nand: ranw: qcom_nand: stop using phys_to_dma() Date: Tue, 17 Jul 2018 22:27:42 +0200 Message-Id: <20180717202759.2288076-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:GgXbCwUIYC5OxfpXPg4WR65Who6Naz28NA//J4Mm5WXTJd7ZFBI QelOwV4m+mLy5dTUSRLkCDSq/rPTO3csluXGWt6MBK/SPzXwLSPK/hTb6gDRPPXbFNHEQ5U lJs+2qz29lBG5XZKpbLyNvWpexWer4JzKbWLw1z38tRGxLUZKZv9MlURqZrt7MQMvEOPXxj A/MOlcLTGVXVHUEcFwMhQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:SokgHTinA8c=:t7Ve2WgcvNwYw6SBiBCsd7 WVDRHLBJc3LtAjX6Y3Tj2IM51IuFOnsfcDXcOy8lhfA1Bk0MnevHgWwUa0cIDA+AGMrlLIaXW h4mXY7dbuamSbB9lTuUInU1qemi3zW4s0oa7kd6PyXZJJJLjaFH8rncvb3MAvoSDL9VbTJERs iEJKj+j5DsGNsuElp4BUf/Dj+p9863M8It7TZysClcrpfFSxZVRWYojLehhnGTN6pqVBv+6E8 g7Kx7U4Li54ofYLKYs90eTZSiALHDW/gz3d5kzSq/arR8eJ2o6+hR5WGhOK8fr1EOz3Ol2VJ6 BSeJ+7jdcTQIq5Cw2OVTqCg7knjXD7p3vdxoJ0h+EVvGrDzDzIZcw1Qs/3vzQO2wuhyz9XXJP sAr0oGC7WqNiU6A8q5etozoZpbJGnb+MeGDcXb5vi+9K/GxUIkMrRf/SHH7098Uy1sWoGLeOD GWCt4c1bP7UXsgyeryEBWJ+wxdf8IMrjZTW2Z2Ub3ikNC/ogjXQL9UQSF+BUi711GLHwNkKuv SeJLQsmlp1denzF30vqUf6mIgU2WxZJZOxFq9qFsoZuHJ/p3b2UG8pXgFOfKv1Ifo/U/50D15 TuU7IHr16Za4QGvNv23QT1M9i7CKz/RGBOE6c5mGA/+T/9N7pLcSV5AAw8hsve6qh+P45NoFj FKPyDZTgMD53F2W/pIbph7IVfV2dvWScg/RXZTO8Zv3RuJHVT6LWBPASxXZqoYvz3OfM= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180717_132830_297036_6DF9FDF1 X-CRM114-Status: GOOD ( 15.09 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.13 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Archit Taneja , Arnd Bergmann , linux-kernel@vger.kernel.org, Masahiro Yamada , Abhishek Sahu , linux-mtd@lists.infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Compile-testing this driver on x86 caused a link error: ERROR: "__phys_to_dma" [drivers/mtd/nand/raw/qcom_nandc.ko] undefined! The problem here is that the driver attempts to convert the physical address into the DMA controller as a dma_addr_t and calls phys_to_dma() to do the conversion. The correct way to do the conversion is using the dma mapping interfaces. Fixes: c76b78d8ec05 ("mtd: nand: Qualcomm NAND controller driver") Signed-off-by: Arnd Bergmann --- drivers/mtd/nand/raw/qcom_nandc.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) -- 2.9.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index 994f980c6d86..645630953f38 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -2957,14 +2957,6 @@ static int qcom_nandc_probe(struct platform_device *pdev) nandc->props = dev_data; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - nandc->base = devm_ioremap_resource(dev, res); - if (IS_ERR(nandc->base)) - return PTR_ERR(nandc->base); - - nandc->base_phys = res->start; - nandc->base_dma = phys_to_dma(dev, (phys_addr_t)res->start); - nandc->core_clk = devm_clk_get(dev, "core"); if (IS_ERR(nandc->core_clk)) return PTR_ERR(nandc->core_clk); @@ -2977,9 +2969,21 @@ static int qcom_nandc_probe(struct platform_device *pdev) if (ret) return ret; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + nandc->base = devm_ioremap_resource(dev, res); + if (IS_ERR(nandc->base)) + return PTR_ERR(nandc->base); + + nandc->base_phys = res->start; + nandc->base_dma = dma_map_resource(dev, res->start, + resource_size(res), + DMA_BIDIRECTIONAL, 0); + if (!nandc->base_dma) + return -ENXIO; + ret = qcom_nandc_alloc(nandc); if (ret) - goto err_core_clk; + goto err_nandc_alloc; ret = clk_prepare_enable(nandc->core_clk); if (ret) @@ -3005,6 +3009,9 @@ static int qcom_nandc_probe(struct platform_device *pdev) clk_disable_unprepare(nandc->core_clk); err_core_clk: qcom_nandc_unalloc(nandc); +err_nandc_alloc: + dma_unmap_resource(dev, res->start, resource_size(res), + DMA_BIDIRECTIONAL, 0); return ret; } @@ -3012,16 +3019,21 @@ static int qcom_nandc_probe(struct platform_device *pdev) static int qcom_nandc_remove(struct platform_device *pdev) { struct qcom_nand_controller *nandc = platform_get_drvdata(pdev); + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct qcom_nand_host *host; list_for_each_entry(host, &nandc->host_list, node) nand_release(nand_to_mtd(&host->chip)); + qcom_nandc_unalloc(nandc); clk_disable_unprepare(nandc->aon_clk); clk_disable_unprepare(nandc->core_clk); + dma_unmap_resource(&pdev->dev, nandc->base_dma, resource_size(res), + DMA_BIDIRECTIONAL, 0); + return 0; }