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: 10558003 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 02A4E13AC for ; Mon, 6 Aug 2018 22:30:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E40E22986E for ; Mon, 6 Aug 2018 22:30:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D620A29877; Mon, 6 Aug 2018 22:30:52 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AFC82986E for ; Mon, 6 Aug 2018 22:30:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730310AbeHGAl4 (ORCPT ); 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-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 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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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);