Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4037085imm; Mon, 6 Aug 2018 15:33:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeyxq+F0AGjYRiUnGzKxOH8wbFhx4zoMj7deaCNzIzLw227DlEdMIt6STSn6hV41ynOqXaO X-Received: by 2002:a63:686:: with SMTP id 128-v6mr15911864pgg.338.1533594820579; Mon, 06 Aug 2018 15:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533594820; cv=none; d=google.com; s=arc-20160816; b=J8HwaoK297doSNjO8JXLvtvV0/Ywgwp9ob9lGbreS1N/bR9FymLJqfCzKnBLMrNbPe 5pcvsRzjcX3JNAfN0heFP/KSWgYvWUi7nvvcxS+wsDzexTt2ZSFvo8p5ApaGU3falYhQ VJ5nDqOoJbX16CQwFInvv0T+5RqkKf+nuZSzpWXQEPwbyj6IIyWMyhsEPgpTP0xiXOjj pCzWg50DMvYOlavPlHUiihWBk9fBwZmiuxt52afJtjBsTOdmkXkCjYOs8XzIGt+jrAGt 1U7NoRHSD7mzx3MAnN5LZiGGoyxC4lLsGN7A6T4VUedurfFoLr+t82cySM6WVacXc4b6 viwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=8Ttieek8EVt2mQNwFsLifOKl+ByDrQm129q1TWk/MX0=; b=Ctq5PHc93ZdVk1SmqlVwTb0Z4IwupuybMJ/68ap5MKlxG0PJ3X1qtnpZ44w3XJByW7 Wk0rSyTVqCiBkJEqlLT5UZ0m0q+39ULuvAg7RP1Y7rSnkbVwm2Fc5QuAMVy62ZIoqbfH tCixvwr0R0CmMbvJusHCsQRsVHCo1UJ+b+unIsmJOGREgWMdsbSNzRholzAZ3QXuUSkx jE2le01zO+5wRFwCHCccvBA87YEND0AmGnQ+J++Qv806Rlt4kwU1U+5cy2Ko7AgB2tOq bIk91S1gfxKxWtbTLO3jVW465YcuKY/ELpmjHRC6L2M9LoGk/uNZoWIvj3QhrX1Xu25d vNYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IcxD45QP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 194-v6si14694854pgc.116.2018.08.06.15.33.25; Mon, 06 Aug 2018 15:33:40 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IcxD45QP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732488AbeHGAl4 (ORCPT + 99 others); Mon, 6 Aug 2018 20:41:56 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36245 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387547AbeHGAkp (ORCPT ); Mon, 6 Aug 2018 20:40:45 -0400 Received: by mail-lf1-f68.google.com with SMTP id b22-v6so10240804lfa.3; 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=dd4zhobCbFz5tRhyYXnxTFuV7dqUQBPopeV/AcqSv48xr0A7KAjDsQaZQX+BVGuEMX VZz6xUEmgJ0It9HFFvpBrKWPWmviLCS6OhU7hvFkCwXnk2+9agaTe4ObpT3sloWrg8ht cOy7grgBxa82X2TD/yM2INIYN4+iw2/bE2ANGrBg1fzWYBlQW18xQyzTc2JszGjY3YQ6 PMh7I9epiD6letht3bRoj1gwWfGp1O4QJdroKKwJmChuF5PLv8U3BVEhGBMIQgY0XlTG WRzkyvc9Mt0u/LMv3z2X43akOkAJXT6PmPR0ejZL8RQrhiyoqW+o1cYVF3k74LO9nxM4 NkPQ== X-Gm-Message-State: AOUpUlFWoP2NvH/tQ2B4LwGMMBSHybPT9k1kzgUNDHA/0+61kTcfZFbF HpJCjm47t5Imxd7oTf90BrQ= 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 Cc: 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, Janusz Krzysztofik 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); -- 2.16.4