From: Jonas Gorski <jonas.gorski@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Maxime Bizon <mbizon@freebox.fr>,
Kevin Cernekee <cernekee@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Florian Fainelli <florian@openwrt.org>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 3/5] MTD: bcm63xxpart: make fixed part length calculation more generic
Date: Mon, 12 Nov 2012 10:52:49 +0100 [thread overview]
Message-ID: <1352713971-1685-4-git-send-email-jonas.gorski@gmail.com> (raw)
In-Reply-To: <1352713971-1685-1-git-send-email-jonas.gorski@gmail.com>
The CFE does not use 4K sectors even if the flash supports it, so
for the fixed partitions like CFE itself or NVRAM the erase block
size is always 64k or bigger.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
drivers/mtd/bcm63xxpart.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/bcm63xxpart.c b/drivers/mtd/bcm63xxpart.c
index ba7eeb8..b3db8e3 100644
--- a/drivers/mtd/bcm63xxpart.c
+++ b/drivers/mtd/bcm63xxpart.c
@@ -37,8 +37,7 @@
#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
-#define BCM63XX_MIN_CFE_SIZE 0x10000 /* always at least 64KiB */
-#define BCM63XX_MIN_NVRAM_SIZE 0x10000 /* always at least 64KiB */
+#define BCM63XX_CFE_BLOCK_SIZE 0x10000 /* always at least 64KiB */
#define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
@@ -79,6 +78,7 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
unsigned int rootfsaddr, kerneladdr, spareaddr;
unsigned int rootfslen, kernellen, sparelen, totallen;
unsigned int cfelen, nvramlen;
+ unsigned int cfe_erasesize;
int i;
u32 computed_crc;
bool rootfs_first = false;
@@ -86,8 +86,11 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
if (bcm63xx_detect_cfe(master))
return -EINVAL;
- cfelen = max_t(uint32_t, master->erasesize, BCM63XX_MIN_CFE_SIZE);
- nvramlen = max_t(uint32_t, master->erasesize, BCM63XX_MIN_NVRAM_SIZE);
+ cfe_erasesize = max_t(uint32_t, master->erasesize,
+ BCM63XX_CFE_BLOCK_SIZE);
+
+ cfelen = cfe_erasesize;
+ nvramlen = cfe_erasesize;
/* Allocate memory for buffer */
buf = vmalloc(sizeof(struct bcm_tag));
--
1.7.2.5
next prev parent reply other threads:[~2012-11-12 9:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 9:52 [PATCH 0/5] MTD: bcm63xxpart: small code cleanup Jonas Gorski
2012-11-12 9:52 ` [PATCH 1/5] MTD: bcm63xxpart: remove unused variable Jonas Gorski
2012-11-12 9:52 ` [PATCH 2/5] MTD: bcm63xxpart: merge sparelen calculation Jonas Gorski
2012-11-12 9:52 ` Jonas Gorski [this message]
2012-11-12 9:52 ` [PATCH 4/5] MTD: bcm63xxpart: move the last curpart++ to its correct place Jonas Gorski
2012-11-12 9:52 ` [PATCH 5/5] MTD: bcm63xxpart: use correct printk format for partitions Jonas Gorski
2012-11-12 9:59 ` [PATCH 0/5] MTD: bcm63xxpart: small code cleanup Florian Fainelli
2012-11-21 15:15 ` 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=1352713971-1685-4-git-send-email-jonas.gorski@gmail.com \
--to=jonas.gorski@gmail.com \
--cc=cernekee@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=florian@openwrt.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