Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp3645170ooa; Mon, 13 Aug 2018 15:36:38 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxReZoIcM3NYYEP4GoSgBY45trciz/XlIyJ96uQYm3PNek/mV4JVBP5A7fT/+xYn3aF1Bqu X-Received: by 2002:a65:5286:: with SMTP id y6-v6mr18772020pgp.65.1534199798424; Mon, 13 Aug 2018 15:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534199798; cv=none; d=google.com; s=arc-20160816; b=t4l37yjxDa/4cDU4SsDZL2cG3LpV5BmGJbxfumJzx7ivtDHp2sneYV/eqPcr2dfJ03 Avm7S68a/vu6q2aTsQ6tkwOFKP+aIxrfIeBvD6CCPHD6swi2nLVtxY7qU+wEIvH7iFcm x2I+kZQtm+5glVTeEdO18bXV4+d4OwsO7E5Wn8VY53Z+fiuw3R0kiav5uNHIFe8BNUUp v9sqYwpBw1RjmVx1HJAlFLJcjgxTYEIwBwelOgYJ/aVonx+HXAPRbRWQslXi9SQyu1AB L8t2jnU+0uBQT/GvfSmdkOnbOD8takLm5bIadcVH6JdjlZjmjZXBVWVFBFFY2rEKVwiY dKLA== 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=vz9K13ZdWceVmktSg13RqIlA5y3YYBZB41889HPVjQw=; b=ie/kdPvzAASLFpYxFi6GMq419eaTnfI00TGNYp8K7Cm9qYXgODU61vK5oRigAaVbyM K9OegYDA1vq3ScTc0lOPxzjWfevgBcJcVEI5gGwobm9htDEdvZ9m4UdtsMT4DpCJ6eRM GzHcWJQ4FWhTrkjCEojB8w1WIEYWT+37Gf00U8WRl33llcud17srXS0Z/02fry6ZEA+Y PDEP73poteqJ+R/RohdCTWejBj5HTltj1rkGf51DYRZf+TDxFK2+mqeXFYiI56IbSfGO uAVXkVlN+gQAh7cA5O2Q3xOFAj+/fKFIXlmFNXrTeBMw2MrVcYM2BwQBkiQwd49sNlJ9 IiBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Sc/sO7oz"; 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 r191-v6si19046886pfr.152.2018.08.13.15.36.23; Mon, 13 Aug 2018 15:36:38 -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="Sc/sO7oz"; 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 S1732356AbeHNBS6 (ORCPT + 99 others); Mon, 13 Aug 2018 21:18:58 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45654 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732285AbeHNBS6 (ORCPT ); Mon, 13 Aug 2018 21:18:58 -0400 Received: by mail-lj1-f196.google.com with SMTP id w16-v6so13829062ljh.12; Mon, 13 Aug 2018 15:34:43 -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=vz9K13ZdWceVmktSg13RqIlA5y3YYBZB41889HPVjQw=; b=Sc/sO7ozOO7qtE4QOYuSezh34zlQZQF/CwIF+hc5XmTDozjQPbofdPDOH7wKsrAv09 rsP9q0XdHyaFxIYcARAwl9mUS5wf7EBxAphKJjTm27vPROwqTf9PhFfvqGZ4GPbU2ihq nYHVBrhaZ7RDGyUk1meSmPV5AE68QM2PUAv2Wh7OP37QfTZ9rSu4CyxdO77XqNb6y8Fk 2JMRGhdStE9Q8yVNIsVMsILg1X5Yi0UWf7Uj+HueCltF5LKXsDLE0Wi21lKB2AzES4wx iY0ybRv7kdeiTzOkKUqsjAcdZYWtv6abVoWdJ+wxA86hYQ13Pkk+/LgGpR1M/DeB/8DM KKBw== 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=vz9K13ZdWceVmktSg13RqIlA5y3YYBZB41889HPVjQw=; b=nKUA3esmqEJXlgg4Vyj4/XBSf33ebrmuglnLx7N9NwlV6smzPGEMJQbQDnyoDTHEmc f4nyjZr105TCmNt4S+zl6yOQbB1280v6rM2NsZRyouCbBKDW5tngqsoLjmdkKWkpnobA PnSra/JIMnWI6BHfOl+kTxzhZS/Y1AM88zsYOrp8b+kcwYFw6XN8Slog1k3uPQGSsQCg 3/qd+zWUrubhp54aq114j21lxlJlb2vyAJJulJGoKZf4/sNTwibAN9DEe4+j0OGlsFoI E/1cJlrU6Sg1lrkK7hYlHdnw684BrAye6bSCalbwMzUmvPySdAApt/ozItN5sYkAWG89 KpEg== X-Gm-Message-State: AOUpUlH95CUf+5B87PpLObg6/LbZrxFl0LZwIfpNRyX+tcQoWUTRPF64 qOEgLsnmTZMyK/2NiEmHi3Y= X-Received: by 2002:a2e:40c:: with SMTP id 12-v6mr14031781lje.146.1534199682700; Mon, 13 Aug 2018 15:34:42 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id f136-v6sm3572702lfe.71.2018.08.13.15.34.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 15:34:42 -0700 (PDT) From: Janusz Krzysztofik To: Boris Brezillon , Miquel Raynal Cc: Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Tony Lindgren , Aaro Koskinen , Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH v3 4/7] mtd: rawnand: ams-delta: request data port GPIO resource Date: Tue, 14 Aug 2018 00:34:45 +0200 Message-Id: <20180813223448.21316-5-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180813223448.21316-1-jmkrzyszt@gmail.com> References: <20180806222918.12644-1-jmkrzyszt@gmail.com> <20180813223448.21316-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 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); -- 2.16.4