linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Gorski <jogo@openwrt.org>
To: linux-mtd@lists.infradead.org
Cc: linux-mips@linux-mips.org, Artem Bityutskiy <dedekind1@gmail.com>,
	Kevin Cernekee <cernekee@gmail.com>,
	Maxime Bizon <mbizon@freebox.fr>,
	David Woodhouse <dwmw2@infradead.org>,
	Florian Fainelli <florian@openwrt.org>
Subject: [PATCH 3/3] MTD: bcm63xxpart: use nvram for PSI size
Date: Sat, 23 Mar 2013 14:07:49 +0100	[thread overview]
Message-ID: <1364044070-10486-4-git-send-email-jogo@openwrt.org> (raw)
In-Reply-To: <1364044070-10486-1-git-send-email-jogo@openwrt.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 <jogo@openwrt.org>
---
 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 <florian@openwrt.org>
  *			  Mike Albon <malbon@openwrt.org>
  * Copyright © 2009-2010  Daniel Dickinson <openwrt@cshore.neomailbox.net>
- * Copyright © 2011-2012  Jonas Gorski <jonas.gorski@gmail.com>
+ * Copyright © 2011-2013  Jonas Gorski <jonas.gorski@gmail.com>
  *
  * 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 <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 
+#include <asm/mach-bcm63xx/bcm63xx_nvram.h>
 #include <asm/mach-bcm63xx/bcm963xx_tag.h>
 #include <asm/mach-bcm63xx/board_bcm963xx.h>
 
@@ -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));
-- 
1.7.10.4

  parent reply	other threads:[~2013-03-23 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 13:07 [PATCH 0/3] fix NVRAM partition size if larger than expected Jonas Gorski
2013-03-23 13:07 ` [PATCH 1/3] MTD: bcm63xxpart: use size macro for CFE block size Jonas Gorski
2013-03-23 13:07 ` [PATCH 2/3] MIPS: BCM63XX: export PSI size from nvram Jonas Gorski
2013-03-23 13:39   ` Florian Fainelli
2013-05-10 12:36   ` Artem Bityutskiy
2013-05-12 10:48     ` Jonas Gorski
2013-05-12 14:52       ` Florian Fainelli
2013-03-23 13:07 ` Jonas Gorski [this message]
2013-03-23 13:39 ` [PATCH 0/3] fix NVRAM partition size if larger than expected Florian Fainelli
2013-05-10 12:35 ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364044070-10486-4-git-send-email-jogo@openwrt.org \
    --to=jogo@openwrt.org \
    --cc=cernekee@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=florian@openwrt.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mbizon@freebox.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).