From patchwork Mon Jun 14 16:15:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 55562 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 83B69B7D85 for ; Tue, 15 Jun 2010 02:15:42 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1OOCJ1-0000GE-8A; Mon, 14 Jun 2010 16:14:35 +0000 Received: from fg-out-1718.google.com ([72.14.220.156]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1OOCIy-0000FI-MM; Mon, 14 Jun 2010 16:14:33 +0000 Received: by fg-out-1718.google.com with SMTP id l26so1013280fgb.0 for ; Mon, 14 Jun 2010 09:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=V+qjrZoka3wUGkpSG3aPqCFa3R9zpi2Uhnpo1vBFvvg=; b=fBtdc5o6fZHPQbMzYI3Q3HMqUksTWpDSiPI/hetAW9rjEZa8CWzcsp/7GvUYWC+uIg mdjFsG4874ZzGcP7adzUbRJ9HBiGbAUCWQ0rBS8rvVx3B+s5FU2tvgdWGHUWlCbajukk +WYSeoCOBrEGxAj2y815NrUX3k9C7w3bWGdFA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ge+43Xe7VK2ItszfL7uTbY6Z7gHl+51NtrwZhA+s0Xf2S0WYGzSDOk+luFzLzey57r 7g1SWRV8iQUkhsiATml/7CWneMHPFby4OhmEZyyc1FUXrkhPO6ZW4hDtFjWPepBmf4qc 0Kb3V2PaG/XmNuwtQCPlyP0F1ox0G4yc/IpU0= Received: by 10.87.48.18 with SMTP id a18mr748547fgk.53.1276532070612; Mon, 14 Jun 2010 09:14:30 -0700 (PDT) Received: from riccoc20.at.omicron.at (vs162244.vserver.de [62.75.162.244]) by mx.google.com with ESMTPS id f31sm8485050fkf.18.2010.06.14.09.14.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 14 Jun 2010 09:14:28 -0700 (PDT) Date: Mon, 14 Jun 2010 18:15:19 +0200 From: Richard Cochran To: Artem Bityutskiy Subject: Re: [PATCH] ixp4xx: add support for static flash partitions Message-ID: <20100614161519.GB24877@riccoc20.at.omicron.at> References: <20100531162434.GA4599@riccoc20.at.omicron.at> <1276420566.19028.184.camel@localhost> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1276420566.19028.184.camel@localhost> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100614_121432_956692_406CE4FA X-CRM114-Status: GOOD ( 23.64 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.3.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [72.14.220.156 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (richardcochran[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Krzysztof Halasa X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 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 On Sun, Jun 13, 2010 at 12:16:06PM +0300, Artem Bityutskiy wrote: > I could fix your patch up myself, but I do not know the code, so please, > re-send a patch against the latest mtd-2.6 tree. Okay, here it is again, this time against today's master branch of git://git.infradead.org/mtd-2.6.git Thanks, Richard This patch adds support for static flash partitioning from a platform device. Also, we clean up some weirdness where statements were separated by commas instead of semicolons. While we are at it, fix some minor bad white space, too. Signed-off-by: Richard Cochran --- drivers/mtd/maps/ixp4xx.c | 35 +++++++++++++++++++++++++++-------- 1 files changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index e0a5e04..1f9fde0 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c @@ -118,7 +118,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, *dest++ = BYTE1(data); src += 2; len -= 2; - } + } if (len > 0) *dest++ = BYTE0(flash_read16(src)); @@ -185,6 +185,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev) { struct flash_platform_data *plat = dev->dev.platform_data; struct ixp4xx_flash_info *info; + const char *part_type = NULL; + int nr_parts = 0; int err = -1; if (!plat) @@ -218,9 +220,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev) */ info->map.bankwidth = 2; info->map.name = dev_name(&dev->dev); - info->map.read = ixp4xx_read16, - info->map.write = ixp4xx_probe_write16, - info->map.copy_from = ixp4xx_copy_from, + info->map.read = ixp4xx_read16; + info->map.write = ixp4xx_probe_write16; + info->map.copy_from = ixp4xx_copy_from; info->res = request_mem_region(dev->resource->start, resource_size(dev->resource), @@ -248,11 +250,28 @@ static int ixp4xx_flash_probe(struct platform_device *dev) info->mtd->owner = THIS_MODULE; /* Use the fast version */ - info->map.write = ixp4xx_write16, + info->map.write = ixp4xx_write16; + +#ifdef CONFIG_MTD_PARTITIONS + nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions, + dev->resource->start); +#endif + if (nr_parts > 0) { + part_type = "dynamic"; + } else { + info->partitions = plat->parts; + nr_parts = plat->nr_parts; + part_type = "static"; + } + if (nr_parts == 0) { + printk(KERN_NOTICE "IXP4xx flash: no partition info " + "available, registering whole flash\n"); + err = add_mtd_device(info->mtd); + } else { + printk(KERN_NOTICE "IXP4xx flash: using %s partition " + "definition\n", part_type); + err = add_mtd_partitions(info->mtd, info->partitions, nr_parts); - err = parse_mtd_partitions(info->mtd, probes, &info->partitions, dev->resource->start); - if (err > 0) { - err = add_mtd_partitions(info->mtd, info->partitions, err); if(err) printk(KERN_ERR "Could not parse partitions\n"); }