[U-Boot] NAND onfi detection

Vipin Kumar vipin.kumar at st.com
Tue Jul 19 08:31:58 CEST 2011


Hello Scott,

The present handling of ONFI devices requires that the device id to be put in
"nand_flash_ids" table. I am pasting the code below to ease the discussion

In case the dev_id doesn't match with the one's present in the table type->name 
points to null and an error -ENODEV is returned. detect onfi is never called

	if (!type)
		type = nand_flash_ids;

	for (; type->name != NULL; type++)
		if (*dev_id == type->id)
			break;

	if (!type->name) {
		/* supress warning if there is no nand */
		if (*maf_id != 0x00 && *maf_id != 0xff &&
		    *dev_id  != 0x00 && *dev_id  != 0xff)
			printk(KERN_INFO "%s: unknown NAND device: "
				"Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n",
				__func__, *maf_id, *dev_id);
		return ERR_PTR(-ENODEV);
	}

	if (!mtd->name)
		mtd->name = type->name;

	chip->chipsize = (uint64_t)type->chipsize << 20;
	chip->onfi_version = 0;

	ret = nand_flash_detect_onfi(mtd, chip, &busw);
	if (!ret)
		nand_flash_detect_non_onfi(mtd, chip, type, &busw);

Is the behavior expected ?
Am I missing something

Regards
Vipin


More information about the U-Boot mailing list