From patchwork Wed Oct 1 21:00:51 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Rakity X-Patchwork-Id: 2304 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 4A504DDE21 for ; Thu, 2 Oct 2008 07:12:22 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1Kl8v1-0002Ww-Dh; Wed, 01 Oct 2008 21:07:35 +0000 Received: from web58908.mail.re1.yahoo.com ([66.196.100.237]) by bombadil.infradead.org with smtp (Exim 4.68 #1 (Red Hat Linux)) id 1Kl8uy-0002Vx-SQ for linux-mtd@lists.infradead.org; Wed, 01 Oct 2008 21:07:33 +0000 Received: (qmail 46120 invoked by uid 60001); 1 Oct 2008 21:00:51 -0000 X-YMail-OSG: 2QHTZwkVM1n0eaTzW4du_VnTjA.4A.UqXX0xSZy1xobG_A8SX6UiyvbGGpepDpn2FA-- Received: from [65.219.4.5] by web58908.mail.re1.yahoo.com via HTTP; Wed, 01 Oct 2008 14:00:51 PDT X-Mailer: YahooMailRC/1096.40 YahooMailWebService/0.7.218.2 Date: Wed, 1 Oct 2008 14:00:51 -0700 (PDT) From: Philip Rakity Subject: PATCH - add cmdline partition support to cafe (eg mtdparts= boot command) To: linux-mtd@lists.infradead.org MIME-Version: 1.0 Message-ID: <148191.46055.qm@web58908.mail.re1.yahoo.com> X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.4 SUBJECT_FUZZY_TION Attempt to obfuscate words in Subject: 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 Folks, Could we please incorporate this info the main line linux code. Adds command line mtdparts= support for cafe_nand flash. NOTE: I changed where add_mtd_device was done so that there is NOT a complete flash mount point following by the partitions that were added. Before this n+1 partitions were added. 1 partition for the complete flash and then n partitions. Philip --- cafe_nand.c.ORIGINAL 2008-10-01 13:53:11.000000000 -0700 +++ cafe_nand.c 2008-10-01 13:55:01.000000000 -0700 @@ -87,8 +87,12 @@ module_param_array(timing, int, &numtimings, 0644); #ifdef CONFIG_MTD_PARTITIONS +#ifdef CONFIG_MTD_CMDLINE_PARTS +static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; +#else static const char *part_probes[] = { "RedBoot", NULL }; #endif +#endif /* Hrm. Why isn't this already conditional on something in the struct device? */ #define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0) @@ -628,7 +632,7 @@ struct cafe_priv *cafe; struct mtd_partition *parts; uint32_t ctrl; - int nr_parts; + int nr_parts = 0; int err = 0; /* Very old versions shared the same PCI ident for all three @@ -796,17 +800,21 @@ pci_set_drvdata(pdev, mtd); - /* We register the whole device first, separate from the partitions */ - add_mtd_device(mtd); - #ifdef CONFIG_MTD_PARTITIONS +#ifdef CONFIG_MTD_CMDLINE_PARTS + mtd->name = "cafe_nand"; +#endif nr_parts = parse_mtd_partitions(mtd, part_probes, &parts, 0); if (nr_parts > 0) { cafe->parts = parts; - dev_info(&cafe->pdev->dev, "%d RedBoot partitions found\n", nr_parts); + dev_info(&cafe->pdev->dev, "%d partitions found\n", nr_parts); add_mtd_partitions(mtd, parts, nr_parts); } #endif + + /* We register the whole device first, separate from the partitions */ + if (nr_parts <= 0) + add_mtd_device(mtd); goto out; Signed off by Philip Rakity -- October 1, 2008