From patchwork Wed Nov 21 11:08:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10692401 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 5D25613BF for ; Wed, 21 Nov 2018 11:08:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 498D32B45B for ; Wed, 21 Nov 2018 11:08:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AB532B48D; Wed, 21 Nov 2018 11:08:51 +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.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,HK_RANDOM_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 D77C02B45B for ; Wed, 21 Nov 2018 11:08:50 +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=8I5viWE2jSUxCU2w+FixEEqK7xIbL8eQ8vH1j1et0a0=; b=u7oiBFPzpEckzbHR7e/j6NNqsD MflQfCYty2EEOpYN/yA1w1beibD5XgRsZmrVcHkEInxklYPUVwckepVlGbgIb328ZQQyNycRtUp8n 0aYjtXxB2QUOwLA8bMNLw8atfsWXPFe3w/37+HykuUCHgIIEGsqcxTGUAn8+E2YXmbHlrXwMbdT31 Md+Hw3/hJx66cGb5OyeRiNRvRLI6wM/bS60CDa0ZWi0nvFl+lIOlpHa1zACUUvcXHxrAm+BAdZOOt d6AfAZh43nIo3KLQqGwDltt9jOr2lY9eYmCJ+GYRqSDIpaWnILhdDD+njt6mkhGxxWhsNCUhKPzwy VP4XzN4w==; 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 1gPQNF-000157-62; Wed, 21 Nov 2018 11:08:49 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPQKy-0006m2-Uv; Wed, 21 Nov 2018 11:06:31 +0000 Received: by mail-lj1-x241.google.com with SMTP id v15-v6so4414458ljh.13; Wed, 21 Nov 2018 03:06:18 -0800 (PST) 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=xJzcdWUi5g1mmy1o8VxmoXAad6mTqA99FbBKb9Bxfrc=; b=r7kVjeMexgP6f9JebK5xtWxEWBrGaxE9aO7UAIPB/mkfz4LHZ5rZH+1b8rKYohtZlb X35+qLvQE4gUhVFlIQp7AbPOC6H45bVsAFgE1CLkLO4Eo1yoOvAITMQd7IWe9YvKK3+n 5Fnlxx4G335qYD00tikii/PZ72X3efGwJq7fRnjLk0MptiDINzN4yx4vzb5odvcd/bSI 2tcxAUKsBBacBnZvbRbjgrSnoDnP5f7hLugH9IWMbIOzwDGqLU77ecaommjrYaMkWclZ yYOMUtRFWbTbRlUW6m6hcPYgucMnZ13Upc8t6MKCSQqF+PARmsl6zmWOK1n04eEWTk0x mVIg== 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=xJzcdWUi5g1mmy1o8VxmoXAad6mTqA99FbBKb9Bxfrc=; b=NLVHt41xpa6EfwjL8vCQmWU/PSpK0BfEMiitHsc+9/ix/O5rDjVKilTJkBqFULUbub 1MNHe/1aFcfnpczx/e7IIDLPj018lNSWDC73fkT+1q9lWkY/mNcKc+nfJzxBPGeRuG0p R3i/mLAzud3Ljffueuxr8x8L0kuO7+0tZ/+G65mD4dEUWqtFtXbKweSjY5jNBHHCgGFa P/k1oKcBpIve1LPgugUJ3Je+IgYLV+qllulaXSNYJrTpGwJgjbUVEKTOAtd95vO1iZYR 4nNZ9C5THZnhmHJUwnftkgESSRJ0uQbWbnkV9riN88VXVYEVhpo2b4IoTMzTwbYm739V 9kNw== X-Gm-Message-State: AA+aEWZG2L8IoFeQUltF8xbfla5o6feJf21GRs34/85BnnyvI5vYx017 g9FbKG4ZaiNLNPr4s5Tf6HA= X-Google-Smtp-Source: AFSGD/UxF4+6EgaFA+wlF99Claii+6Jao8pyHQxGqPr3OZRx9RKbJ/gQQiNoxL7Rl1quD08TtXxBpw== X-Received: by 2002:a2e:81a:: with SMTP id 26-v6mr4019750lji.14.1542798376943; Wed, 21 Nov 2018 03:06:16 -0800 (PST) Received: from z50.intranet (78-10-164-223.static.ip.netia.com.pl. [78.10.164.223]) by smtp.gmail.com with ESMTPSA id x11sm7280047lfd.81.2018.11.21.03.06.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 03:06:16 -0800 (PST) From: Janusz Krzysztofik To: Boris Brezillon , Miquel Raynal Subject: [PATCH v4 2/4] mtd: rawnand: ams-delta: Request data port GPIO resource Date: Wed, 21 Nov 2018 12:08:04 +0100 Message-Id: <20181121110806.32076-3-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181121110806.32076-1-jmkrzyszt@gmail.com> References: <20180813223448.21316-1-jmkrzyszt@gmail.com> <20181121110806.32076-1-jmkrzyszt@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_030629_139201_28A82E67 X-CRM114-Status: GOOD ( 17.95 ) 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, 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 GPIO consumer API. 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 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index f8eb4a419e77..bb50dda05654 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -190,6 +190,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) @@ -275,8 +276,14 @@ static int ams_delta_init(struct platform_device *pdev) goto err_unmap; } - /* Initialize data port direction to a known state */ - ams_delta_dir_input(priv, true); + /* 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 err_unmap; + } + priv->data_in = true; /* Initialize the NAND controller object embedded in ams_delta_nand. */ priv->base.ops = &ams_delta_ops;