* [U-Boot] [PATCH v2 0/3] atmel_nand: misc update in atmel nandflash driver
@ 2016-01-25 6:06 Wenyou Yang
2016-01-25 6:06 ` [U-Boot] [PATCH v2 1/3] atmel_nand: use nand ecc_{strength, step}_ds instead of our own function Wenyou Yang
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Wenyou Yang @ 2016-01-25 6:06 UTC (permalink / raw)
To: u-boot
Since the nand driver is synced with v4.1 kernel, here is a update also
for atmel_nand driver. which includes:
1. fix format and using definition not magic number.
2. use ecc_{strength, step}_ds instead of our own function.
Changes in v2:
- following Andreas' advice, change the message for more concise.
- collect the Reviewed-by from Andreas.
- drop a patch:
[PATCH 3/4] atmel_nand: increase more delay to support MT29F32G08CBADA
Josh Wu (3):
atmel_nand: use nand ecc_{strength,step}_ds instead of our own
function
atmel_nand: add '\n' in the end of error message for better display
atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead
magic number
drivers/mtd/nand/atmel_nand.c | 50 +++++++++--------------------------------
1 file changed, 10 insertions(+), 40 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2 1/3] atmel_nand: use nand ecc_{strength, step}_ds instead of our own function
2016-01-25 6:06 [U-Boot] [PATCH v2 0/3] atmel_nand: misc update in atmel nandflash driver Wenyou Yang
@ 2016-01-25 6:06 ` Wenyou Yang
2016-01-27 13:00 ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2016-01-25 6:06 ` [U-Boot] [PATCH v2 2/3] atmel_nand: add '\n' in the end of error message for better display Wenyou Yang
2016-01-25 6:06 ` [U-Boot] [PATCH v2 3/3] atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead magic number Wenyou Yang
2 siblings, 1 reply; 8+ messages in thread
From: Wenyou Yang @ 2016-01-25 6:06 UTC (permalink / raw)
To: u-boot
From: Josh Wu <josh.wu@atmel.com>
Since ecc_{strength,step}_ds is introduced in nand_chip structure for
minimum ecc requirements. So we can use them directly and remove our
own get_onfi_ecc_param function.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c | 44 +++++++----------------------------------
1 file changed, 7 insertions(+), 37 deletions(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 0d4f327..e179f74 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -677,34 +677,6 @@ static void atmel_pmecc_core_init(struct mtd_info *mtd)
#ifdef CONFIG_SYS_NAND_ONFI_DETECTION
/*
- * get_onfi_ecc_param - Get ECC requirement from ONFI parameters
- * @ecc_bits: store the ONFI ECC correct bits capbility
- * @sector_size: in how many bytes that ONFI require to correct @ecc_bits
- *
- * Returns -1 if ONFI parameters is not supported. In this case @ecc_bits,
- * @sector_size are initialize to 0.
- * Return 0 if success to get the ECC requirement.
- */
-static int get_onfi_ecc_param(struct nand_chip *chip,
- int *ecc_bits, int *sector_size)
-{
- *ecc_bits = *sector_size = 0;
-
- if (chip->onfi_params.ecc_bits == 0xff)
- /* TODO: the sector_size and ecc_bits need to be find in
- * extended ecc parameter, currently we don't support it.
- */
- return -1;
-
- *ecc_bits = chip->onfi_params.ecc_bits;
-
- /* The default sector size (ecc codeword size) is 512 */
- *sector_size = 512;
-
- return 0;
-}
-
-/*
* pmecc_choose_ecc - Get ecc requirement from ONFI parameters. If
* pmecc_corr_cap or pmecc_sector_size is 0, then set it as
* ONFI ECC parameters.
@@ -724,17 +696,15 @@ static int pmecc_choose_ecc(struct atmel_nand_host *host,
/* Get ECC requirement from ONFI parameters */
*cap = *sector_size = 0;
if (chip->onfi_version) {
- if (!get_onfi_ecc_param(chip, cap, sector_size)) {
- MTDDEBUG(MTD_DEBUG_LEVEL1, "ONFI params, minimum required ECC: %d bits in %d bytes\n",
- *cap, *sector_size);
- } else {
- dev_info(host->dev, "NAND chip ECC reqirement is in Extended ONFI parameter, we don't support yet.\n");
- }
- } else {
- dev_info(host->dev, "NAND chip is not ONFI compliant, assume ecc_bits is 2 in 512 bytes");
+ *cap = chip->ecc_strength_ds;
+ *sector_size = chip->ecc_step_ds;
+ MTDDEBUG(MTD_DEBUG_LEVEL1, "ONFI params, minimum required ECC: %d bits in %d bytes\n",
+ *cap, *sector_size);
}
+
if (*cap == 0 && *sector_size == 0) {
- /* Non-ONFI compliant or use extended ONFI parameters */
+ /* Non-ONFI compliant */
+ dev_info(host->dev, "NAND chip is not ONFI compliant, assume ecc_bits is 2 in 512 bytes\n");
*cap = 2;
*sector_size = 512;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2 2/3] atmel_nand: add '\n' in the end of error message for better display
2016-01-25 6:06 [U-Boot] [PATCH v2 0/3] atmel_nand: misc update in atmel nandflash driver Wenyou Yang
2016-01-25 6:06 ` [U-Boot] [PATCH v2 1/3] atmel_nand: use nand ecc_{strength, step}_ds instead of our own function Wenyou Yang
@ 2016-01-25 6:06 ` Wenyou Yang
2016-01-27 12:10 ` Andreas Bießmann
2016-01-27 13:00 ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2016-01-25 6:06 ` [U-Boot] [PATCH v2 3/3] atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead magic number Wenyou Yang
2 siblings, 2 replies; 8+ messages in thread
From: Wenyou Yang @ 2016-01-25 6:06 UTC (permalink / raw)
To: u-boot
From: Josh Wu <josh.wu@atmel.com>
Also align the open parenthesis.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index e179f74..852883b 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -821,8 +821,8 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
* from ONFI.
*/
if (pmecc_choose_ecc(host, nand, &cap, §or_size)) {
- dev_err(host->dev, "The NAND flash's ECC requirement(ecc_bits: %d, sector_size: %d) are not support!",
- cap, sector_size);
+ dev_err(host->dev, "Required ECC %d bits in %d bytes not supported!\n",
+ cap, sector_size);
return -EINVAL;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2 3/3] atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead magic number
2016-01-25 6:06 [U-Boot] [PATCH v2 0/3] atmel_nand: misc update in atmel nandflash driver Wenyou Yang
2016-01-25 6:06 ` [U-Boot] [PATCH v2 1/3] atmel_nand: use nand ecc_{strength, step}_ds instead of our own function Wenyou Yang
2016-01-25 6:06 ` [U-Boot] [PATCH v2 2/3] atmel_nand: add '\n' in the end of error message for better display Wenyou Yang
@ 2016-01-25 6:06 ` Wenyou Yang
2016-01-27 13:00 ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2 siblings, 1 reply; 8+ messages in thread
From: Wenyou Yang @ 2016-01-25 6:06 UTC (permalink / raw)
To: u-boot
From: Josh Wu <josh.wu@atmel.com>
As atmel_nand_ecc.h is sync with v4.1 kernel, which adds the
PMECC_OOB_RESERVED_BYTES. So use it in the driver.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
Changes in v2:
- following Andreas' advice, change the message for more concise.
- collect the Reviewed-by from Andreas.
- drop a patch:
[PATCH 3/4] atmel_nand: increase more delay to support MT29F32G08CBADA
drivers/mtd/nand/atmel_nand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 852883b..73fd403 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -901,7 +901,7 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
return -EINVAL;
}
- if (nand->ecc.bytes > mtd->oobsize - 2) {
+ if (nand->ecc.bytes > mtd->oobsize - PMECC_OOB_RESERVED_BYTES) {
dev_err(host->dev, "No room for ECC bytes\n");
return -EINVAL;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2 2/3] atmel_nand: add '\n' in the end of error message for better display
2016-01-25 6:06 ` [U-Boot] [PATCH v2 2/3] atmel_nand: add '\n' in the end of error message for better display Wenyou Yang
@ 2016-01-27 12:10 ` Andreas Bießmann
2016-01-27 13:00 ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
1 sibling, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-01-27 12:10 UTC (permalink / raw)
To: u-boot
On 25.01.2016 07:06, Wenyou Yang wrote:
> From: Josh Wu <josh.wu@atmel.com>
>
> Also align the open parenthesis.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> ---
>
> Changes in v2: None
>
> drivers/mtd/nand/atmel_nand.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index e179f74..852883b 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -821,8 +821,8 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
> * from ONFI.
> */
> if (pmecc_choose_ecc(host, nand, &cap, §or_size)) {
> - dev_err(host->dev, "The NAND flash's ECC requirement(ecc_bits: %d, sector_size: %d) are not support!",
> - cap, sector_size);
> + dev_err(host->dev, "Required ECC %d bits in %d bytes not supported!\n",
> + cap, sector_size);
> return -EINVAL;
> }
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [U-Boot, v2, 1/3] atmel_nand: use nand ecc_{strength, step}_ds instead of our own function
2016-01-25 6:06 ` [U-Boot] [PATCH v2 1/3] atmel_nand: use nand ecc_{strength, step}_ds instead of our own function Wenyou Yang
@ 2016-01-27 13:00 ` Andreas Bießmann
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-01-27 13:00 UTC (permalink / raw)
To: u-boot
Dear Wenyou Yang,
Wenyou Yang <wenyou.yang@atmel.com> writes:
>From: Josh Wu <josh.wu@atmel.com>
>
>Since ecc_{strength,step}_ds is introduced in nand_chip structure for
>minimum ecc requirements. So we can use them directly and remove our
>own get_onfi_ecc_param function.
>
>Signed-off-by: Josh Wu <josh.wu@atmel.com>
>Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
>Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
>---
>
>Changes in v2: None
>
> drivers/mtd/nand/atmel_nand.c | 44 +++++++----------------------------------
> 1 file changed, 7 insertions(+), 37 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [U-Boot, v2, 2/3] atmel_nand: add '\n' in the end of error message for better display
2016-01-25 6:06 ` [U-Boot] [PATCH v2 2/3] atmel_nand: add '\n' in the end of error message for better display Wenyou Yang
2016-01-27 12:10 ` Andreas Bießmann
@ 2016-01-27 13:00 ` Andreas Bießmann
1 sibling, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-01-27 13:00 UTC (permalink / raw)
To: u-boot
Dear Wenyou Yang,
Wenyou Yang <wenyou.yang@atmel.com> writes:
>From: Josh Wu <josh.wu@atmel.com>
>
>Also align the open parenthesis.
>
>Signed-off-by: Josh Wu <josh.wu@atmel.com>
>Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
>Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
>---
>
>Changes in v2: None
>
> drivers/mtd/nand/atmel_nand.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [U-Boot, v2, 3/3] atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead magic number
2016-01-25 6:06 ` [U-Boot] [PATCH v2 3/3] atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead magic number Wenyou Yang
@ 2016-01-27 13:00 ` Andreas Bießmann
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-01-27 13:00 UTC (permalink / raw)
To: u-boot
Dear Wenyou Yang,
Wenyou Yang <wenyou.yang@atmel.com> writes:
>From: Josh Wu <josh.wu@atmel.com>
>
>As atmel_nand_ecc.h is sync with v4.1 kernel, which adds the
>PMECC_OOB_RESERVED_BYTES. So use it in the driver.
>
>Signed-off-by: Josh Wu <josh.wu@atmel.com>
>Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
>Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
>---
>
>Changes in v2:
> - following Andreas' advice, change the message for more concise.
> - collect the Reviewed-by from Andreas.
> - drop a patch:
> [PATCH 3/4] atmel_nand: increase more delay to support MT29F32G08CBADA
>
> drivers/mtd/nand/atmel_nand.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-01-27 13:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-25 6:06 [U-Boot] [PATCH v2 0/3] atmel_nand: misc update in atmel nandflash driver Wenyou Yang
2016-01-25 6:06 ` [U-Boot] [PATCH v2 1/3] atmel_nand: use nand ecc_{strength, step}_ds instead of our own function Wenyou Yang
2016-01-27 13:00 ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2016-01-25 6:06 ` [U-Boot] [PATCH v2 2/3] atmel_nand: add '\n' in the end of error message for better display Wenyou Yang
2016-01-27 12:10 ` Andreas Bießmann
2016-01-27 13:00 ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2016-01-25 6:06 ` [U-Boot] [PATCH v2 3/3] atmel_nand: use the definition: PMECC_OOB_RESERVED_BYTES instead magic number Wenyou Yang
2016-01-27 13:00 ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.