Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2670824img; Sun, 24 Mar 2019 15:35:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfEd7YrPj61M7hsLenmtlkObw49K1brJnQuoGhz8xZ6SGE3mgdgTHH1e+Sxw03ioinwRCx X-Received: by 2002:a63:cc43:: with SMTP id q3mr20651778pgi.387.1553466922316; Sun, 24 Mar 2019 15:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553466922; cv=none; d=google.com; s=arc-20160816; b=f5pxrUVNNGtfieTB+nSlmTJpHUr0G1lWZHiYY8E/iHm35+cGTcjSKxe4sbjYjApKMp FfGLm/dgikaMQ+6NcQgPxPzlaPclwHoSjxVFF88Ka3NFVWqlwqsvJzDw5LXmzyjddOFt mIeNuQQ6oxC6duuMzkcgERdfQgYYx94ZzBFBr/gLNe6uIgCfco9183BHFiiWzyS2NjJR jCHH3eeHjCxxbrFg9us7zJkQ9kw1bWk+urf47PLVYyrX+NNBg229xjuev+iZAoQWwe2X 6ino3EUFhNJqn8JektFKpEis+UYQCeFDfRcDmCVB+9hXBk6LqkAeh22HssAVQoxZiFeU 1i7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jo46dSpvZSN1TN7vD8NpGaggh1SE8FrmPLyEYV3JD/Y=; b=telun1xuL0XMWsSm0heJfpErVDBSXbbDSWzJmcFgO5zFRO2cJC79rz0jCBymHq/9cy gJg0ANB5wvdAyWzLKaEtOb+y0MZpi2rm/uWmXzP2JctjNiacO383e3Ml3FkvYUujLAFI 0pV2pu+MhfM70h4uPWb0ovzLTyPA9ei0rETB4EQLt8/oBMWQsk55m7jarVG/feQa4/lx cFzLX79D6C3EnUp4S7VPMDSCW1oF7ms/9uTb4pORt0REPyMBdth1N4YTyGUnDlu/G2yN yVGSkFp1SX4PL/HZrzsBBuUnDI4n2x0l3SDcQn+9R2kmxwYi8Ce9YqUpVUk1CVEw2cmc P//g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MkcXvtFj; 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 m18si11610630pgv.396.2019.03.24.15.35.07; Sun, 24 Mar 2019 15:35:22 -0700 (PDT) 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=MkcXvtFj; 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 S1729069AbfCXWeb (ORCPT + 99 others); Sun, 24 Mar 2019 18:34:31 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35434 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbfCXWeb (ORCPT ); Sun, 24 Mar 2019 18:34:31 -0400 Received: by mail-lj1-f196.google.com with SMTP id t13so6122584lji.2; Sun, 24 Mar 2019 15:34:29 -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=JzT4bVlrvkSKHO6u22feCUfGTefcI37/BKnot6nj+yvdlTSzRvJ/iVP2e3Iol5V15Y OADvA6Yw51o1YAwiFUa7Bm7BYelC6SyqRslIKlyFx1KfPS4KcA0ohz4X3jwwGypn9eKX eICVhhqtUGyKo50CNWRcpEtFF08n5xoy3giSExmasoEQdiJFXsPiopTUTO7EE5nDM01G YdgFUPZWTpMFnIqBScKK8XjO+IrNwiBwFSgZC2XDVD60JC/DmOCXBFF17Zpz3NsHVZOn d/sM9xFJD10Ac2j5gXpBpNqkwGLRhSt6yDB8FTchgC9zRqjyHd//34ecAStub0NiCt8Z oPPw== X-Gm-Message-State: APjAAAWnppB8f7v7188upoCUyQbW0fQhAt9ToXd+oE7paGG8tUOqGjeJ tsDXMYBtKXSTXZWAYj3HavE= 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 Cc: Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Aaro Koskinen , Tony Lindgren , linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.19.2