diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2014-05-14 13:58:07 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-05-21 15:55:08 -0400 |
commit | eee0166d8ead9d719d794df3e66acd8f83630e05 (patch) | |
tree | bae7bea4e395c86bf5389d731c8f409a4b861315 /drivers/mtd | |
parent | 67a9ad9b8a6f6ea76ef8fc484ae49970d72d5534 (diff) |
mtd: nand: pxa3xx: Clean pxa_ecc_init() error handling
Let's make pxa_ecc_init() return a negative errno on error or zero
if succesful, which is standard kernel practice. Also, report the
selected ECC strength and step size, which is important information.
Signed-off-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, 10 insertions, 11 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 940e6c7c6524..3b66a6460d67 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -1354,7 +1354,6 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info, | |||
1354 | ecc->mode = NAND_ECC_HW; | 1354 | ecc->mode = NAND_ECC_HW; |
1355 | ecc->size = 512; | 1355 | ecc->size = 512; |
1356 | ecc->strength = 1; | 1356 | ecc->strength = 1; |
1357 | return 1; | ||
1358 | 1357 | ||
1359 | } else if (strength == 1 && ecc_stepsize == 512 && page_size == 512) { | 1358 | } else if (strength == 1 && ecc_stepsize == 512 && page_size == 512) { |
1360 | info->chunk_size = 512; | 1359 | info->chunk_size = 512; |
@@ -1363,7 +1362,6 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info, | |||
1363 | ecc->mode = NAND_ECC_HW; | 1362 | ecc->mode = NAND_ECC_HW; |
1364 | ecc->size = 512; | 1363 | ecc->size = 512; |
1365 | ecc->strength = 1; | 1364 | ecc->strength = 1; |
1366 | return 1; | ||
1367 | 1365 | ||
1368 | /* | 1366 | /* |
1369 | * Required ECC: 4-bit correction per 512 bytes | 1367 | * Required ECC: 4-bit correction per 512 bytes |
@@ -1378,7 +1376,6 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info, | |||
1378 | ecc->size = info->chunk_size; | 1376 | ecc->size = info->chunk_size; |
1379 | ecc->layout = &ecc_layout_2KB_bch4bit; | 1377 | ecc->layout = &ecc_layout_2KB_bch4bit; |
1380 | ecc->strength = 16; | 1378 | ecc->strength = 16; |
1381 | return 1; | ||
1382 | 1379 | ||
1383 | } else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) { | 1380 | } else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) { |
1384 | info->ecc_bch = 1; | 1381 | info->ecc_bch = 1; |
@@ -1389,7 +1386,6 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info, | |||
1389 | ecc->size = info->chunk_size; | 1386 | ecc->size = info->chunk_size; |
1390 | ecc->layout = &ecc_layout_4KB_bch4bit; | 1387 | ecc->layout = &ecc_layout_4KB_bch4bit; |
1391 | ecc->strength = 16; | 1388 | ecc->strength = 16; |
1392 | return 1; | ||
1393 | 1389 | ||
1394 | /* | 1390 | /* |
1395 | * Required ECC: 8-bit correction per 512 bytes | 1391 | * Required ECC: 8-bit correction per 512 bytes |
@@ -1404,8 +1400,15 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info, | |||
1404 | ecc->size = info->chunk_size; | 1400 | ecc->size = info->chunk_size; |
1405 | ecc->layout = &ecc_layout_4KB_bch8bit; | 1401 | ecc->layout = &ecc_layout_4KB_bch8bit; |
1406 | ecc->strength = 16; | 1402 | ecc->strength = 16; |
1407 | return 1; | 1403 | } else { |
1404 | dev_err(&info->pdev->dev, | ||
1405 | "ECC strength %d at page size %d is not supported\n", | ||
1406 | strength, page_size); | ||
1407 | return -ENODEV; | ||
1408 | } | 1408 | } |
1409 | |||
1410 | dev_info(&info->pdev->dev, "ECC strength %d, ECC step size %d\n", | ||
1411 | ecc->strength, ecc->size); | ||
1409 | return 0; | 1412 | return 0; |
1410 | } | 1413 | } |
1411 | 1414 | ||
@@ -1527,12 +1530,8 @@ KEEP_CONFIG: | |||
1527 | 1530 | ||
1528 | ret = pxa_ecc_init(info, &chip->ecc, ecc_strength, | 1531 | ret = pxa_ecc_init(info, &chip->ecc, ecc_strength, |
1529 | ecc_step, mtd->writesize); | 1532 | ecc_step, mtd->writesize); |
1530 | if (!ret) { | 1533 | if (ret) |
1531 | dev_err(&info->pdev->dev, | 1534 | return ret; |
1532 | "ECC strength %d at page size %d is not supported\n", | ||
1533 | ecc_strength, mtd->writesize); | ||
1534 | return -ENODEV; | ||
1535 | } | ||
1536 | 1535 | ||
1537 | /* calculate addressing information */ | 1536 | /* calculate addressing information */ |
1538 | if (mtd->writesize >= 2048) | 1537 | if (mtd->writesize >= 2048) |