On 08/16/2012 12:05 AM, Josh Wu wrote:
> The Programmable Multibit ECC (PMECC) controller is a programmable binary
> BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder. This controller
> can be used to support both SLC and MLC NAND Flash devices. It supports to
> generate ECC to correct 2, 4, 8, 12 or 24 bits of error per sector of data.
> 
> To use PMECC in this driver, the user needs to set the PMECC correction
> capability, the sector size and ROM lookup table offsets in board config file.
> 
> This driver is ported from Linux kernel atmel_nand PMECC patch. The main 
> difference
> is in this version it uses registers structure access hardware instead of 
> using macros.

Sigh, I wish U-Boot's code style policies weren't so rigid as to force
such a difference relative to the Linux driver.

> +     /* Computation 2t syndromes based on S(x) */
> +     /* Odd syndromes */
> +     for (i = 1; i < 2 * cap; i += 2) {
> +             for (j = 0; j < host->pmecc_degree; j++) {
> +                     if (partial_syn[i] & ((unsigned short)0x1 << j))
> +                             si[i] = readw(alpha_to + i * j) ^ si[i];
> +             }

Will that (unsigned short) make any difference?  Won't it just get
promoted back to int for the computation?

> +             i++;
> +             err_nbr--;
> +     }
> +
> +     return;
> +}

If it came over from Linux this way, I'm not asking you to change it
just here, but the return; at the end is superfluous.

> +     while ((pmecc_readl(host->pmecc, sr) & PMECC_SR_BUSY))
> +             udelay(1);

Timeout?

-Scott


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to