From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] ARM: at91: atmel_nand: add code to check the ONFI parameter ECC requirement
Date: Fri, 14 Jun 2013 15:38:18 -0500 [thread overview]
Message-ID: <1371242298.2996.9@snotra> (raw)
In-Reply-To: <1371208842-28909-5-git-send-email-josh.wu@atmel.com> (from josh.wu@atmel.com on Fri Jun 14 06:20:42 2013)
On 06/14/2013 06:20:42 AM, Josh Wu wrote:
> +static int pmecc_choose_ecc(struct atmel_nand_host *host,
> + struct nand_chip *chip,
> + int *cap, int *sector_size)
> +{
> + /* 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
> + printk(KERN_WARNING "NAND chip ECC reqirement
> is in Extended ONFI parameter, we don't support yet.\n");
Both of these prints are dev_info in Linux. While I tend to agree that
the first print should be debug and the second an error (or at least a
warning), it doesn't make much sense to use KERN_WARNING in U-Boot-only
code (and even in Linux, explicit use of KERN_WARNING is deprecated in
favor of pr_warn or dev_warn).
> + } else {
> + printk(KERN_WARNING "NAND chip is not ONFI compliant,
> assume ecc_bits is 2 in 512 bytes");
> + }
> + if (*cap == 0 && *sector_size == 0) {
> + /* Non-ONFI compliant or use extended ONFI parameters */
> + *cap = 2;
> + *sector_size = 512;
> + }
> +
> + /* If head file doesn't specify then use the one in ONFI
> parameters */
> + if (host->pmecc_corr_cap == 0) {
> + /* use the most fitable ecc bits (the near bigger one )
> */
> + if (*cap <= 2)
> + host->pmecc_corr_cap = 2;
> + else if (*cap <= 4)
> + host->pmecc_corr_cap = 4;
> + else if (*cap < 8)
> + host->pmecc_corr_cap = 8;
> + else if (*cap < 12)
> + host->pmecc_corr_cap = 12;
> + else if (*cap < 24)
> + host->pmecc_corr_cap = 24;
> + else
> + return -EINVAL;
Why are some of these "<=" and others "<"?
-Scott
prev parent reply other threads:[~2013-06-14 20:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 11:20 [U-Boot] [PATCH 0/4] ARM: at91: atmel_nand: check ONFI ecc minimum requirement Josh Wu
2013-06-14 11:20 ` [U-Boot] [PATCH 1/4] ARM: at91: atmel_nand: pmecc driver will select the galois table by sector size Josh Wu
2013-06-14 11:20 ` [U-Boot] [PATCH 2/4] ARM: at91: sama5d3: remove unused definition about PMECC alpha table offset Josh Wu
2013-06-14 11:20 ` [U-Boot] [PATCH 3/4] mtd: atmel_nand: alloc memory instead of use static array for pmecc data Josh Wu
2013-06-14 20:29 ` Scott Wood
2013-06-14 11:20 ` [U-Boot] [PATCH 4/4] ARM: at91: atmel_nand: add code to check the ONFI parameter ECC requirement Josh Wu
2013-06-14 20:38 ` Scott Wood [this message]
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=1371242298.2996.9@snotra \
--to=scottwood@freescale.com \
--cc=u-boot@lists.denx.de \
/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 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.