From patchwork Sat Mar 23 13:07:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 230334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3AF242C0087 for ; Sun, 24 Mar 2013 00:09:22 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UJOBC-0001xP-LK; Sat, 23 Mar 2013 13:08:14 +0000 Received: from arrakis.dune.hu ([78.24.191.176]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UJOAv-0001s8-Kx for linux-mtd@lists.infradead.org; Sat, 23 Mar 2013 13:08:01 +0000 Received: from arrakis.dune.hu ([127.0.0.1]) by localhost (arrakis.dune.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U2sEngkzpjpS; Sat, 23 Mar 2013 14:07:22 +0100 (CET) Received: from shaker64.lan (dslb-088-073-029-203.pools.arcor-ip.net [88.73.29.203]) by arrakis.dune.hu (Postfix) with ESMTPSA id AD009280129; Sat, 23 Mar 2013 14:07:21 +0100 (CET) From: Jonas Gorski To: linux-mtd@lists.infradead.org Subject: =?UTF-8?q?=5BPATCH=203/3=5D=20MTD=3A=20bcm63xxpart=3A=20use=20nvram=20for=20PSI=20size?= Date: Sat, 23 Mar 2013 14:07:49 +0100 Message-Id: <1364044070-10486-4-git-send-email-jogo@openwrt.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364044070-10486-1-git-send-email-jogo@openwrt.org> References: <1364044070-10486-1-git-send-email-jogo@openwrt.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130323_090758_413946_E74BE418 X-CRM114-Status: GOOD ( 13.60 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-mips@linux-mips.org, Artem Bityutskiy , Kevin Cernekee , Maxime Bizon , David Woodhouse , Florian Fainelli X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Read out the SPI size from nvram instead of defaulting to 64K - some vendors actually use values larger than the "max" value of 64. Signed-off-by: Jonas Gorski --- drivers/mtd/bcm63xxpart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/bcm63xxpart.c b/drivers/mtd/bcm63xxpart.c index fc3d7d0..5c81390 100644 --- a/drivers/mtd/bcm63xxpart.c +++ b/drivers/mtd/bcm63xxpart.c @@ -4,7 +4,7 @@ * Copyright © 2006-2008 Florian Fainelli * Mike Albon * Copyright © 2009-2010 Daniel Dickinson - * Copyright © 2011-2012 Jonas Gorski + * Copyright © 2011-2013 Jonas Gorski * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -91,7 +92,8 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, BCM63XX_CFE_BLOCK_SIZE); cfelen = cfe_erasesize; - nvramlen = cfe_erasesize; + nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K; + nvramlen = roundup(nvramlen, cfe_erasesize); /* Allocate memory for buffer */ buf = vmalloc(sizeof(struct bcm_tag));