/* Old devices have chip data hardcoded in the device ID table. nand_decode_id decodes a matching ID table entry and assigns the MTD size parameters for the chip.  */
static void nand_decode_id(struct mtd_info *mtd, struct nand_chip *chip, struct nand_flash_dev *type, u8 id_data[8], int *busw)
/* Old devices have chip data hardcoded in the device ID table. nand_decode_id decodes a matching ID table entry and assigns the MTD size parameters for the chip.  */
static void nand_decode_id(struct mtd_info *mtd, struct nand_chip *chip, struct nand_flash_dev *type, u8 id_data[8], int *busw)
{
	int maf_id = id_data[0];
	mtd->erasesize = type->erasesize;
	mtd->writesize = type->pagesize;
	mtd->oobsize = mtd->writesize / 32;
	*busw = type->options & NAND_BUSWIDTH_16;
	chip->bits_per_cell = 1;
	if (maf_id == NAND_MFR_AMD && id_data[4] != 0x00 && id_data[5] == 0x00
			&& id_data[6] == 0x00 && id_data[7] == 0x00
			&& mtd->writesize == 512) {
		mtd->erasesize = 128 * 1024;
		mtd->erasesize <<= ((id_data[3] & 0x03) << 1);
	}
}