Recently,I have done something with the NAND ,and I have a problem :
NAND: NAND device: Manufacturer ID: 0x2c, Chip ID: 0x68 ( NAND 4GiB 3,3V 8-bit)
pagemask : ffffffff ;i : -1 ;al : 1
pagemask : ffffffff ;i : 16777215 ;al : 2
pagemask : ffffffff ;i : 65535 ;al : 3
pagemask : ffffffff ;i : 255 ;al : 4
fcm_init: 6 address bytes is not supported
0 MiB
I find the code at /uboot-1.3.0/board/freescale/mpc8313erdb/nand.c
static int fcm_scan_bbt(struct mtd_info *mtd)
{
volatile immap_t *im = (immap_t *) CFG_IMMR;
volatile lbus83xx_t *lbc = &im->lbus;
register struct nand_chip *this = mtd->priv;
struct fcm_nand *fcm = this->priv;
unsigned int i;
unsigned int al;
if (!fcm) {
printk(KERN_ERR "fcm_scan_bbt():" \
" Failed to allocate chip specific data structure\n");
return -1;
}
/* calculate FMR Address Length field */
al = 0;
for (i = this->pagemask >> 16; i ; i >>= 8) {
al++;
printk ("pagemask : %x ;i : %d ;al : %d\n",this->pagemask,i,al); //add by asky
}
/* add to ECCM mode set in fcm_init */
fcm->fmr |= 12 << FMR_CWTO_SHIFT | /* Timeout > 12 mSecs */
al << FMR_AL_SHIFT;
if (mtd->oobblock == 512)
lbc->bank[fcm->bank].or &= ~(OR_FCM_PGS);
else if (mtd->oobblock == 2048) {
lbc->bank[fcm->bank].or |= OR_FCM_PGS;
/* adjust ecc setup if needed */
if ((lbc->bank[fcm->bank].br & BR_DECC) == BR_DECC_CHK_GEN) {
mtd->eccsize = 2048;
mtd->oobavail -= 9;
this->eccmode = NAND_ECC_HW12_2048;
this->eccsize = 2048;
this->eccbytes += 9;
this->eccsteps = 1;
this->autooob = (fcm->fmr & FMR_ECCM) ?
&fcm_oob_lp_eccm1 : &fcm_oob_lp_eccm0;
memcpy(&mtd->oobinfo, this->autooob,
sizeof(mtd->oobinfo));
}
}
else if(mtd->oobblock == 8192) { //add by asky
lbc->bank[fcm->bank].or |= OR_FCM_PGS;
/* adjust ecc setup if needed */
if ((lbc->bank[fcm->bank].br & BR_DECC) == BR_DECC_CHK_GEN) {
mtd->eccsize = 8192;
mtd->oobavail -= 9;
this->eccmode = NAND_ECC_HW12_2048;
this->eccsize = 8192;
this->eccbytes += 9;
this->eccsteps = 1;
this->autooob = (fcm->fmr & FMR_ECCM) ?
&fcm_oob_lp_eccm1 : &fcm_oob_lp_eccm0;
memcpy(&mtd->oobinfo, this->autooob,
sizeof(mtd->oobinfo));
}
}
else {
printf("fcm_init: page size %d is not supported\n",
mtd->oobblock);
return -1;
}
fcm->pgs = (lbc->bank[fcm->bank].or>>OR_FCM_PGS_SHIFT) & 1;
if (al > 2) {
printf("fcm_init: %d address bytes is not supported\n", al+2);
return -1;
}
/* restore default scan_bbt function and call it */
this->scan_bbt = nand_default_bbt;
return nand_default_bbt(mtd);
}
there must be something wrong with the this->pagemask ,because I print it out with 0xffffffff, but I don't know how to solve it .Can you help me ?