From patchwork Sun Mar 24 22:33:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10867767 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 94AE1925 for ; Sun, 24 Mar 2019 22:34:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FD13285A7 for ; Sun, 24 Mar 2019 22:34:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20E9E28FC8; Sun, 24 Mar 2019 22:34:42 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable 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 A9AC7285A7 for ; Sun, 24 Mar 2019 22:34:41 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=LJs6iDykvuq43d/e1eXWz86CK7tRoNj1hLYnFkp0OGo=; b=m3s+7Kye0y8QWL 18Jd7H+wtc9eJJzB+N/VJYHOxAqgkEJjeUiY/0rNZrGX0U5ALkK2sQ3XrrmBbWNN06OxEc0U9W/NO 4iCfHIhYiIfcshqGBeylBKPy+ag3wpS0GKTvyVTHrbJxU4yr82SF5kSMjelRYA6PZRrNDw0cV1ipE rHZnnQR32FuVdvyw/5mHiYaw3unta38/aNogHuI4n3UUPX69Ae7D4WXXrTnqw5iLgYVvomrSg2Yvd onNdo9QQ3TC0K2wYhXepDdhc4CR+l02Imo0fFJLFQ28tf0rYgYfe6QwjP7e5AVe+xwFRtGnEYCZrJ NyO8YXlUQGhEEahcUyaQ==; 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 1h8BhK-0000fg-Uj; Sun, 24 Mar 2019 22:34:34 +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 1h8BhH-0000fH-Fw; Sun, 24 Mar 2019 22:34:33 +0000 Received: by mail-lj1-x243.google.com with SMTP id y6so6108045ljd.12; Sun, 24 Mar 2019 15:34:30 -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 :mime-version:content-transfer-encoding; bh=jo46dSpvZSN1TN7vD8NpGaggh1SE8FrmPLyEYV3JD/Y=; b=MkcXvtFjLvU0+Or9yc3L+Epwks0AgedL9rcDQQrKq9TGR6llz1b5hsz4mZaOGyH95c bgLNiMi84HSntOgV0PRgQ8JFffvZY2mYAck4EYCFz+Hb4jg/XF1m4PzDxiuIL0c3e1se R5qmu3by1qggAfd09pf2mgNlA9fETu4FN4b4mZO0AOgZmeYnMAsg+uTprJLzW95J7k+4 RFu+9Gh28inRQplofEF1nk43nKmwJM0WxbMYHk3ZmTelfgQzT5EMGKqFzPpA3JdcWfDO nyT7ZMwB3BFoYI7SKTpwLhgmEv4GRPJMkEGuOcYFSLVbRy6iYIjZbI5e/M1omG6SulEo MEwA== 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:mime-version:content-transfer-encoding; bh=jo46dSpvZSN1TN7vD8NpGaggh1SE8FrmPLyEYV3JD/Y=; b=Gm4etQOWNR7X/oA5l22lBkUev+93v4cSkTCK6Mbbo3aN8PsuRIthSFjRJnKWCDQKHs 7uEZm5Qohd9x3GoR8Fq885lb/HIkSygvv6SETGXC+2TzQlXOFAoZqgJOoDeUt3EaBmBz VZemQxMX+T3mX9aQ+ZySzzKoSVnA+BVAsvtUAwuFjNXNMIjA4Qzep3PPODNhj527mVyi up3bmf0HBimzr2RHAkzHnNZSOdgq9PCnEKnzS+r8BAsNb0IXiCfKV1duC5fOgLC/wtzT e9NI914nWp15p7avKVnDQKpQwigyjPOtDZkKJii7yTmt3FOSTYOdCQLiK/a+yFAN6z6L +mtQ== X-Gm-Message-State: APjAAAVwYmQwa6PPRZtdR3heoob8+5HeayeriDA+s/QsMSZFrSzVCTZT flQeEPlMOt2i8nWNc25KazA= X-Google-Smtp-Source: APXvYqw5HGdP9TLmBjfsNtycFwIx6TtTmV1CL2ndpqJUJyVNMec6h44CyqSsLVBj4orKb7nx0nS/qw== X-Received: by 2002:a2e:9b4e:: with SMTP id o14mr11530352ljj.189.1553466869131; Sun, 24 Mar 2019 15:34:29 -0700 (PDT) Received: from z50.gdansk-morena.vectranet.pl (109241207190.gdansk.vectranet.pl. [109.241.207.190]) by smtp.gmail.com with ESMTPSA id x76sm3144324ljb.17.2019.03.24.15.34.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 15:34:28 -0700 (PDT) From: Janusz Krzysztofik To: Boris Brezillon , Miquel Raynal Subject: [PATCH v2] mtd: rawnand: ams-delta: Drop board specific partition info Date: Sun, 24 Mar 2019 23:33:44 +0100 Message-Id: <20190324223344.24590-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190319223718.26131-1-jmkrzyszt@gmail.com> References: <20190319223718.26131-1-jmkrzyszt@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190324_153431_532982_E500D308 X-CRM114-Status: GOOD ( 17.46 ) 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 , Janusz Krzysztofik , linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Brian Norris , David Woodhouse , linux-arm-kernel@lists.infradead.org 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 After recent modifications, only a hardcoded partition info makes the driver device specific. Other than that, the driver uses GPIO exclusively and can be used on any hardware. Drop the partition info and use MTD partition parser with default list of parser names instead. For the OF parser to work correctly, pass device of_node to mtd. Amstrad Delta users should append the following partition info to their kernel command line, possibly by embedding it in CONFIG_CMDLINE: mtdparts=ams-delta-nand:3584k(Kernel),256k(u-boot),256k(u-boot_params),\ 256k(Amstrad_LDR),27m(File_system),768k(PBL_reserved). For their convenience, CONFIG_MTD_CMDLINE_PARTS symbol is selected automatically from that board Kconfig if this NAND driver is also selected. Signed-off-by: Janusz Krzysztofik Cc: Tony Lindgren --- CHangelog: v1->v2: - fix a typo poined out by Aaro - thanks! - fix device_node not passed to OF parser via mtd_info - commit message reworded and reformatted a bit for better readability arch/arm/mach-omap1/Kconfig | 1 + drivers/mtd/nand/raw/ams-delta.c | 29 ++--------------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index c4694f26b5c4..62cf20f22828 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig @@ -171,6 +171,7 @@ config MACH_AMS_DELTA select LEDS_GPIO_REGISTER select REGULATOR select REGULATOR_FIXED_VOLTAGE + select MTD_CMDLINE_PARTS if MTD_NAND_AMS_DELTA help Support for the Amstrad E3 (codename Delta) videophone. Say Y here if you have such a device. diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 8312182088c1..e0f09179bbda 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -41,31 +41,6 @@ struct ams_delta_nand { bool data_in; }; -/* - * Define partitions for flash devices - */ - -static const struct mtd_partition partition_info[] = { - { .name = "Kernel", - .offset = 0, - .size = 3 * SZ_1M + SZ_512K }, - { .name = "u-boot", - .offset = 3 * SZ_1M + SZ_512K, - .size = SZ_256K }, - { .name = "u-boot params", - .offset = 3 * SZ_1M + SZ_512K + SZ_256K, - .size = SZ_256K }, - { .name = "Amstrad LDR", - .offset = 4 * SZ_1M, - .size = SZ_256K }, - { .name = "File system", - .offset = 4 * SZ_1M + 1 * SZ_256K, - .size = 27 * SZ_1M }, - { .name = "PBL reserved", - .offset = 32 * SZ_1M - 3 * SZ_256K, - .size = 3 * SZ_256K }, -}; - static void ams_delta_write_commit(struct ams_delta_nand *priv) { gpiod_set_value(priv->gpiod_nwe, 0); @@ -238,6 +213,7 @@ static int ams_delta_init(struct platform_device *pdev) mtd->dev.parent = &pdev->dev; nand_set_controller_data(this, priv); + nand_set_flash_node(this, pdev->dev.of_node); priv->gpiod_rdy = devm_gpiod_get_optional(&pdev->dev, "rdy", GPIOD_IN); if (IS_ERR(priv->gpiod_rdy)) { @@ -315,8 +291,7 @@ static int ams_delta_init(struct platform_device *pdev) return err; /* Register the partitions */ - err = mtd_device_register(mtd, partition_info, - ARRAY_SIZE(partition_info)); + err = mtd_device_parse_register(mtd, NULL, NULL, NULL, 0); if (err) goto err_nand_cleanup;