From patchwork Mon Aug 6 22:29:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10558083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F8C013AC for ; Mon, 6 Aug 2018 22:40:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECD0929A7B for ; Mon, 6 Aug 2018 22:40:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E061B29A91; Mon, 6 Aug 2018 22:40:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8EB5829A7B for ; Mon, 6 Aug 2018 22:40:43 +0000 (UTC) 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: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=paS015iefZk4Xct4QzZ0/yX1xYUz3THpV4KMnqlBNG4=; b=eavlCcx3FxCXI5F2k2TRntTiMc 89O6E+dFyt++t0UUNtNVy3OQW2LGH+s6JewSNKZRisvj0JzZO37loUVjmH10vyMsRpj5NtwFMhD6F apoINZhFFx0qTfKs8mlL9iGj56VH/iKvY+sorR6lipR6oSRllNq2G/yG3UjAUNoo5AdqMgdAKmKKv lOVpMPJF0oHsqxaE+E3ET105I2t3mdkWfbxgj3B0/dHl1jp/0BA3hTnimPfpNvPAP3NiAIDu3TVkc 9YVqnJEhBDnExoe9PWQRBaI1bzEYoakQOPSN9k5cZRHQyA/4XXgiz+8tSmnnIU3my1J+2HCDTaECf aX7y3uUA==; 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 1fmoB5-0001Uj-C1; Mon, 06 Aug 2018 22:40:39 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmo0Y-0005Qy-9A; Mon, 06 Aug 2018 22:29:55 +0000 Received: by mail-lf1-x144.google.com with SMTP id a4-v6so10208121lff.5; Mon, 06 Aug 2018 15:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8Ttieek8EVt2mQNwFsLifOKl+ByDrQm129q1TWk/MX0=; b=IcxD45QPCPRzl8lvaY9qsjTGsRNs6gWfl2bUuk41J5q5nlNd/Fj4+pM9RgOb76Q+U2 QCaN54RsUEQdvWW5sJ6YABUFPk05R+SVe3un3mnPX5pEBfeyTIqCWgNFFhTv7DMayYO1 UWFExZhfYv+7AKsNAu2/dSz33ocTaOIo9k8JoVwPEmic4aEPZM5DcDJByX2djQxqgyex YQuNwHMaR9bdjr2mRGVeR2U+QzEyRM1W4ZNJ39DSnyZRikWRiSe7o8TAIECDNENqXRUR msBwhq4dzMfYMLobnm2H8/kTmAjU9b2SnxkUq/L3HdWgUfgClF1aUNt7fKU4pEJnT0Rs eRJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8Ttieek8EVt2mQNwFsLifOKl+ByDrQm129q1TWk/MX0=; b=M5FKNXCBEbTxB5EFlo6em60b97dWq8nGsQPWOYaKXI4Txqjy9XvQFCv7a3XngHSA9O E97WyoNwGraCoPv6MyN/K0dAMkpEzmQR9AFRi+gLE/4FprBa6Ech33JRpymq5DJ5fxMt ewJqJjWlWRlyO8plC4NgRgfyadLz+ylqZw59piXczrYv7pBSymAcgnqqt6nfG8PM9Lvj P7zM+GoHV/yxTIJu+G++OuxoL7VwampbkXynCqOfr/ZMgxoP1zlNLQY5VtoJObWHDGYY wS9jnqj4axOib7FgfYZHDrY/Gkm9XcLQwAE1cFoFGTdkuAL+gIkbcZS9UixDHDDXHfVl BG/A== X-Gm-Message-State: AOUpUlEJ8CdklA0fGasRtnnuymbinikEUluQyReJ1x7gOVXni39PPuw6 NzCnGHZJo/O7yoCbCZS+cFI= X-Google-Smtp-Source: AAOMgpelyUDqoYptEF511iNccJY2bUI4ITVIU7db9touIXSemg7s5zfKdMCLVZdy7hJLf7GIx+2KPA== X-Received: by 2002:a19:c64c:: with SMTP id w73-v6mr12902280lff.2.1533594573278; Mon, 06 Aug 2018 15:29:33 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id o4-v6sm2438561ljc.67.2018.08.06.15.29.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 15:29:32 -0700 (PDT) From: Janusz Krzysztofik To: Boris Brezillon , Linus Walleij Subject: [RFC PATCH v2 04/12] mtd: rawnand: ams-delta: request data port GPIO resource Date: Tue, 7 Aug 2018 00:29:10 +0200 Message-Id: <20180806222918.12644-5-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180806222918.12644-1-jmkrzyszt@gmail.com> References: <20180718235710.18242-1-jmkrzyszt@gmail.com> <20180806222918.12644-1-jmkrzyszt@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180806_152946_707177_4D57D748 X-CRM114-Status: GOOD ( 15.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-omap@vger.kernel.org, Jonathan Corbet , Tony Lindgren , Richard Weinberger , linux-gpio@vger.kernel.org, Aaro Koskinen , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Vasut , Janusz Krzysztofik , linux-mtd@lists.infradead.org, Miquel Raynal , Brian Norris , David Woodhouse , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Linus Walleij --- 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);