On Wed, Dec 08, 2010 at 12:20:46AM -0600, Xiangfu Liu wrote:
> +     do {
> +             status = readl(EMC_NFINTS);
> +     } while(!(status & EMC_NFINTS_ENCF));
> +
> +     /* disable ecc */
> +     writel(readl(EMC_NFECR) & ~EMC_NFECR_ECCE, EMC_NFECR);

readl() and other I/O accessors take pointers, not integer addresses.

> +
> +     for (i = 0; i < 9; i++)
> +             ecc_code[i] = *(paraddr + i);

Use I/O accesors.

> +     /* Check decoding */
> +     if (status & EMC_NFINTS_ERR) {
> +             if (status & EMC_NFINTS_UNCOR) {
> +                     printk("uncorrectable ecc\n");
> +                     return -1;
> +             }
> +
> +             uint32_t errcnt = (status & EMC_NFINTS_ERRCNT_MASK) >> 
> EMC_NFINTS_ERRCNT_BIT;

U-Boot coding style prohibits declarations mid-block.

> +             switch (errcnt) {
> +             case 4:
> +                     jz_rs_correct(dat, 
> +                                   (readl(EMC_NFERR3) & 
> EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT, 
> +                                   (readl(EMC_NFERR3) & EMC_NFERR_MASK_MASK) 
> >> EMC_NFERR_MASK_BIT);
> +             case 3:
> +                     jz_rs_correct(dat, 
> +                                   (readl(EMC_NFERR2) & 
> EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT, 
> +                                   (readl(EMC_NFERR2) & EMC_NFERR_MASK_MASK) 
> >> EMC_NFERR_MASK_BIT);
> +             case 2:
> +                     jz_rs_correct(dat, 
> +                                   (readl(EMC_NFERR1) & 
> EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT, 
> +                                   (readl(EMC_NFERR1) & EMC_NFERR_MASK_MASK) 
> >> EMC_NFERR_MASK_BIT);
> +             case 1:
> +                     jz_rs_correct(dat, 
> +                                   (readl(EMC_NFERR0) & 
> EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT, 
> +                                   (readl(EMC_NFERR0) & EMC_NFERR_MASK_MASK) 
> >> EMC_NFERR_MASK_BIT);
> +                     return errcnt;

Line length.

> +     writel(0x094c4400, EMC_SMCR1);

Please symbolically define what went into that magic number.

-Scott

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

Reply via email to