Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1629297yba; Thu, 25 Apr 2019 03:06:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDtw40c0w4r8w04SLwLQXJ6vob0XTAKXW756rYmgybUvZ/jfwVezNr0ZZANIF/TmdLVCXs X-Received: by 2002:a17:902:3064:: with SMTP id u91mr38558604plb.181.1556186798362; Thu, 25 Apr 2019 03:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556186798; cv=none; d=google.com; s=arc-20160816; b=sRmJuZdVljMduRtKXPxxO1eGaW5RqdJjBZxNPUAoWcYVNZ0dOntLchX/5RVRZXzLJx C9uGz/NhlGa1w1lRj6mgydSXhiy/iN4aMiGfb/bgEEE6R6Aoub+su9MA8eiu02IOrH8E 1jVfdynrTQq7kpvizCBAfedugSXVnHbpf8coWpwERsEZPBcVwy9PdkwzYX4M94HN2kAo Mt1ji00p+irNdoGx7qtY+9kl+acfIRsNNgB0MLSdnOIkG696qqJAjEhpU3KRyKz8Rmpy ahyumxAQx4TwALpdXRx2M4QmPewqRlkk/7gjxg6ZASMMb13dIV+fgJJ4sUGEiAldXstJ lS/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=VqWk260hN1j9pGbHJ0Dy8EMG7Jfzpa9REt5ioYNEdec=; b=zdvLCkWjnxWWD+RHIjFU7NdjbyiriCSjUnXNoXNx5WpQpreUzc8+wPreMI/vYUuCmE s/FbpMmJRCSIt2gxOZOMfcO4LTSPYVh5us+ev2SbjiPLwTaMs66gJbKGtMdG+j8VM/f7 Yx+JOVD407bwSXPxzM3zxoIpxuax13CBv5JkkvK1IcUYyCH58Yg3/5W63afME6aZ8fxd LoYbeJxdkrZ8mlkgbGWNRG/YtD6bS9CEiphciND0hQPlLvBEcQfQO4ZYZrpN7M2hp+LM AmGm8PCv8jLaxqzoyVpyt0P7/FUBv3Q6GxwOf5YC3UV7ILc1VyT1RTipD8vjR88VEtsG xbXg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si22152626pfd.55.2019.04.25.03.06.22; Thu, 25 Apr 2019 03:06:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732453AbfDXWOc (ORCPT + 99 others); Wed, 24 Apr 2019 18:14:32 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:37152 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731043AbfDXWOc (ORCPT ); Wed, 24 Apr 2019 18:14:32 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990768AbfDXWOaBmp1H (ORCPT + 1 other); Thu, 25 Apr 2019 00:14:30 +0200 Date: Thu, 25 Apr 2019 00:14:28 +0200 From: Ladislav Michl To: Janusz Krzysztofik Cc: Miquel Raynal , Boris Brezillon , Aaro Koskinen , Tony Lindgren , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] mtd: rawnand: ams-delta: Drop board specific partition info Message-ID: <20190424221428.GA4172@lenoch> References: <20190324223344.24590-1-jmkrzyszt@gmail.com> <20190424180212.10830-1-jmkrzyszt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190424180212.10830-1-jmkrzyszt@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Janusz, On Wed, Apr 24, 2019 at 08:02:12PM +0200, Janusz Krzysztofik wrote: > 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 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) now, when driver is no longer Amstrad Delta specific, why would you want to have ams-delta-nand hardcoded on kernel cmdline? I'm assuming at some point this driver will become gpio-nand [*] or something like that and asking users to change their kernel cmdline twice is just unwise :) [*] btw, it is really shame gpio-nand name is already taken by driver living in drivers/mtd/nand/raw/gpio.c which is more likely gpio-mem-nand used by at least CompuLab CM-X255 and Picochip picoXcell. Otherwise your work on this driver is so amazing that I just spent couple of hours finding that phone and compiling some decent userspace for it :) Thank you! > For their convenience, that information is added to the board Kconfig > entry help text, as well as CONFIG_MTD_CMDLINE_PARTS symbol is selected > automatically from the board Kconfig entry if the NAND driver is also > selected. > > Signed-off-by: Janusz Krzysztofik > Cc: Tony Lindgren > Cc: Aaro Koskinen > --- > Changelog: > v2->v3: > - add information on the requirement for passing partition info via > kernel command line to the board Kconfig entry help text > v1->v2: > - fix a typo poitned 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 | 7 ++++++- > drivers/mtd/nand/raw/ams-delta.c | 29 ++--------------------------- > 2 files changed, 8 insertions(+), 28 deletions(-) > > diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig > index c4694f26b5c4..41a47d251cac 100644 > --- a/arch/arm/mach-omap1/Kconfig > +++ b/arch/arm/mach-omap1/Kconfig > @@ -164,17 +164,22 @@ config MACH_NOKIA770 > have such a device. > > config MACH_AMS_DELTA > - bool "Amstrad E3 (Delta)" > + bool "Amstrad E3 (Delta) - see help for important information" > depends on ARCH_OMAP1 && ARCH_OMAP15XX > select FIQ > select GPIO_GENERIC_PLATFORM > 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. > > + If you are using built-in NAND, append the following partition > + info to kernel command line: > + mtdparts=ams-delta-nand:3584k(Kernel),256k(u-boot),256k(u-boot_params),256k(Amstrad_LDR),27m(File_system),768k(PBL_reserved) > + > config MACH_OMAP_GENERIC > bool "Generic OMAP board" > depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX) > 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.21.0