[PATCH] brcm47xx: mtd: bcm47xxpart: lower minimal blocksize to 4Ki (from 64Ki)
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.14 / 400-mtd-bcm47xxpart-lower-minimal-blocksize-to-4Ki-from-.patch
1 From 4586bc54a322568d5258d6a1b04e361d4a95597b Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Wed, 12 Nov 2014 09:06:22 +0100
4 Subject: [PATCH][RFC] mtd: bcm47xxpart: lower minimal blocksize to 4Ki (from
5 64Ki)
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Some devices like Netgear WNR1000v3 or WGR614v10 have partitions aligned
11 to 0x1000. Using bigger blocksize stopped us from detecting some parts.
12
13 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
14 ---
15 Most of supported devices use flashes with erasesize 0x10000 (64Ki), so
16 this change shouldn't affect them (no regressions expected).
17 Any objections?
18 ---
19 drivers/mtd/bcm47xxpart.c | 8 ++++++--
20 1 file changed, 6 insertions(+), 2 deletions(-)
21
22 diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
23 index dfd57a0..948f535 100644
24 --- a/drivers/mtd/bcm47xxpart.c
25 +++ b/drivers/mtd/bcm47xxpart.c
26 @@ -95,8 +95,12 @@ static int bcm47xxpart_parse(struct mtd_info *master,
27 int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, };
28 bool found_nvram = false;
29
30 - if (blocksize <= 0x10000)
31 - blocksize = 0x10000;
32 + /*
33 + * Some really old flashes (like AT45DB*) had smaller erasesize-s, but
34 + * partitions were aligned to at least 0x1000 anyway.
35 + */
36 + if (blocksize < 0x1000)
37 + blocksize = 0x1000;
38
39 /* Alloc */
40 parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
41 --
42 1.8.4.5
43