/* Get hold of the chip and call nand_do_read  */
static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf)
/* Get hold of the chip and call nand_do_read  */
static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf)
{
	struct nand_chip *chip = mtd->priv;
	int ret;
	if ((from + len) > mtd->size)
		return -EINVAL;
	if (!len)
		return 0;
	nand_get_device(chip, mtd, FL_READING);
	chip->ops.len = len;
	chip->ops.datbuf = buf;
	chip->ops.oobbuf = NULL;
	ret = nand_do_read_ops(mtd, from, &chip->ops);
	*retlen = chip->ops.retlen;
	nand_release_device(mtd);
	return ret;
}