public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Richard Genoud <richard.genoud@gmail.com>
Cc: linux-mtd@lists.infradead.org,
	David Woodhouse <dwmw2@infradead.org>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: Re: [PATCH] NAND hardware ECC controller on at91sam9263 / at91sam9260
Date: Thu, 24 Apr 2008 12:02:04 -0700	[thread overview]
Message-ID: <200804241202.04290.david-b@pacbell.net> (raw)
In-Reply-To: <1208973075.7471.6.camel@ubuntu>

On Wednesday 23 April 2008, Richard Genoud wrote:
> +static int at91_nand_calculate(struct mtd_info *mtd,
> +               const u_char *dat, unsigned char *ecc_code)
> +{
> +       struct nand_chip *nand_chip = mtd->priv;
> +       struct at91_nand_host *host = nand_chip->priv;
> +       uint32_t *eccpos = nand_chip->ecc.layout->eccpos;
> +       unsigned int ecc_value;
> +
> +       /* get the first 2 ECC bytes */
> +       ecc_value = ecc_readl(host->ecc, PR) & AT91_ECC_PARITY;
> +
> +       ecc_code[eccpos[0]] = ecc_value & 0xFF;
> +       ecc_code[eccpos[1]] = (ecc_value >> 8) & 0xFF;

My copy of the sam9263 docs doesn't list an "ECC_PARITY" field
in the PR register ... just two masked fields, 0xfff0 and 0x000f
labeled WORDADDR and BITADDR respectively.  (Which evidently are
combined into a single opague 0xffff mask on block writes, and
are interpretable only on block reads.)

And the system header doesn't have an ECC_PARITY mask ... so I
get build errors with current GIT.


> +
> +       /* get the last 2 ECC bytes */
> +       ecc_value = ecc_readl(host->ecc, NPR) & AT91_ECC_NPARITY;
> +
> +       ecc_code[eccpos[2]] = ecc_value & 0xFF;
> +       ecc_code[eccpos[3]] = (ecc_value >> 8) & 0xFF;

That one builds OK.

I suggest you just remove the masks from the readl() lines.
They're not necessary.

- Dave


> +
> +       return 0;
> +}

  reply	other threads:[~2008-04-24 19:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 11:14 [PATCH] NAND hardware ECC controller on at91sam9263 / at91sam9260 Richard Genoud
2008-04-22 18:40 ` David Woodhouse
2008-04-23  9:37   ` Richard Genoud
2008-04-23 10:22     ` David Woodhouse
2008-04-23 11:31       ` Richard Genoud
2008-04-23 15:29         ` David Woodhouse
2008-04-23 17:51           ` Richard Genoud
2008-04-24 19:02             ` David Brownell [this message]
2008-04-25  7:32               ` Richard Genoud

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=200804241202.04290.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=dwmw2@infradead.org \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard.genoud@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox