Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4953563imm; Tue, 7 Aug 2018 10:02:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdLdcOOY6t/xqyy4zd8gx3s5ida82RbN36jnxEsKtHJcvSXYho3tNfT2w3v77S0W+0YQa4t X-Received: by 2002:a63:1e66:: with SMTP id p38-v6mr19210969pgm.376.1533661364074; Tue, 07 Aug 2018 10:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533661364; cv=none; d=google.com; s=arc-20160816; b=H5aNdwxmT7rfpPQMXXH1N/irhDNgwlZG2VB7/nNY7d+pGt7uSqh8qAp//lqgxBhYSv aQwco7uHxaWOfKBVbVogq4ThrlQ8oYGrweCuUmItrStOLCH+7+XaXZDXTVLMtGB4gWFv GGqSLJCXHVdL5xCnFCvdqMVVA+ZjMRhTpGAa3n700EyO3hgLQ1efOPR0tHTMcXKCitK+ sjYkAjIY/8RYBm3fn/VSWZodVvQ3SoV0F75kp+EdHPfjjGqg7cbF+8Obyi2O4Y3yI8Oj 4iV2mGj3TmKbXiSBykas0BlpUxY1BvvxrhJ/nZOomy2l11Y48b25OgB2QyZ/ZgQ2lsfm O8uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=XmgqOP8Rrw4C2I2fJcP1WroQjuaLcj8qrEA/ucjVcDA=; b=veqSPFmWIRn5eZ/tWT/c3qmjqKd9g6+aEgq4pCIFVZ4tS1TPnz9e1K1+fm69+KNON9 PN0H+lZimFqB4ADGDlnMYwvQIv+wtb6aie/dZxqJL4qQU1WabVb2xgi3zz8+/D4Ne4m6 QjqtZ+jVnsrX4+IJ+d3fvXgRdtb3jAI9LprjnryFkGuKUlurknyjMxHDE9nsGEISRacB Q+ef2Gjg5SyX1HVKvMy+tniyUgcnPxfcMZx/lt75Y9nguP6M0aIQsOph24w8Y6NiH+mC vfTLXgas1haYRuVT6zpjhm82Gh6K8WXSEsyUo5f8VhFzIHpjo3o0usd16hrfFYVBUnaF xAcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s71-v6si1865288pfa.367.2018.08.07.10.02.28; Tue, 07 Aug 2018 10:02:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389747AbeHGTPs (ORCPT + 99 others); Tue, 7 Aug 2018 15:15:48 -0400 Received: from mail.bootlin.com ([62.4.15.54]:36269 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388481AbeHGTPs (ORCPT ); Tue, 7 Aug 2018 15:15:48 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id AF4BF209B9; Tue, 7 Aug 2018 19:00:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 3E0C0209AD; Tue, 7 Aug 2018 19:00:21 +0200 (CEST) Date: Tue, 7 Aug 2018 19:00:22 +0200 From: Boris Brezillon To: Janusz Krzysztofik Cc: Linus Walleij , Jonathan Corbet , Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Tony Lindgren , Aaro Koskinen , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, linux-doc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 04/12] mtd: rawnand: ams-delta: request data port GPIO resource Message-ID: <20180807190022.3d326034@bbrezillon> In-Reply-To: <20180806222918.12644-5-jmkrzyszt@gmail.com> References: <20180718235710.18242-1-jmkrzyszt@gmail.com> <20180806222918.12644-1-jmkrzyszt@gmail.com> <20180806222918.12644-5-jmkrzyszt@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Aug 2018 00:29:10 +0200 Janusz Krzysztofik wrote: > Data port used by the driver is actually an OMAP MPUIO device, already > under control of gpio-omap driver. For that reason we used to not > request the memory region of the port as that would fail because the > region is already busy. Despite that, we are still accessing the port > by just ioremapping it and performing read/write operations. Moreover, > we are doing that without any proteciton from other users legally > manipulating the port pins over GPIO API. > > The plan is to convert the driver to access the port over functions > exposed by the gpio-omap driver. Before that happens, already prevent > from other users accessing the port pins by requesting an array of its > GPIO descriptors. > > Signed-off-by: Janusz Krzysztofik Reviewed-by: Boris Brezillon > --- > drivers/mtd/nand/raw/ams-delta.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c > index 48233d638d2a..09d6901fc94d 100644 > --- a/drivers/mtd/nand/raw/ams-delta.c > +++ b/drivers/mtd/nand/raw/ams-delta.c > @@ -161,6 +161,7 @@ static int ams_delta_init(struct platform_device *pdev) > struct mtd_info *mtd; > struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > void __iomem *io_base; > + struct gpio_descs *data_gpiods; > int err = 0; > > if (!res) > @@ -261,6 +262,13 @@ static int ams_delta_init(struct platform_device *pdev) > dev_err(&pdev->dev, "CLE GPIO request failed (%d)\n", err); > goto out_mtd; > } > + /* Request array of data pins, initialize them as input */ > + data_gpiods = devm_gpiod_get_array(&pdev->dev, "data", GPIOD_IN); > + if (IS_ERR(data_gpiods)) { > + err = PTR_ERR(data_gpiods); > + dev_err(&pdev->dev, "data GPIO request failed: %d\n", err); > + goto out_mtd; > + } > > /* Scan to find existence of the device */ > err = nand_scan(mtd, 1);