From patchwork Mon Aug 13 22:34:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10564933 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 3EAB71510 for ; Mon, 13 Aug 2018 22:39:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F1F7293F7 for ; Mon, 13 Aug 2018 22:39:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22F4D293FE; Mon, 13 Aug 2018 22:39:37 +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 C457D293F7 for ; Mon, 13 Aug 2018 22:39:36 +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=3vLIDuBg1biOs08o/Wi5hZmS2P0oPYIt6oaToEP8I/o=; b=frFYRlL7eChgRYjd/jGkV9nMDC FdodDZmejoUOAJolaK6EW5FKBA5BZV9xbZE/MqNETZTcu3icJNxeRy5a7sg2IfZbYeqJM3cWpBcMk wTRQFCTx+rvHNnJJ68HjDOyFo6OvmYOKquKPZ5sxaxpQ9kTufJ5DKz8L9HEC1ec8UKgFrs8N/DcSk 9i9jIjpXY7z7yxva3XkjlhW0umWTgODylBTRip4oGACBzXgJ9Ure/LbwnNxVtR/4xaDa0HVpLO7oN Vd6ll7VjOkabLyzdbiMdSavqt0mabe2njLHfI73+jPb/j7oarRYU9/9+AwfjNbkcRfyRDynivwT7I lmo8zU6Q==; 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 1fpLUr-0004yJ-AL; Mon, 13 Aug 2018 22:39:33 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpLQL-0008TW-Td; Mon, 13 Aug 2018 22:34:55 +0000 Received: by mail-lj1-x243.google.com with SMTP id l15-v6so13832541lji.6; Mon, 13 Aug 2018 15:34:44 -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=VaxRf2DfGE07o0DFZOynYRyim07erOPgt8amd23mTKLRTKSLmRiUrC0wXBMT7Xo/Sr EekFbkQQaui3G1NQkcFlECouUdhmmtDHE9Lal9S0MwJdHTTKjGLYbVFs3pc0xMmK6gBF NdBOx042tlufPdl+i8zmFB0NwKiRY8pr0qPYJS6lK9J2kEyaN7R5s/gIeMGsG6FzL5Rc jLRILfIZpBBB7stkaRbWkNwB0zl7dj9U2wJtiNaiD2jJbIkxJ10zLu5Yxtzrxyq77ynq S5SOzS2YZDpDAQgf4z1KsolSwOEfKyzFfzXdMKBrWWrfZBOO7N0eD8FrkTUi2alBPU3K FeBQ== X-Gm-Message-State: AOUpUlEpDh2KyVkGpTGWFQNYZz4iI3UuSuAYV3dmFKlSaTUTtyx4oye/ vFkKi65WDqsSlAnDwEELTtQ= X-Google-Smtp-Source: AA+uWPxJN79o1XPPqE854s9dxRpDUISzRyn0pzGpzAf8KYPCwk5o0DCn2KcOhBtvHMIoatz7sqmBdg== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180813_153453_956232_B4FA5F4D X-CRM114-Status: GOOD ( 16.75 ) 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, Aaro Koskinen , Tony Lindgren , Richard Weinberger , Linus Walleij , Janusz Krzysztofik , linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, linux-gpio@vger.kernel.org, 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);