diff options
author | Rodolfo Giometti <giometti@linux.it> | 2014-01-13 09:35:38 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-01-20 14:20:47 -0500 |
commit | 3db227b64841383b0e3c00d02e7c84d363494281 (patch) | |
tree | b1f4cb327da0a1c109b545ce606958fa19f305e1 /drivers/mtd | |
parent | 7587f64d546d6a05dab0a7d1ac964e7ac12072f0 (diff) |
mtd: nand: pxa3xx: Add support for 2048 bytes page size devices
This commit adds support for devices with 2048B page sizes and
4-bit ECC strength requirements. This is achieved by enabling the BCH
ECC engine, which provides a higher strength: 16-bit over 2048 bytes.
Additionally, add a proper ECC layout to model the controller's view
of the device (where 'U' means unused and 'B' is the bad block marker):
----------------------------------------------------
| 2048B data | B | B | 30B spare | 30B ECC | U | U |
----------------------------------------------------
Signed-off-by: Rodolfo Giometti <giometti@linux.it>
[Brian: updated with Ezequiel's patch description]
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 31aae535a02a..2a7a0b27ac38 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -286,6 +286,16 @@ static struct nand_bbt_descr bbt_mirror_descr = { | |||
286 | .pattern = bbt_mirror_pattern | 286 | .pattern = bbt_mirror_pattern |
287 | }; | 287 | }; |
288 | 288 | ||
289 | static struct nand_ecclayout ecc_layout_2KB_bch4bit = { | ||
290 | .eccbytes = 32, | ||
291 | .eccpos = { | ||
292 | 32, 33, 34, 35, 36, 37, 38, 39, | ||
293 | 40, 41, 42, 43, 44, 45, 46, 47, | ||
294 | 48, 49, 50, 51, 52, 53, 54, 55, | ||
295 | 56, 57, 58, 59, 60, 61, 62, 63}, | ||
296 | .oobfree = { {2, 30} } | ||
297 | }; | ||
298 | |||
289 | static struct nand_ecclayout ecc_layout_4KB_bch4bit = { | 299 | static struct nand_ecclayout ecc_layout_4KB_bch4bit = { |
290 | .eccbytes = 64, | 300 | .eccbytes = 64, |
291 | .eccpos = { | 301 | .eccpos = { |
@@ -1360,6 +1370,17 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info, | |||
1360 | * Required ECC: 4-bit correction per 512 bytes | 1370 | * Required ECC: 4-bit correction per 512 bytes |
1361 | * Select: 16-bit correction per 2048 bytes | 1371 | * Select: 16-bit correction per 2048 bytes |
1362 | */ | 1372 | */ |
1373 | } else if (strength == 4 && ecc_stepsize == 512 && page_size == 2048) { | ||
1374 | info->ecc_bch = 1; | ||
1375 | info->chunk_size = 2048; | ||
1376 | info->spare_size = 32; | ||
1377 | info->ecc_size = 32; | ||
1378 | ecc->mode = NAND_ECC_HW; | ||
1379 | ecc->size = info->chunk_size; | ||
1380 | ecc->layout = &ecc_layout_2KB_bch4bit; | ||
1381 | ecc->strength = 16; | ||
1382 | return 1; | ||
1383 | |||
1363 | } else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) { | 1384 | } else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) { |
1364 | info->ecc_bch = 1; | 1385 | info->ecc_bch = 1; |
1365 | info->chunk_size = 2048; | 1386 | info->chunk_size = 2048; |