nand_scan identification problem

Moises Beck - EDS Digicon mbeck at perto.com.br
Thu Jan 27 07:18:09 EST 2005


Hello,
     I am using a smartmedia card on linux MTD. Everything runs very
well. But just after power on, the first attempt to load the driver
spia.o fails. The driver calls nand_scan(), that cannot identify the
present card. On the second attempt to load the driver, the flash is
correctly identified. I saw that in nand_scan(), the command
NAND_CMD_READID return nand_maf_id=0 and nand_dev_id=0 on the first call
to it. On the second call the IDs are returned correctly. I tried to
solve this by putting the following code just before the command
NAND_CMD_READID, on nand_base.c:

        /* Select the device */
        this->select_chip(mtd, 0);
                                                                       
        
        /* by momo - reset smartmedia e put it on mode READ */
        this->cmdfunc (mtd, NAND_CMD_RESET, -1, -1);
        this->cmdfunc (mtd, NAND_CMD_READ0, -1, -1);
                                                                       
        
        /* Send the command for reading device ID */
        this->cmdfunc (mtd, NAND_CMD_READID, 0x00, -1);
                                                                       
        
        /* Read manufacturer and device IDs */
        nand_maf_id = this->read_byte(mtd);
        nand_dev_id = this->read_byte(mtd);

     But this does not run, and to problem persists. If the funtion to
NAND_CMD_READID is called twice, as in

        /* Select the device */
        this->select_chip(mtd, 0);
 
        /* Send the command for reading device ID */
        /* by momo - send the command twice !!! */
        this->cmdfunc (mtd, NAND_CMD_READID, 0x00, -1);
        this->cmdfunc (mtd, NAND_CMD_READID, 0x00, -1);
                                                                       
        
        /* Read manufacturer and device IDs */
        nand_maf_id = this->read_byte(mtd);
        nand_dev_id = this->read_byte(mtd);

    then it runs well, always identifying the flash on the first call to
the funtion nand_scan !!!
    I am using mtd-snapshot-20050111.

Anyone has some clue ?

Thanks,
Moises







More information about the linux-mtd mailing list