Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1965721imu; Wed, 21 Nov 2018 04:52:44 -0800 (PST) X-Google-Smtp-Source: AJdET5fWa/N5QzjUViWVSsg4KgbCNf1vrWrzEXGrZMdNMILEoObN1SBRsLP0TXh8hpX+c1qfCKdY X-Received: by 2002:a62:8f8c:: with SMTP id n134-v6mr6732567pfd.258.1542804764444; Wed, 21 Nov 2018 04:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542804764; cv=none; d=google.com; s=arc-20160816; b=shlNPTPZbWOt9ojRHhhm4GChE4E/RJgcnmhMXsDJtQdwvnGX/dB6QOXt32UhICWoPt DZ7Je9CU0FGFb6xwTmovD4f8wGkPRyQkhMGsZ/sQnJf6Td30fWuGjOZYpxm5pdG3+c4+ NQbbocjoyIX8NqWKI/1j999EmdXsRVfCfI2XYJapUIWJtcUd8UOv3/njePBaY/shM9z+ pPRVimf9b3acj5zeS7yDGUkJUt3ERK1iUlNIiYAjOejRCN6KaNPbrgSbY1Rpd5WmoqMP MujQticfc/DX/r5frBJfm9rcgvjejBq9lv6qsFM/C7Z9u95AKRQ7YCvF+fhDD0ge0s84 zOtA== 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; bh=xJzcdWUi5g1mmy1o8VxmoXAad6mTqA99FbBKb9Bxfrc=; b=NKwk43IvepJYULxvYGO+Vl6ONxWp6q1fvznGchBZ41qo0skf+NwSfigW6OfjgZosc4 AbLrgvtIJydPHQmVRpE/Vdkvuk3DDCRnFcUOeiy2/zuebZnPHs0QL3NQMY70iBlyzUh1 DtefZsQSe09oxg+OGlj2Mdhe21Npj+dvDV69Z9h9I34Qi0XgeuR4ZfgA3Ax3L4bph0AC v3kQTEtBG3Re4pGbsQPzYszHIwKqvchx3ZYeNuqCQCt1JsZ5QJgAdZBau9lT0Gu68eWO BVPkYu1xc5NboxZN/vIyM5GGPyGopv956bOXr3oRvX65BoYD13hpYz0nFo7ffZZ7N5vI VkUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r7kVjeMe; 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 s8si19208826pgm.508.2018.11.21.04.52.27; Wed, 21 Nov 2018 04:52:44 -0800 (PST) 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=r7kVjeMe; 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 S1729867AbeKUVkR (ORCPT + 99 others); Wed, 21 Nov 2018 16:40:17 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:35307 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728114AbeKUVkQ (ORCPT ); Wed, 21 Nov 2018 16:40:16 -0500 Received: by mail-lj1-f195.google.com with SMTP id x85-v6so4461719ljb.2; Wed, 21 Nov 2018 03:06:17 -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=VxKFYnJC95XE5xUsdaFv3zhiPs9Drz/IZiYanyGPHa5DBFsErlrteqpQXYPrtnccRn vDBHjBRHatFmed7NQ2kvy+65L9TVcftfkMJLxW/jcLFlRMNSxqAxQsCFSAls2gT2+Xzv 7w5WycH98TDra94uvNUF7vc2nNm5C4E4Oi69W+IVfYtetbVPaIl9ZmwlN5eQLs0q+IJR 24KaPVs09gSwWoRRn/ZgIuWBK0kFR/YytUsupF7hmYVayStitBO3yOg7asOQVOMLLYYq BFLqKhColL9YSDjK1Ie7sxefQtC7D4F2L74bXP1AMq0e9TZOyew9H6t87WuhH6D3YxKK P6vQ== X-Gm-Message-State: AA+aEWYaPymhPTmPYr5ZnHs4N8la2zDUhiVIrROguw82mvGzyzkAgRU2 uTE42QxV6rqn0NCUBJhc/4c= 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 Cc: Tony Lindgren , Aaro Koskinen , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Linus Walleij , linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik 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> 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 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; -- 2.18.1