From patchwork Wed Nov 8 14:33:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 163072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp954114vqo; Wed, 8 Nov 2023 06:35:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpqaOk0y9z59S7Efc3D4jujF09PoZXjBMxnlsst2PMAlKac52GLFK6IpRgLYZeJqC9HOUV X-Received: by 2002:a05:6a20:9c99:b0:180:18f6:ca99 with SMTP id mj25-20020a056a209c9900b0018018f6ca99mr2274025pzb.56.1699454104049; Wed, 08 Nov 2023 06:35:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699454104; cv=none; d=google.com; s=arc-20160816; b=MOIdbVMPzubBUSXxR9LO5BvY3XB9iEL94xdO4N1Vk6FjFhvfqzNA1QNeU52zZ8co5t 1BdjEVZ+WIezLXk29lQ1l+hGbedM2fXh7JwUHRDPXCnqGTgBAVJay+Dj1m9bnTpnsfSZ Pbl5qPOMIANVxcOdaV3pru4MicWgU46s94R3bDIhCnonCf5wP5akIu/Ol1DpJLjeFDzL DsFwfuaHIYR/iyVN7B1/pp0mX1p9awaRo3eR1gWP7LQF/28xxP16z+dh4jAVILQBbSse VsUHMCuQ3XVFc9SHnsEStFqdgVxG4+qupIPXBCHnyI6AbrPjoQON1coo6GeqOSRbXtqH 8CqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=+oAJ5h0iCYT/XiQuEoEbc72vTkOvqIZdMfvjIyq8PY0=; fh=CFgYY1T12wuhk1cZvmrf/aNXOn5iMyIiDDTIBKwmNsI=; b=e45E8sLLW4jQEhvrv7peu6nWtE+/SBejpRV0R/OVpfwhYqhLJKumbwzbcyPctsOTPg AasX1gzzM9al/7lxhss9wopDFwj8WbC9G/549aUOSOXBkCCBRxzPbHr2tyq3SNLBmafn WLyucDNrp/J8sf4+Pk2VJpLqN27q6iwL2gc/8xf9ZE6REyN6WOzGyFSZpy2X+4+nwQXR XaGkj1MFrC+8Zw9sEb8nmGlHI/H2CK5Ix3DaQC9FSTlX07b13PiSL3H6TvBJU33SchZT UfXL/CqQkLpm1qMRvqGkBBRNFP5cqn2BLk89eeksmIuVBvymTYzcY6DaUXAP7iCSG6tQ ZQzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="J4v/lYiv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ca8-20020a056a02068800b005859d13f276si5259836pgb.569.2023.11.08.06.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:35:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="J4v/lYiv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 51473819D1E4; Wed, 8 Nov 2023 06:34:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234350AbjKHOeI (ORCPT + 32 others); Wed, 8 Nov 2023 09:34:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232821AbjKHOeE (ORCPT ); Wed, 8 Nov 2023 09:34:04 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC441FC4 for ; Wed, 8 Nov 2023 06:34:01 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50949b7d7ffso9335094e87.0 for ; Wed, 08 Nov 2023 06:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699454040; x=1700058840; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+oAJ5h0iCYT/XiQuEoEbc72vTkOvqIZdMfvjIyq8PY0=; b=J4v/lYiv43AA7dDx8Jj2zFvcLETxIFidUCx4LeGxFz7n4rcgsdj/k2ofXUAE4v6ixa u4HHxewjkErpPnzPUyM+6hMI7D1eMxBe7HEF1Ez8s+de8flA3edh2Zuo7PwGTWXSLI3I MGN/pUR5gKdXqK/Vri5Uff6PUcTIaMXusLicYG0SwGnV5hhirTchFF1PemkKYHJWnmX9 koexDLyY+Ut9S338ml0RjSNOp2fZYhtmFVJU7nlA7o2zx/8gcgJBB5fHREy0qDNiDEKr WwAR5H5IjIok3tr+hXXyGfQuXLKCo+oeaRC52n44Ikr8svrM5uOru3ait8saJdGSUcFB Zqbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699454040; x=1700058840; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+oAJ5h0iCYT/XiQuEoEbc72vTkOvqIZdMfvjIyq8PY0=; b=tX5gXOXAvIN4Wby7bO2m7VPcUdfMkWBqohUHdhSOAy1vLz08Dji0sjRDc85yP5GPee OU4c2xs2ZYOqpdVcjld15DaCl9jKHFpqHr9mqEeeXw2h+32/2V2+dhx53qOXkbO3N/Y8 XWfZEbQSSS+xYZxu5ahz8Z1NTByGLIERYtna4Gl5I0HvpkZsZSQGcWA3uIbI0AfukGUD hqJPRgBbI1N660/hgQS+QWsVEeyYXkXeBWGPMausIL3izKLBpOQHhopK2h3G5uoICOEs mvg+oaM8lv0ab+oGhxjbsEaH2L+eB8Smj8CidE8m/3QixWB4sv5NOLeHfJhB0lzhohI2 fAvw== X-Gm-Message-State: AOJu0Yz+8AjkU4TwRVMfHin6CKUKDQDWGYGrjEonyy4PpkubW9qyLgeX gmIlIfvw6+2mTDGFBw0zR1LBww== X-Received: by 2002:a05:6512:b8d:b0:509:46ff:6e57 with SMTP id b13-20020a0565120b8d00b0050946ff6e57mr1807100lfv.8.1699454038182; Wed, 08 Nov 2023 06:33:58 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q10-20020ac24a6a000000b00507a3b8b007sm686773lfp.110.2023.11.08.06.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:33:57 -0800 (PST) From: Linus Walleij Date: Wed, 08 Nov 2023 15:33:49 +0100 Subject: [PATCH 1/6] mtd: rawnand: ams-delta/gpio: Unify polarity MIME-Version: 1.0 Message-Id: <20231108-fix-mips-nand-v1-1-5fc5586d04de@linaro.org> References: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> In-Reply-To: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Ben Dooks Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 08 Nov 2023 06:34:54 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782006786186733448 X-GMAIL-MSGID: 1782006786186733448 The AMD Delta and GPIO RAW NAND drivers share the same platform data file and pass GPIO descriptors for the same type of signals from a board file. Fix the following problems: - NCE (negative active chip enable) should be just CE (chip enable) and flagged as active low. Rename it in both drivers to just "CE". - NWP (negative active write protect) should be just WP (write protect) and flagged as active low. Rename it in both drivers to just "WP". - NRE (negative active read enable) should be just RE (read enable) and flagged as active low. Rename it in the AMD Delta driver to "RE". The GPIO driver does not have this. - NWE (negative active write enable) should be just WE (write enable) and flagged as active low. Rename it in the AMD Delta driver to "WE". The GPIO driver does not have this. - The generic GPIO NAND driver is not expecting the GPIO polarity on CE and WP to be correct and will instead invert the polarity in the usage of the lines (such as setting the CE GPIO descriptor to 0 to activate the chip enable). Fix this by altering the semantics in the generic GPIO driver to assume it is flagged active low properly where the GPIO line is defined. - Fix up the arch/arm/mach-omap1/board-ams-delta.c to use the non-prefixed line names. (The polarity is right in this board.) Signed-off-by: Linus Walleij --- arch/arm/mach-omap1/board-ams-delta.c | 8 ++--- drivers/mtd/nand/raw/ams-delta.c | 60 +++++++++++++++++------------------ drivers/mtd/nand/raw/gpio.c | 40 +++++++++++------------ 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 0daf6c5b5c1c..3a6ab4e27e3e 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -336,13 +336,13 @@ static struct gpiod_lookup_table ams_delta_nand_gpio_table = { .table = { GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_NAND_RB, "rdy", 0), - GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NCE, "nce", + GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NCE, "ce", GPIO_ACTIVE_LOW), - GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NRE, "nre", + GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NRE, "re", GPIO_ACTIVE_LOW), - GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWP, "nwp", + GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWP, "wp", GPIO_ACTIVE_LOW), - GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWE, "nwe", + GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWE, "we", GPIO_ACTIVE_LOW), GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_ALE, "ale", 0), GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_CLE, "cle", 0), diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 919816a7aca7..ab3c8d3da41d 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -33,10 +33,10 @@ struct gpio_nand { struct nand_controller base; struct nand_chip nand_chip; struct gpio_desc *gpiod_rdy; - struct gpio_desc *gpiod_nce; - struct gpio_desc *gpiod_nre; - struct gpio_desc *gpiod_nwp; - struct gpio_desc *gpiod_nwe; + struct gpio_desc *gpiod_ce; + struct gpio_desc *gpiod_re; + struct gpio_desc *gpiod_wp; + struct gpio_desc *gpiod_we; struct gpio_desc *gpiod_ale; struct gpio_desc *gpiod_cle; struct gpio_descs *data_gpiods; @@ -49,9 +49,9 @@ struct gpio_nand { static void gpio_nand_write_commit(struct gpio_nand *priv) { - gpiod_set_value(priv->gpiod_nwe, 1); + gpiod_set_value(priv->gpiod_we, 1); ndelay(priv->tWP); - gpiod_set_value(priv->gpiod_nwe, 0); + gpiod_set_value(priv->gpiod_we, 0); } static void gpio_nand_io_write(struct gpio_nand *priv, u8 byte) @@ -86,13 +86,13 @@ static u8 gpio_nand_io_read(struct gpio_nand *priv) struct gpio_descs *data_gpiods = priv->data_gpiods; DECLARE_BITMAP(values, BITS_PER_TYPE(res)) = { 0, }; - gpiod_set_value(priv->gpiod_nre, 1); + gpiod_set_value(priv->gpiod_re, 1); ndelay(priv->tRP); gpiod_get_raw_array_value(data_gpiods->ndescs, data_gpiods->desc, data_gpiods->info, values); - gpiod_set_value(priv->gpiod_nre, 0); + gpiod_set_value(priv->gpiod_re, 0); res = values[0]; return res; @@ -133,7 +133,7 @@ static void gpio_nand_read_buf(struct gpio_nand *priv, u8 *buf, int len) static void gpio_nand_ctrl_cs(struct gpio_nand *priv, bool assert) { - gpiod_set_value(priv->gpiod_nce, assert); + gpiod_set_value(priv->gpiod_ce, assert); } static int gpio_nand_exec_op(struct nand_chip *this, @@ -204,7 +204,7 @@ static int gpio_nand_setup_interface(struct nand_chip *this, int csline, if (csline == NAND_DATA_IFACE_CHECK_ONLY) return 0; - if (priv->gpiod_nre) { + if (priv->gpiod_re) { priv->tRP = DIV_ROUND_UP(sdr->tRP_min, 1000); dev_dbg(dev, "using %u ns read pulse width\n", priv->tRP); } @@ -273,35 +273,35 @@ static int gpio_nand_probe(struct platform_device *pdev) platform_set_drvdata(pdev, priv); /* Set chip enabled but write protected */ - priv->gpiod_nwp = devm_gpiod_get_optional(&pdev->dev, "nwp", + priv->gpiod_wp = devm_gpiod_get_optional(&pdev->dev, "wp", GPIOD_OUT_HIGH); - if (IS_ERR(priv->gpiod_nwp)) { - err = PTR_ERR(priv->gpiod_nwp); - dev_err(&pdev->dev, "NWP GPIO request failed (%d)\n", err); + if (IS_ERR(priv->gpiod_wp)) { + err = PTR_ERR(priv->gpiod_wp); + dev_err(&pdev->dev, "WP GPIO request failed (%d)\n", err); return err; } - priv->gpiod_nce = devm_gpiod_get_optional(&pdev->dev, "nce", + priv->gpiod_ce = devm_gpiod_get_optional(&pdev->dev, "ce", GPIOD_OUT_LOW); - if (IS_ERR(priv->gpiod_nce)) { - err = PTR_ERR(priv->gpiod_nce); - dev_err(&pdev->dev, "NCE GPIO request failed (%d)\n", err); + if (IS_ERR(priv->gpiod_ce)) { + err = PTR_ERR(priv->gpiod_ce); + dev_err(&pdev->dev, "CE GPIO request failed (%d)\n", err); return err; } - priv->gpiod_nre = devm_gpiod_get_optional(&pdev->dev, "nre", + priv->gpiod_re = devm_gpiod_get_optional(&pdev->dev, "re", GPIOD_OUT_LOW); - if (IS_ERR(priv->gpiod_nre)) { - err = PTR_ERR(priv->gpiod_nre); - dev_err(&pdev->dev, "NRE GPIO request failed (%d)\n", err); + if (IS_ERR(priv->gpiod_re)) { + err = PTR_ERR(priv->gpiod_re); + dev_err(&pdev->dev, "RE GPIO request failed (%d)\n", err); return err; } - priv->gpiod_nwe = devm_gpiod_get_optional(&pdev->dev, "nwe", + priv->gpiod_we = devm_gpiod_get_optional(&pdev->dev, "we", GPIOD_OUT_LOW); - if (IS_ERR(priv->gpiod_nwe)) { - err = PTR_ERR(priv->gpiod_nwe); - dev_err(&pdev->dev, "NWE GPIO request failed (%d)\n", err); + if (IS_ERR(priv->gpiod_we)) { + err = PTR_ERR(priv->gpiod_we); + dev_err(&pdev->dev, "WE GPIO request failed (%d)\n", err); return err; } @@ -328,9 +328,9 @@ static int gpio_nand_probe(struct platform_device *pdev) return err; } if (priv->data_gpiods) { - if (!priv->gpiod_nwe) { + if (!priv->gpiod_we) { dev_err(&pdev->dev, - "mandatory NWE pin not provided by platform\n"); + "mandatory WE pin not provided by platform\n"); return -ENODEV; } @@ -367,7 +367,7 @@ static int gpio_nand_probe(struct platform_device *pdev) * chip detection/initialization. */ /* Release write protection */ - gpiod_set_value(priv->gpiod_nwp, 0); + gpiod_set_value(priv->gpiod_wp, 0); /* * This driver assumes that the default ECC engine should be TYPE_SOFT. @@ -404,7 +404,7 @@ static void gpio_nand_remove(struct platform_device *pdev) int ret; /* Apply write protection */ - gpiod_set_value(priv->gpiod_nwp, 1); + gpiod_set_value(priv->gpiod_wp, 1); /* Unregister device */ ret = mtd_device_unregister(mtd); diff --git a/drivers/mtd/nand/raw/gpio.c b/drivers/mtd/nand/raw/gpio.c index d6cc2cb65214..df6facf0ec9a 100644 --- a/drivers/mtd/nand/raw/gpio.c +++ b/drivers/mtd/nand/raw/gpio.c @@ -33,11 +33,11 @@ struct gpiomtd { void __iomem *io_sync; struct nand_chip nand_chip; struct gpio_nand_platdata plat; - struct gpio_desc *nce; /* Optional chip enable */ + struct gpio_desc *ce; /* Optional chip enable */ struct gpio_desc *cle; struct gpio_desc *ale; struct gpio_desc *rdy; - struct gpio_desc *nwp; /* Optional write protection */ + struct gpio_desc *wp; /* Optional write protection */ }; static inline struct gpiomtd *gpio_nand_getpriv(struct mtd_info *mtd) @@ -146,7 +146,7 @@ static int gpio_nand_exec_op(struct nand_chip *chip, return 0; gpio_nand_dosync(gpiomtd); - gpiod_set_value(gpiomtd->nce, 0); + gpiod_set_value(gpiomtd->ce, 1); for (i = 0; i < op->ninstrs; i++) { ret = gpio_nand_exec_instr(chip, &op->instrs[i]); if (ret) @@ -156,7 +156,7 @@ static int gpio_nand_exec_op(struct nand_chip *chip, ndelay(op->instrs[i].delay_ns); } gpio_nand_dosync(gpiomtd); - gpiod_set_value(gpiomtd->nce, 1); + gpiod_set_value(gpiomtd->ce, 0); return ret; } @@ -276,10 +276,10 @@ static void gpio_nand_remove(struct platform_device *pdev) nand_cleanup(chip); /* Enable write protection and disable the chip */ - if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp)) - gpiod_set_value(gpiomtd->nwp, 0); - if (gpiomtd->nce && !IS_ERR(gpiomtd->nce)) - gpiod_set_value(gpiomtd->nce, 0); + if (gpiomtd->wp && !IS_ERR(gpiomtd->wp)) + gpiod_set_value(gpiomtd->wp, 1); + if (gpiomtd->ce && !IS_ERR(gpiomtd->ce)) + gpiod_set_value(gpiomtd->ce, 0); } static int gpio_nand_probe(struct platform_device *pdev) @@ -316,14 +316,14 @@ static int gpio_nand_probe(struct platform_device *pdev) return ret; /* Just enable the chip */ - gpiomtd->nce = devm_gpiod_get_optional(dev, "nce", GPIOD_OUT_HIGH); - if (IS_ERR(gpiomtd->nce)) - return PTR_ERR(gpiomtd->nce); + gpiomtd->ce = devm_gpiod_get_optional(dev, "ce", GPIOD_OUT_HIGH); + if (IS_ERR(gpiomtd->ce)) + return PTR_ERR(gpiomtd->ce); /* We disable write protection once we know probe() will succeed */ - gpiomtd->nwp = devm_gpiod_get_optional(dev, "nwp", GPIOD_OUT_LOW); - if (IS_ERR(gpiomtd->nwp)) { - ret = PTR_ERR(gpiomtd->nwp); + gpiomtd->wp = devm_gpiod_get_optional(dev, "wp", GPIOD_OUT_HIGH); + if (IS_ERR(gpiomtd->wp)) { + ret = PTR_ERR(gpiomtd->wp); goto out_ce; } @@ -358,8 +358,8 @@ static int gpio_nand_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gpiomtd); /* Disable write protection, if wired up */ - if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp)) - gpiod_direction_output(gpiomtd->nwp, 1); + if (gpiomtd->wp && !IS_ERR(gpiomtd->wp)) + gpiod_direction_output(gpiomtd->wp, 0); /* * This driver assumes that the default ECC engine should be TYPE_SOFT. @@ -381,11 +381,11 @@ static int gpio_nand_probe(struct platform_device *pdev) return 0; err_wp: - if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp)) - gpiod_set_value(gpiomtd->nwp, 0); + if (gpiomtd->wp && !IS_ERR(gpiomtd->wp)) + gpiod_set_value(gpiomtd->wp, 1); out_ce: - if (gpiomtd->nce && !IS_ERR(gpiomtd->nce)) - gpiod_set_value(gpiomtd->nce, 0); + if (gpiomtd->ce && !IS_ERR(gpiomtd->ce)) + gpiod_set_value(gpiomtd->ce, 0); return ret; } From patchwork Wed Nov 8 14:33:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 163073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp954804vqo; Wed, 8 Nov 2023 06:36:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAcuP/grmFrh+WEOXG+2iNt4ClQVBR12BBGihbZ5yTIIKlxZnWCWWgV4FPpoenWMKLqyn2 X-Received: by 2002:a05:6a20:441d:b0:14c:c393:692 with SMTP id ce29-20020a056a20441d00b0014cc3930692mr2707662pzb.7.1699454181249; Wed, 08 Nov 2023 06:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699454181; cv=none; d=google.com; s=arc-20160816; b=cOHpEVj8JmweHCLdAoDwfMxV0DewdAzO++Ylx4Er928pD/sm6gJpXi8zdpcS3VtT6F F6DSFlw7aqrZd/d6Fhu1E0SJzKhOSQ7Lg8KLJJhgeh0PSkdN9sIX8nDgarkPN9leoomN 3zdvgzZ+Y3RQnsUTqoEPiogtNIfKCigagE2O2rowVhP/xNkIhjHLMBRHcPsjjZZBOw/c QA1ACjcMt+5UHZ0tU8/fGlAKVxmxkX+R4sQCGap1T3/jOj76FpQbBVgTpw5mdt2xNC3n K89EZBH/l4bkdXSOZXfC/4Rlg3FRIXmpe9w3IP3Ym/WmnnpfWtl3AKxWxDeJZieeDqZS GVvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=M2oP0CAwM9fqA+0Dgb2EoSHPOfdHteJ6dO8seqEUSC8=; fh=JxrGXcBkvbAHikFcqg1Guip5xChjDhPUlMK79BsD5XY=; b=jwZIbnXZ0zAQg5jJ2cSj7+zu6l+QUXqsWOiIPLVLgC1SaGnnSIAkP2FuO2+IsTTFcQ jgmIJf1LKAb/An3DFuohR4NQ2hp5u6DQNblIhU2nv9iqg/HODEoLM/fvmInKOoe0sBHd FtydeFPnxAW6VWz3gMx0+QWixpvsbPzyZzi3hdtyeXoQiTsWKCgKB2zYesGjqOew9DFA AaY5bitt0X68ELGkGjyuVpi3evNoYCDpobZd7HVrw98dUsIb7YO20rd/fuRtZ2r/it6G 6oOaU5p0zUy9TiYSUEJdDcumfeG9wnTpSpyo2K1p65cVi0nIWs7+Zn8rjIXQXvXpO0iV J4iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sW7Xo8QJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id jc29-20020a056a006c9d00b006c0e3332534si14090795pfb.42.2023.11.08.06.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:36:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sW7Xo8QJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 72FB380DFA7C; Wed, 8 Nov 2023 06:35:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343736AbjKHOeL (ORCPT + 32 others); Wed, 8 Nov 2023 09:34:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232738AbjKHOeE (ORCPT ); Wed, 8 Nov 2023 09:34:04 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7311D19BA for ; Wed, 8 Nov 2023 06:34:02 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-507b9408c61so9217961e87.0 for ; Wed, 08 Nov 2023 06:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699454041; x=1700058841; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=M2oP0CAwM9fqA+0Dgb2EoSHPOfdHteJ6dO8seqEUSC8=; b=sW7Xo8QJdWxPflBHJcbXzP5aLbg/kpAem6CFaTOLIAnzFhvb3eMw9p3pkXkB1yc0aI 9KGny/+dSYoKAuGrYyyhSl6VHfK9HiYLEagOnu9Pwrb+79xb0/m3TMlSuESvYm9oVCL1 4R5l1P9cZKciRQTCrfnX6a8otqDE1HZ3wVzDPjXhVj8SIJFD4qwwDma7C4WHme6yDuFD 6+r9PvceMsf84KoRAQUobaWB6lAI+2nuvmQl8La67RJjzWWBytG8ui0vGL1m+/kA44dj 6lk+xmtpm7H1M1MgAEURLZOqwXj1RXsgNrGHMPpRVEdATSNbVI6iJp9A+9rJwTZcqWaD BpjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699454041; x=1700058841; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M2oP0CAwM9fqA+0Dgb2EoSHPOfdHteJ6dO8seqEUSC8=; b=rNUPwJFEOcUgWZnPfcmYhroacVfjIgz2MpEGLld/9dkTIq0KNhdAKAo8FXgd27fqac AymNBRnhGeJohsHMMwtZnUTeQPrY8p8akQREwbBpR4t3rHPtXcnIf6LaUBmOQyKjVK0a oYBnIkMeWX4N2QpFmA48y1tkYv2bSBhbpu82zmwoZ+vr3tn9TxhwpZxyNKZbVR15YbSZ uX5WsS2MegSkhWRbhw9X98J+7QL08loZrBuy2DpSPcvp5nOJT2SZ/6L3QXhUdCDnk578 OmGBnvvyUjpLr0jYU+/D1efkbvNynTcLZoITAYUP9l0l2RVOFIyOeOH0WfqLNQfIRHHC MIZg== X-Gm-Message-State: AOJu0Yzguw4E8h6hUS4NSADvhuJqg76YcWp+n3T/tYm2TOq6XjI7nio5 ih1onT0A1tISFzn0vtoMybVp7w== X-Received: by 2002:a05:6512:2808:b0:509:45ed:1083 with SMTP id cf8-20020a056512280800b0050945ed1083mr2130529lfb.40.1699454040709; Wed, 08 Nov 2023 06:34:00 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q10-20020ac24a6a000000b00507a3b8b007sm686773lfp.110.2023.11.08.06.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:00 -0800 (PST) From: Linus Walleij Date: Wed, 08 Nov 2023 15:33:50 +0100 Subject: [PATCH 2/6] dt-bindings: mtd: Rewrite gpio-control-nand in schema MIME-Version: 1.0 Message-Id: <20231108-fix-mips-nand-v1-2-5fc5586d04de@linaro.org> References: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> In-Reply-To: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Ben Dooks Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Linus Walleij , Howard Harte X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 08 Nov 2023 06:35:49 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782006867632709924 X-GMAIL-MSGID: 1782006867632709924 This creates a schema for GPIO controlled NAND. The txt schema was old and wrong. Mark the old way of passing GPIOs in a long array as deprecated and encourage per-pin GPIO assignments with the named nnn-gpios phandles. I was unable to re-use raw-nand-chip.yaml or even nand-chip.yaml: the reason is that they both assume that we have potentially several NAND chips with chip selects and thus enforce a node name "nand@0" etc, which doesn't quite work for this device. Since the GPIO controlled NAND is both a NAND controller and a NAND chip jitted together, I have to modify the mtd.yaml nodename requirement to include nand-controller@ as this is the nodename that this device should use. Deprecate the custom "band-width" property in favor of "nand-bus-width". Reported-by: Howard Harte Signed-off-by: Linus Walleij --- Check the required section especially. Since there is no hardware default for anything when using GPIOs for this, I think all these parameters are compulsory. --- .../devicetree/bindings/mtd/gpio-control-nand.txt | 47 ------ .../devicetree/bindings/mtd/gpio-control-nand.yaml | 168 +++++++++++++++++++++ Documentation/devicetree/bindings/mtd/mtd.yaml | 2 +- 3 files changed, 169 insertions(+), 48 deletions(-) diff --git a/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt b/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt deleted file mode 100644 index 486a17d533d7..000000000000 --- a/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt +++ /dev/null @@ -1,47 +0,0 @@ -GPIO assisted NAND flash - -The GPIO assisted NAND flash uses a memory mapped interface to -read/write the NAND commands and data and GPIO pins for the control -signals. - -Required properties: -- compatible : "gpio-control-nand" -- reg : should specify localbus chip select and size used for the chip. The - resource describes the data bus connected to the NAND flash and all accesses - are made in native endianness. -- #address-cells, #size-cells : Must be present if the device has sub-nodes - representing partitions. -- gpios : Specifies the GPIO pins to control the NAND device. The order of - GPIO references is: RDY, nCE, ALE, CLE, and nWP. nCE and nWP are optional. - -Optional properties: -- bank-width : Width (in bytes) of the device. If not present, the width - defaults to 1 byte. -- chip-delay : chip dependent delay for transferring data from array to - read registers (tR). If not present then a default of 20us is used. -- gpio-control-nand,io-sync-reg : A 64-bit physical address for a read - location used to guard against bus reordering with regards to accesses to - the GPIO's and the NAND flash data bus. If present, then after changing - GPIO state and before and after command byte writes, this register will be - read to ensure that the GPIO accesses have completed. - -The device tree may optionally contain sub-nodes describing partitions of the -address space. See partition.txt for more detail. - -Examples: - -gpio-nand@1,0 { - compatible = "gpio-control-nand"; - reg = <1 0x0000 0x2>; - #address-cells = <1>; - #size-cells = <1>; - gpios = <&banka 1 0>, /* RDY */ - <0>, /* nCE */ - <&banka 3 0>, /* ALE */ - <&banka 4 0>, /* CLE */ - <0>; /* nWP */ - - partition@0 { - ... - }; -}; diff --git a/Documentation/devicetree/bindings/mtd/gpio-control-nand.yaml b/Documentation/devicetree/bindings/mtd/gpio-control-nand.yaml new file mode 100644 index 000000000000..5b30ee7ad4a5 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/gpio-control-nand.yaml @@ -0,0 +1,168 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/gpio-control-nand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NAND memory exclusively connected to GPIO lines + +maintainers: + - Linus Walleij + +description: | + It is possible to connect a NAND flash memory without any + dedicated NAND controller hardware, using just general purpose + I/O (GPIO) pins. This will not be fast, but it will work. + The address and data lines of the chip will still need to be + connected so that the contents of a NAND page can be + memory-mapped and accessed after the special lines are toggled + by GPIO. + +# The GPIO controlled NAND has wires going directly to one single +# NAND chip, so it is both a nand controller and a nand chip at +# the same time, but it does not have things such as chip select +# since the use is hammered down to one single chip only. +# There is no point for the chip itself to be a subnode of the +# controller so the raw NAND chip properties are added right into +# the controller node like this. + +allOf: + - $ref: mtd.yaml# + +properties: + $nodename: + pattern: "^(nand|nand-controller)@[a-f0-9]+$" + + compatible: + const: gpio-control-nand + + reg: + description: | + This should specify the address where the NAND page currently + accessed gets memory-mapped, and the size of the page. Usually + this will be the same as the page size of the NAND. + + label: true + + partitions: true + + nand-ecc-algo: true + + nand-ecc-step-size: true + + nand-ecc-strength: true + + nand-use-soft-ecc-engine: true + + gpio-control-nand,io-sync-reg: + description: | + A 64-bit physical address for a read location used to guard + against bus reordering with regards to accesses to the GPIOs and + the NAND flash data bus. If present, then after changing GPIO state + and before and after command byte writes, this register will be + read to ensure that the GPIO accesses have completed. + $ref: /schemas/types.yaml#/definitions/uint64 + + gpios: + description: + Legacy GPIO array for the NAND chip lines, order RDY, + NCE, ALE, CLE, NWP. + deprecated: true + maxItems: 5 + + rdy-gpios: + description: + GPIO for the NAND chip RDY line + maxItems: 1 + + ce-gpios: + description: + GPIO for the NAND chip CE chip enable line, usually + this is active low, so it should be tagged with the GPIO + flag GPIO_ACTIVE_LOW. + maxItems: 1 + + ale-gpios: + description: + GPIO for the NAND chip ALE line + maxItems: 1 + + cle-gpios: + description: + GPIO for the NAND chip CLE line + maxItems: 1 + + wp-gpios: + description: + GPIO for the NAND chip WP line, usually this is + active low, so it should be tagged with the GPIO + flag GPIO_ACTIVE_LOW. + maxItems: 1 + + bank-width: + description: + Width (in bytes) of the device. If not present, the + width defaults to 1 byte. This is deprecated, use + nand-bus-width instead. + deprecated: true + enum: [ 1, 2 ] + default: 1 + + nand-bus-width: + description: + Bus width to the NAND chip + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [8, 16] + default: 8 + + chip-delay: + description: + chip dependent delay for transferring data from array to + read registers (tR). If not present then a default of 20us + is used. + $ref: /schemas/types.yaml#/definitions/uint32 + +required: + - compatible + - reg + - ale-gpios + - cle-gpios + +additionalProperties: false + +examples: + - | + #include + nand@20200000 { + compatible = "gpio-control-nand"; + /* 512 bytes memory window at 0x20200000 */ + reg = <0x20200000 0x200>; + rdy-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + ce-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + ale-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + cle-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + wp-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + + label = "ixp400 NAND"; + + nand-use-soft-ecc-engine; + nand-ecc-algo = "bch"; + nand-ecc-step-size = <512>; + nand-ecc-strength = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + fs@0 { + label = "SysA Kernel"; + reg = <0x0 0x400000>; + }; + + fs@400000 { + label = "SysA Code"; + reg = <0x400000 0x7C00000>; + }; + }; + }; diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml index f322290ee516..e6fd82cbc35d 100644 --- a/Documentation/devicetree/bindings/mtd/mtd.yaml +++ b/Documentation/devicetree/bindings/mtd/mtd.yaml @@ -12,7 +12,7 @@ maintainers: properties: $nodename: - pattern: "^(flash|.*sram|nand)(@.*)?$" + pattern: "^(flash|.*sram|nand|nand-controller)(@.*)?$" label: description: From patchwork Wed Nov 8 14:33:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 163071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp954072vqo; Wed, 8 Nov 2023 06:35:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiKmdVeSRtXsMeONGldkqRKJCS3+yKVpdvuIls7WlHWzDPYqE8JDMrZVcMLEcCOFsVukqa X-Received: by 2002:a05:6a20:431e:b0:17d:d272:7954 with SMTP id h30-20020a056a20431e00b0017dd2727954mr8013860pzk.9.1699454100692; Wed, 08 Nov 2023 06:35:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699454100; cv=none; d=google.com; s=arc-20160816; b=j9d9b6mMwtEK644a+JGp/pGTRCYPVfsUXpUXhCCsuwTNTRSdSjQnTol0/HxFLTEW9Z OUnfvJtWMeytQXDNIAKJtTKKskAPt/C+4kmpaOc18rIJdDOA5e/9O7X+G19neAdPOIo3 YAh18gazpZrIGGscqUcaScMjvPbc2h6ImCmi4AhzgKAPXQpKfGcfokSAggkOpHJD4oSl XRr1/4xxXRcZJAyYZnn0bnjRXCv/tuSYc6/qaS+L7qQDDSRokMvDX8ZCcYJwHy1HYRX5 gE47qqVkZCh4xGtmosDZBEyLBJ84EUPFqS05Anw59P6ZURXfcvPrkJW5FjzNYcWMjD10 NemA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=XORLfLOVJ2jQDbg32nclaixgD4oigISmdEZzRfl6mkQ=; fh=CFgYY1T12wuhk1cZvmrf/aNXOn5iMyIiDDTIBKwmNsI=; b=TG5SeOaW+Yunw84wCpEc87rqK0jc/xX2PhSBB+6VdeukY3pqtB63nKo7kHmeYFMkbA wCd2eud0Jbcs4+uc36a9KlYlgsMH4nOCdvt82JY8BWPfEq8XcTB4agy6/6EYjTgM8h6C wFtysqPYJ1k4bigoaKJsyVw4LrVIWxaPBBNUczfXtlvcjstLQf51x/S15OTe1RjbA9u6 Jz4AEOtivwZGnR0CIs9LNvoHSHZz/db2cAphp0ODpa74M/91hkauzkN3sHOa8kol8fXW JHJ5fGkbvYqJT1k00dX597y50r4rBgOgQb2X6cI96tlK6rYwmowoljPihnxTHXOOMzWM +B9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IcaMB8Ij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id 143-20020a630195000000b005660335e26fsi4555302pgb.485.2023.11.08.06.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:35:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IcaMB8Ij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9EF27819D1DC; Wed, 8 Nov 2023 06:34:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344077AbjKHOeN (ORCPT + 32 others); Wed, 8 Nov 2023 09:34:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233325AbjKHOeG (ORCPT ); Wed, 8 Nov 2023 09:34:06 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77C261FC4 for ; Wed, 8 Nov 2023 06:34:03 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-507bd19eac8so9120054e87.0 for ; Wed, 08 Nov 2023 06:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699454042; x=1700058842; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XORLfLOVJ2jQDbg32nclaixgD4oigISmdEZzRfl6mkQ=; b=IcaMB8IjImBULJ/qiQBgUKoRwl9C5u0thSNnUZreqIZHkgh7jVZVDZb+1Fa6d/emvL 2NlHpyTFR4sohIegZsOqulu/CtRmI9S6zC72DtjXW8ij3nI8IVxn3a7Z4tUFpPhCTWQb 4+E0EItUkG8CxY1NHXWrpwhB/f+J0UTZNTvxxtsk/WRW1xfQTmQZwGsywg9QDwyPKrDx Z9W+IimFtSzqXeQHqe3ZS4NERbdc/b+iK/AlvZOOgCllMzXukhd9cxPwf/C0CG3R9FdP I6hLd9YMI3vR5aoflBvFYnSjhT8xLC3NGioJnwpyInDVNpG9+bW+lAU1cItBz4ao6155 3hWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699454042; x=1700058842; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XORLfLOVJ2jQDbg32nclaixgD4oigISmdEZzRfl6mkQ=; b=WSJ/6AZyOgcQ0bGuZv8IafhWaOquFSa5Ucr8ePsHJH7uMDLr5mDpzn6Xt9nl8pK8DX PmMBqO+h3L77dyZcHs01S/ggfXFQaSLJFObsgVnkm44g1oN6nZAZznrr3ti0iXKY/Blc cavHYFxy37DvRWUFfsclBTSQMIUF+OOEEb9nm0SmXMMN5NkbIhM/pL2M79OrRyV9KKY6 YjRx5tsTxChBQ/tBw3MPrxkn4ednHEFa+lS9IfczNj/3DiEkeCy2oi7qIqmiLekLVn9s NnyzVYT5R9PrBzeEJsT/0VPKoMr8+bOnk7+DiNPHXuWBIubrDM0+qDpwrO4nzvFFC9TR O3Wg== X-Gm-Message-State: AOJu0YwRtr1rj6UZA+IU0NsZ9BzM2ne7Kz5CRVZWAp6iAaAOTsEUAEEB ONhynvgs0Ra6TXYbLnXijB3U6g== X-Received: by 2002:ac2:5d2b:0:b0:500:7685:83d with SMTP id i11-20020ac25d2b000000b005007685083dmr1266850lfb.48.1699454041779; Wed, 08 Nov 2023 06:34:01 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q10-20020ac24a6a000000b00507a3b8b007sm686773lfp.110.2023.11.08.06.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:01 -0800 (PST) From: Linus Walleij Date: Wed, 08 Nov 2023 15:33:51 +0100 Subject: [PATCH 3/6] MIPS: NI 169445: Fix NAND GPIOs MIME-Version: 1.0 Message-Id: <20231108-fix-mips-nand-v1-3-5fc5586d04de@linaro.org> References: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> In-Reply-To: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Ben Dooks Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 08 Nov 2023 06:34:49 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782006782984965171 X-GMAIL-MSGID: 1782006782984965171 This changes the GPIOs defined in the device tree to recommended practice, which is also what the Linux NAND GPIO driver is actually using. In the process, fix up the CE and WP lines to be active low, as is required for proper hardware description. Signed-off-by: Linus Walleij --- arch/mips/boot/dts/ni/169445.dts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/mips/boot/dts/ni/169445.dts b/arch/mips/boot/dts/ni/169445.dts index 5389ef46c480..3e7b46d5072c 100644 --- a/arch/mips/boot/dts/ni/169445.dts +++ b/arch/mips/boot/dts/ni/169445.dts @@ -1,4 +1,5 @@ /dts-v1/; +#include / { #address-cells = <1>; @@ -57,18 +58,18 @@ gpio2: gpio@14 { no-output; }; - nand@0 { + nand-controller@0 { compatible = "gpio-control-nand"; nand-on-flash-bbt; nand-ecc-mode = "soft_bch"; nand-ecc-step-size = <512>; nand-ecc-strength = <4>; reg = <0x0 4>; - gpios = <&gpio2 0 0>, /* rdy */ - <&gpio1 1 0>, /* nce */ - <&gpio1 2 0>, /* ale */ - <&gpio1 3 0>, /* cle */ - <&gpio1 4 0>; /* nwp */ + rdy-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; + ce-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; + ale-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + cle-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + wp-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; }; serial@80000 { From patchwork Wed Nov 8 14:33:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 163068 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp953851vqo; Wed, 8 Nov 2023 06:34:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEV3AXNcMjZKMoMB7vTYFqK4Fpw9v6x7fGA/cE6EGeCkTqr1MlFhv+BUXn1ATY4gNXkW2Qv X-Received: by 2002:a17:902:9687:b0:1cc:5cbf:50d2 with SMTP id n7-20020a170902968700b001cc5cbf50d2mr1811614plp.59.1699454077954; Wed, 08 Nov 2023 06:34:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699454077; cv=none; d=google.com; s=arc-20160816; b=PdIZf3KpYdlLS47CF6sBey4QvQaOWmGOkgnH0A2CMN77yLYWRAAXp+pfkECxo5JFti HAuOZoBmb1/dizkjJQQWgptpWalR49rP3mrgjifOhHzaHmXdDIbgZE2zahXHlIsm0O6x 2AbcoA+wwkGF13s42CXVWNS/HplVn6xkUL01gUo8H9KbhqqM7m0r9fw0tdQwahTNi2BG ELUOjqC7BGlkc9v5QhzrINle9/z9X9orm6sZwEdrHP86ORQIUgBFH79zVv3VF8knXluD wrI3/OwiCYd26JhcQFe9O+WltDnR0gWHsAN5uKEBuVzb70WZlFTRk60crzfOxCwhqhNV kDVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=6aZ+kL6gh2ag7Dh1ER3v2H0746j7EioeKcGfv1Wufa4=; fh=CFgYY1T12wuhk1cZvmrf/aNXOn5iMyIiDDTIBKwmNsI=; b=XLK7T/qAbU44B9QD6/zS87oU7MHVmGZgnCrdtfOVcgvoUdBRKP8Jihpd5O0dGYZBb3 cGVo/4b7P6NSHd3vAqx5YvOaOV/cBC47LrC0lDgNLGo8PWev2as2bDzo9khEvY98ioLE rMTcq8RcVZ22qpTDuIxDJ2d8rn2STrkJH5FnsXdtRAlyyVnMpqGOqo/d7/xhIkGU12mE btD68HZQmyCh5YlWkHfojw0fM6JITX+/+Obj1RxABSTGYxOCDm3xDG31daB0fLtg2D0m 7Har6qFI5w0fsd9YJHesQhGvQjw/n4QpAFZQqIKqnkwx/Q1iFszD8Y+MFeG0msPcybfy S0+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N6yMSwTq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id g4-20020a170902740400b001c5c370d4d3si2267031pll.534.2023.11.08.06.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N6yMSwTq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0739882AE651; Wed, 8 Nov 2023 06:34:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344151AbjKHOeR (ORCPT + 32 others); Wed, 8 Nov 2023 09:34:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233917AbjKHOeG (ORCPT ); Wed, 8 Nov 2023 09:34:06 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9393F1FCA for ; Wed, 8 Nov 2023 06:34:04 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-507a62d4788so9484235e87.0 for ; Wed, 08 Nov 2023 06:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699454043; x=1700058843; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6aZ+kL6gh2ag7Dh1ER3v2H0746j7EioeKcGfv1Wufa4=; b=N6yMSwTq7/c28tYsHUxfi0R2bsSnql6+WM9eXw4ytb31QV4fGwcuTK9P9Lps0DksFN 7VE0PDRlKW/6120k5wc5j+s6OLVwxcqIYrb8Jr3njq8v5PmCsxNf6/OdEeeZ9k1VQgt7 40xjWPof9z5zHlxQCETB5dxP6Lu3vJsukEGvoKBaX/hmjQln5sVrMCXAWqDZeDfja/Yb 7vTvM6KgxXiKTYYVK0Ffw/nS4bu5lDY9d/kVPb23ajd7JCVnlqaBbk/sMsEdjq2rJ3NZ 8SLRoupeWmNi2m6vLeGmmG46V2VDdAspzsDMITcIaIuwblcVfW1ZL9HfbQvD89FI/4tq K2nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699454043; x=1700058843; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6aZ+kL6gh2ag7Dh1ER3v2H0746j7EioeKcGfv1Wufa4=; b=U4Dzb1c8s1K7gfAD6AtmP8DmJwudDKvcM/O3/g1LiAvP/QuXUxHfTT08GB+udM8Rnr u/VNZicx1wsQmEqUWZk98yU0XVpn2CXHqeqoxXx+oEwLlyrtXoRtqvyKGmwypuMbDNn0 wEtnAfP40Aiuo+kwXc/IrNspMuRLNZ1dWUewfBsJLnFKKpDISBOGGAbEeadWBIqHUGP6 5Xzkht5g+ahPlt43f6BE7yHzojToQebx/DRCTtfYA+z3rA3f0z48khFQA4AehDyJu/a4 PSN72jLac9FkjDVfy0cKD5kqnE/43wX/fo4vQWgtFcuWo9xIjcTA8enJxC6FO07dRgnJ Mpcw== X-Gm-Message-State: AOJu0YxmuBzMpbErCk+1AtFla+RAYIpyaQW89boEuJLLtVrOABxClPWm H0hb7VztuGlUBrye9JwMMV5b8g== X-Received: by 2002:a05:6512:3d8f:b0:500:a66b:b189 with SMTP id k15-20020a0565123d8f00b00500a66bb189mr1999537lfv.51.1699454042830; Wed, 08 Nov 2023 06:34:02 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q10-20020ac24a6a000000b00507a3b8b007sm686773lfp.110.2023.11.08.06.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:02 -0800 (PST) From: Linus Walleij Date: Wed, 08 Nov 2023 15:33:52 +0100 Subject: [PATCH 4/6] mtd: rawnand: gpio: Use device properties MIME-Version: 1.0 Message-Id: <20231108-fix-mips-nand-v1-4-5fc5586d04de@linaro.org> References: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> In-Reply-To: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Ben Dooks Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 08 Nov 2023 06:34:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782006759177088137 X-GMAIL-MSGID: 1782006759177088137 The platform data (struct gpio_nand_platdata) isn't really used in any boardfile in the kernel: the only probe path is from device tree. Convert the driver to not use the platform data header at all and read out the device tree properties using device properties so we don't need to have the driver be exclusively device tree either: ACPI or software nodes work fine if need be. Drop the ifdeffery around CONFIG_OF as a consequence. The code reads "bank-width" to plat->options flags and passes it directly to the NAND chip struct, so just assign this directly to the chip instead. The code reads one property "chip-delay" that it stores in pdata->delay and never use, so drop this altogether. If timings should be supported this can probably be done in a more detailed way using the new elaborate timings structs that exist for NAND. The platform data contains a callback to augment partitions, but since there are no board files using this platform data to define a gpio NAND device, this is never used so the code handling it can be deleted. Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/gpio.c | 72 ++++++++------------------------------------- 1 file changed, 12 insertions(+), 60 deletions(-) diff --git a/drivers/mtd/nand/raw/gpio.c b/drivers/mtd/nand/raw/gpio.c index df6facf0ec9a..5553101c709c 100644 --- a/drivers/mtd/nand/raw/gpio.c +++ b/drivers/mtd/nand/raw/gpio.c @@ -22,9 +22,7 @@ #include #include #include -#include -#include -#include +#include #include struct gpiomtd { @@ -32,7 +30,6 @@ struct gpiomtd { void __iomem *io; void __iomem *io_sync; struct nand_chip nand_chip; - struct gpio_nand_platdata plat; struct gpio_desc *ce; /* Optional chip enable */ struct gpio_desc *cle; struct gpio_desc *ale; @@ -175,46 +172,38 @@ static const struct nand_controller_ops gpio_nand_ops = { .attach_chip = gpio_nand_attach_chip, }; -#ifdef CONFIG_OF static const struct of_device_id gpio_nand_id_table[] = { { .compatible = "gpio-control-nand" }, {} }; MODULE_DEVICE_TABLE(of, gpio_nand_id_table); -static int gpio_nand_get_config_of(const struct device *dev, - struct gpio_nand_platdata *plat) +static int gpio_nand_get_config(struct device *dev, + struct nand_chip *chip) { u32 val; - if (!dev->of_node) - return -ENODEV; - - if (!of_property_read_u32(dev->of_node, "bank-width", &val)) { + if (!device_property_read_u32(dev, "bank-width", &val)) { if (val == 2) { - plat->options |= NAND_BUSWIDTH_16; + chip->options |= NAND_BUSWIDTH_16; } else if (val != 1) { dev_err(dev, "invalid bank-width %u\n", val); return -EINVAL; } } - if (!of_property_read_u32(dev->of_node, "chip-delay", &val)) - plat->chip_delay = val; - return 0; } -static struct resource *gpio_nand_get_io_sync_of(struct platform_device *pdev) +static struct resource *gpio_nand_get_io_sync_prop(struct device *dev) { struct resource *r; u64 addr; - if (of_property_read_u64(pdev->dev.of_node, - "gpio-control-nand,io-sync-reg", &addr)) + if (device_property_read_u64(dev, "gpio-control-nand,io-sync-reg", &addr)) return NULL; - r = devm_kzalloc(&pdev->dev, sizeof(*r), GFP_KERNEL); + r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); if (!r) return NULL; @@ -224,40 +213,11 @@ static struct resource *gpio_nand_get_io_sync_of(struct platform_device *pdev) return r; } -#else /* CONFIG_OF */ -static inline int gpio_nand_get_config_of(const struct device *dev, - struct gpio_nand_platdata *plat) -{ - return -ENOSYS; -} - -static inline struct resource * -gpio_nand_get_io_sync_of(struct platform_device *pdev) -{ - return NULL; -} -#endif /* CONFIG_OF */ - -static inline int gpio_nand_get_config(const struct device *dev, - struct gpio_nand_platdata *plat) -{ - int ret = gpio_nand_get_config_of(dev, plat); - - if (!ret) - return ret; - - if (dev_get_platdata(dev)) { - memcpy(plat, dev_get_platdata(dev), sizeof(*plat)); - return 0; - } - - return -EINVAL; -} static inline struct resource * gpio_nand_get_io_sync(struct platform_device *pdev) { - struct resource *r = gpio_nand_get_io_sync_of(pdev); + struct resource *r = gpio_nand_get_io_sync_prop(&pdev->dev); if (r) return r; @@ -291,9 +251,6 @@ static int gpio_nand_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret = 0; - if (!dev->of_node && !dev_get_platdata(dev)) - return -EINVAL; - gpiomtd = devm_kzalloc(dev, sizeof(*gpiomtd), GFP_KERNEL); if (!gpiomtd) return -ENOMEM; @@ -311,7 +268,7 @@ static int gpio_nand_probe(struct platform_device *pdev) return PTR_ERR(gpiomtd->io_sync); } - ret = gpio_nand_get_config(dev, &gpiomtd->plat); + ret = gpio_nand_get_config(dev, chip); if (ret) return ret; @@ -349,7 +306,6 @@ static int gpio_nand_probe(struct platform_device *pdev) gpiomtd->base.ops = &gpio_nand_ops; nand_set_flash_node(chip, pdev->dev.of_node); - chip->options = gpiomtd->plat.options; chip->controller = &gpiomtd->base; mtd = nand_to_mtd(chip); @@ -372,11 +328,7 @@ static int gpio_nand_probe(struct platform_device *pdev) if (ret) goto err_wp; - if (gpiomtd->plat.adjust_parts) - gpiomtd->plat.adjust_parts(&gpiomtd->plat, mtd->size); - - ret = mtd_device_register(mtd, gpiomtd->plat.parts, - gpiomtd->plat.num_parts); + ret = mtd_device_register(mtd, NULL, 0); if (!ret) return 0; @@ -395,7 +347,7 @@ static struct platform_driver gpio_nand_driver = { .remove_new = gpio_nand_remove, .driver = { .name = "gpio-nand", - .of_match_table = of_match_ptr(gpio_nand_id_table), + .of_match_table = gpio_nand_id_table, }, }; From patchwork Wed Nov 8 14:33:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 163069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp953873vqo; Wed, 8 Nov 2023 06:34:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ1wau2ZYjB6/IURKg9/GPq5C5OVBrv2IM4K0B04IwCs9M9weAKrUvY3cuEtcoI2fzfXOh X-Received: by 2002:a05:6358:880b:b0:169:845b:3434 with SMTP id hv11-20020a056358880b00b00169845b3434mr2408637rwb.21.1699454080391; Wed, 08 Nov 2023 06:34:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699454080; cv=none; d=google.com; s=arc-20160816; b=K8bSkK6mETWVSQH5Df8CHyHuJmS83KSwUsxddqTgjtk/wOR5ynrc1WjQlWmJWnCdJm OwoEscDyPD6DlaHM+WopZ79Ti1M/i32jzOhOxSc5aR3j1VMFuXbNBXRJ6NHWrkwS6sOc q4Zo+mTZyiXCrHpnTy+CnBhvMt9LpLZ/SjTHXVKMPKKFiC+/A24IZeBeSb7SGJra1rjQ CHL7Ay4SnzWF7wWXj7GmjuVAZwsf7JOyyhXKI8vBrM/gHBdMeVNP0axfBVoJbamTujMx Nir0j0JzG0AjshlhAn0Z+QIUshRxZL5FyfkSyLV7/FihsrimfWNe+CQueZPfoz6GWMzM Ldtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=pGzclwbFLS82d1Yy6hJpVSYEp7mUVdHhXoDoAeHaQ9o=; fh=CFgYY1T12wuhk1cZvmrf/aNXOn5iMyIiDDTIBKwmNsI=; b=OOrFUqAPoRkgfi5Q2mfpNJJ3epUF71YnTtxZG3TnRV/ZQb2+QkTtz0xArc+lO6DNNW DXBbzPZwkpC7vcdF0nRyVoPzQRb+DMHqqx4dBdyXKpWdsgCN02IsNoGI2chwanJvY444 w+8k2XvS4B/5fGRoadB+EsVvBpv5/6r+V4qp+TBOIZeZuaJm9V7i2I2bHALCBRgXLbVl M3VthoKDf2rXqZrgU3Zmp4mRCL7ilWnicvbG8OrETVDCswg3XjmjwmwzgdYzgOyQCV1d cUXSYi1kkM9w3HwrbCd5xvCRS/oKECQUnW0uKj0h6Tbq8ZgIbKmKXGoK5I5Y/tktsihG gzdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oVABV4XW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h62-20020a638341000000b005b7c45c3cabsi3897845pge.857.2023.11.08.06.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oVABV4XW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A97B6832AF5B; Wed, 8 Nov 2023 06:34:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233242AbjKHOe0 (ORCPT + 32 others); Wed, 8 Nov 2023 09:34:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234221AbjKHOeI (ORCPT ); Wed, 8 Nov 2023 09:34:08 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FE9F1FC4 for ; Wed, 8 Nov 2023 06:34:05 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5094727fa67so9447387e87.3 for ; Wed, 08 Nov 2023 06:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699454044; x=1700058844; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pGzclwbFLS82d1Yy6hJpVSYEp7mUVdHhXoDoAeHaQ9o=; b=oVABV4XWqQX4uB44dRsT21hjjoqdkvOgsOImOXTAtpUICemdRUdvYHEH8YLYH5PtT3 4fyTASLfBvHLpqJ+VPkTw1r+RqvuyPD4stWb5qv0K/DHFOyqz1udM4zi4zXIbb95DMzZ bkH6Qv7nvR4e7n752njaUhxNhOR0TRIzGwjn71sdhhcP0G/8yeKfUMGFcZgJvdB29RWe tcU8zC1LztlpGR0/g7NiI8vWMjazb4cccWzCjlvsloZetpCM/OmJ3WnRIZIU4C3MzmWU dVSneU0XTqZRu1ZlBGClW9kI4CWBNBVoiZlZ6er2n3MHMa3zBvArToJ26mp35Q6526Y0 ogYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699454044; x=1700058844; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pGzclwbFLS82d1Yy6hJpVSYEp7mUVdHhXoDoAeHaQ9o=; b=baqOz3IXYoEJC9iWOkGBp/p6w9wGKy5UwcUnf/ThteTwgtf8HdCzEiZ+XL/hxl91rL +f5yV0h7P69cakakcx2jSGF9yVrmv9l3TaeIvtLzZ4hs1e+wLWAW1yMcyAij6lAR0Qle giEumA5p9siko4ovYK9KyKKMX9rjTIeq93KX15p94l+qf5mW4sA0QpaGXrKMBdy+s9tz 0EspHvTQa32RFmoLiCCWL1v2jvr2EHPeQa8M2O3JCBYcfAcTVaQ4lnGFNOXBKDtXI3RE cHUx5E7DcAJY0fYUBHepEVuGxhcPTPh8EPlq9jBju7I86W7b5DburxF+TmTTu1WQNpKo 1CDA== X-Gm-Message-State: AOJu0YwsYgnC4121EzjY05m2nmiGU9fHvc7jX5qEMg8KmGmH+lMek212 gJN9lh3aB0VdMVOhGOb97j9Udg== X-Received: by 2002:ac2:5a1a:0:b0:509:4541:5e97 with SMTP id q26-20020ac25a1a000000b0050945415e97mr1368218lfn.29.1699454043887; Wed, 08 Nov 2023 06:34:03 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q10-20020ac24a6a000000b00507a3b8b007sm686773lfp.110.2023.11.08.06.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:03 -0800 (PST) From: Linus Walleij Date: Wed, 08 Nov 2023 15:33:53 +0100 Subject: [PATCH 5/6] mtd: rawnand: gpio: Support standard nand width MIME-Version: 1.0 Message-Id: <20231108-fix-mips-nand-v1-5-5fc5586d04de@linaro.org> References: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> In-Reply-To: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Ben Dooks Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 08 Nov 2023 06:34:39 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782006761758000709 X-GMAIL-MSGID: 1782006761758000709 The standard property for describing the band width of a NAND memory is "nand-bus-width" not "bank-width". The new bindings support both so make Linux check both in priority order. Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/gpio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/gpio.c b/drivers/mtd/nand/raw/gpio.c index 5553101c709c..d5bd245b0c0d 100644 --- a/drivers/mtd/nand/raw/gpio.c +++ b/drivers/mtd/nand/raw/gpio.c @@ -183,7 +183,15 @@ static int gpio_nand_get_config(struct device *dev, { u32 val; - if (!device_property_read_u32(dev, "bank-width", &val)) { + /* The preferred binding takes precedence */ + if (!device_property_read_u32(dev, "nand-bus-width", &val)) { + if (val == 16) { + chip->options |= NAND_BUSWIDTH_16; + } else if (val != 8) { + dev_err(dev, "invalid nand-bus-width %u\n", val); + return -EINVAL; + } + } else if (!device_property_read_u32(dev, "bank-width", &val)) { if (val == 2) { chip->options |= NAND_BUSWIDTH_16; } else if (val != 1) { From patchwork Wed Nov 8 14:33:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 163070 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp953944vqo; Wed, 8 Nov 2023 06:34:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHynVa6q32c1+u/ncoq3ZoJNf1KCC3BjFKVXej7UANlL37i6AeY6Zm9wpcK89k1vNHad1fz X-Received: by 2002:a05:6a20:8417:b0:181:16c7:6cd0 with SMTP id c23-20020a056a20841700b0018116c76cd0mr2559448pzd.17.1699454087485; Wed, 08 Nov 2023 06:34:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699454087; cv=none; d=google.com; s=arc-20160816; b=dOQcHRGagKQZQONgCixWR+5eqL9UNvLzjg7u368NKbXEX9u8JS0V+f2VUOC/WDIanA 72Ym3ttN7fSZ34WWuJVljPu5ecrO2yAuooQVG663YEQOHM+qndIqJ6ez88Lw/HPYTizl yY2dmEaBGd9G4LaqNQUozMsgIbn7NsNPBVfZZdka7Xt62BfAdGiakMuCGKZ7PDsJ5pVT orTtMoZ0xEFkNsLd1ZviL2V9dQKxt0gPLhnxLQ/MkZMh+bBDjWyjV7y44gXRCExpVli4 Li9TbT/vDbJQ/eNCJv9TpnELXIEJwkBZ64LVbgZ0LOfVfUW53p6gWcYToKM46wbzadaZ BIFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=78GU8j4+SoSSNRmxCZnZFjlRCHFt/xGux/FgF9FARuk=; fh=CFgYY1T12wuhk1cZvmrf/aNXOn5iMyIiDDTIBKwmNsI=; b=AUEUB1tgJEE9WEVueBSmuiqXLqccVf0pPQCINYgV4T5/BmJH2sNr/k/mcI1mk+Vzs+ GuLM9mS/sqo0V+TDvynT3dvYz3efbOTTrgvlMswRc19AqrdexLnakpUu3IJIrVS0Cnos O0iOz4LmXDFFajWO3yzotcCil6g31MLatibDmIMgGmm4amndzUPoT+0+Fe01PVP+1m3N /E28k+FkePbPZKOSnoqwZOlU7aRFlgFY9GwzHME0u3keZ74wZEOirJ5t86G6uq0LniBU /E0RHq44YSOeM6gwZPxgM2e+6SOO3/rywV+6P27ESB3f02sGprGHQNVJGlN09IvhQW15 Tiyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BA5E9/N+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ka11-20020a056a00938b00b006be1c26af7dsi13169021pfb.236.2023.11.08.06.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BA5E9/N+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6E77C83382B4; Wed, 8 Nov 2023 06:34:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235293AbjKHOec (ORCPT + 32 others); Wed, 8 Nov 2023 09:34:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344345AbjKHOeT (ORCPT ); Wed, 8 Nov 2023 09:34:19 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA3A41FD7 for ; Wed, 8 Nov 2023 06:34:06 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-507ad511315so10059557e87.0 for ; Wed, 08 Nov 2023 06:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699454045; x=1700058845; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=78GU8j4+SoSSNRmxCZnZFjlRCHFt/xGux/FgF9FARuk=; b=BA5E9/N+hjkCBkXNo2GSEYWwgGb4ioYhqdzF7T0DzpCReIDP/433BPXtvE85AJrAkz GN3ACgC45g1C15b6V/fsatzmsaGVpEKBCeZcG5faFhyGLkzC2Wrk104ejAn4EopzQ5ZR dHgyH+FM8KHQ/MjXLxt3mGYxpF0OVPMniExqnVf4+ggq44GGKiNTa74brIbsTRO70ZX+ jaGEjzu8gA5stmVsYCvAkPDka+SrXLJfGGLrl5PdRccl+Q+rFLWJLV+kz4XZm/wiECH1 yuL0WY6JFltpZj8rBkG0vv+romuVYkHpPbKQGfje959be4/CUncvxAQsrbL2+hevnkhh OaNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699454045; x=1700058845; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=78GU8j4+SoSSNRmxCZnZFjlRCHFt/xGux/FgF9FARuk=; b=AnQcvECwvp7XaEeWLSI3S6eV0/yzx9nMWoAnJ2sfygdngl6eR1yhc2hrOY641oqXQG DXMBnVxIPgEzKgaVsthTL7Q+CZbClvyxxgz8dGE2HNlzPxzq8bsTzs/6KNklzUjUj0te dE6BfCRDYjT9BgFcOPz2z9eKPNlTPvHHE6xvl5iyvEyAtAJw96ryS05ePUtMafe/4Enq 2GbKRK37Uzv1va0Nr3XeJ1F2kZebW4Ee/KMCIofqMLr4pOtMsumIHwmRemK2/PyCup7Z FmoOMSP4xxORwpakXGzbUdaTljH9m1kXrjlYvmtbZXhSzDQhXqmRY+FbwaOPYsWlPrzu jZ8A== X-Gm-Message-State: AOJu0Yw5b3pXd5RIgMsc9cuzN70HZffDv3P4WvBxXC0GCx6OyJm4bSPE FsNU8I/FXbe4svTNOrOUlQfmuw== X-Received: by 2002:a19:9110:0:b0:507:b935:9f5f with SMTP id t16-20020a199110000000b00507b9359f5fmr1441210lfd.24.1699454044974; Wed, 08 Nov 2023 06:34:04 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q10-20020ac24a6a000000b00507a3b8b007sm686773lfp.110.2023.11.08.06.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:34:04 -0800 (PST) From: Linus Walleij Date: Wed, 08 Nov 2023 15:33:54 +0100 Subject: [PATCH 6/6] mtd: rawnand: gpio: Rename file MIME-Version: 1.0 Message-Id: <20231108-fix-mips-nand-v1-6-5fc5586d04de@linaro.org> References: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> In-Reply-To: <20231108-fix-mips-nand-v1-0-5fc5586d04de@linaro.org> To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Ben Dooks Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 08 Nov 2023 06:34:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782006769408933712 X-GMAIL-MSGID: 1782006769408933712 The implementation of the GPIO NAND controller is just "gpio" with the usecase for NAND implied from the folder nand/raw. This is not so great when the module gets the name "gpio.ko". Rename the implementation to nand-gpio.c so the module is named nand-gpio.ko which is more reasonable. We put "nand" first instead of "gpio" because the order is usually -.c, cf ls drivers/gpio/ Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/Makefile | 2 +- drivers/mtd/nand/raw/{gpio.c => nand-gpio.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile index 25120a4afada..f0e377332812 100644 --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile @@ -18,7 +18,7 @@ obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o obj-$(CONFIG_MTD_NAND_NDFC) += ndfc.o obj-$(CONFIG_MTD_NAND_ATMEL) += atmel/ -obj-$(CONFIG_MTD_NAND_GPIO) += gpio.o +obj-$(CONFIG_MTD_NAND_GPIO) += nand-gpio.o omap2_nand-objs := omap2.o obj-$(CONFIG_MTD_NAND_OMAP2) += omap2_nand.o obj-$(CONFIG_MTD_NAND_OMAP_BCH_BUILD) += omap_elm.o diff --git a/drivers/mtd/nand/raw/gpio.c b/drivers/mtd/nand/raw/nand-gpio.c similarity index 100% rename from drivers/mtd/nand/raw/gpio.c rename to drivers/mtd/nand/raw/nand-gpio.c