From patchwork Thu Mar 5 00:29:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hartley Sweeten X-Patchwork-Id: 24076 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 406C4DDDB2 for ; Thu, 5 Mar 2009 11:31:22 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Lf1Sh-0005BS-1T; Thu, 05 Mar 2009 00:29:19 +0000 Received: from exprod6ob113.obsmtp.com ([64.18.1.30] helo=psmtp.com) by bombadil.infradead.org with smtp (Exim 4.69 #1 (Red Hat Linux)) id 1Lf1Sc-0005B9-Vn for linux-mtd@lists.infradead.org; Thu, 05 Mar 2009 00:29:17 +0000 Received: from source ([63.240.6.3]) (using TLSv1) by exprod6ob113.postini.com ([64.18.5.12]) with SMTP ID DSNKSa8c2sQhRrfJItkxB/7/lxWhB3fdIm10@postini.com; Wed, 04 Mar 2009 16:29:14 PST Received: from d01smtp07.Mi8.com ([172.16.1.114]) by Outbound02.Mi8.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Mar 2009 19:29:12 -0500 Received: from mi8nycmail19.Mi8.com ([172.16.7.219]) by d01smtp07.Mi8.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Mar 2009 19:29:13 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: RE: [PATCH] mtd: Allow platform to set partitions at runtime Date: Wed, 4 Mar 2009 19:29:00 -0500 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] mtd: Allow platform to set partitions at runtime Thread-Index: AcmLDoIyBNV/YqbvTwCXVKrBH+XHrwSGsH2w References: From: "hartleys" To: X-OriginalArrivalTime: 05 Mar 2009 00:29:13.0135 (UTC) FILETIME=[68A0ABF0:01C99D29] X-Spam-Score: -3.6 (---) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (-3.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.4 SUBJECT_FUZZY_TION Attempt to obfuscate words in Subject: -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [64.18.1.30 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Any comments on this patch? If it looks ok how do I get it applied? Regards, Hartley -----Original Message----- From: linux-mtd-bounces@lists.infradead.org [mailto:linux-mtd-bounces@lists.infradead.org] On Behalf Of hartleys Sent: Monday, February 09, 2009 4:31 PM To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: Allow platform to set partitions at runtime Add a callback to allow platform to initialize the static partitions. Static partitions on a nand device could vary depending on the size of the device. This patch allows an optional platform callback to be used to setup this partition information at runtime. Scan order is: 1) chip.part_probe_types 2) chip.set_parts 3) chip.partitions 4) full mtd device (fallback for no partitions) Some of the existing nand drivers could possibly be replaced by the plat_nand driver by using this patch. These include autcpu12.c and ts7250.c drivers. Signed-off-by: H Hartley Sweeten --- struct platform_nand_chip { @@ -574,6 +575,8 @@ struct platform_nand_chip { int chip_delay; unsigned int options; const char **part_probe_types; + void (*set_parts)(uint64_t size, + struct platform_nand_chip *chip); void *priv; }; diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c index 75f9f48..f10b5a6 100644 --- a/drivers/mtd/nand/plat_nand.c +++ b/drivers/mtd/nand/plat_nand.c @@ -86,6 +86,8 @@ static int __init plat_nand_probe(struct platform_device *pdev) return 0; } } + if (pdata->chip.set_parts) + pdata->chip.set_parts(data->mtd.size, &pdata->chip); if (pdata->chip.partitions) { data->parts = pdata->chip.partitions; res = add_mtd_partitions(&data->mtd, data->parts, diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index db5b63d..4eaf328 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -563,6 +563,7 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, * @options: Option flags, e.g. 16bit buswidth * @ecclayout: ecc layout info structure * @part_probe_types: NULL-terminated array of probe types + * @set_parts: platform specific function to set partitions * @priv: hardware controller specific settings */