mtd: mtd_blk: get mtd through dev_get_priv() when the storage is nand

In the nand mtd, we will use chip info to operate nand, and get the chip
through mtd_to_nand(). So we should get mtd through dev_get_priv() but not
dev_get_uclass_platdata.

Change-Id: I1bacbec49158d04dc947a880dbe3a8043fe3123d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2019-08-15 09:13:29 +08:00
parent 1d2de2a99a
commit 8cf6fca4b8
1 changed files with 4 additions and 0 deletions

View File

@ -114,6 +114,10 @@ ulong mtd_dread(struct udevice *udev, lbaint_t start,
#ifdef CONFIG_NAND
int ret = 0;
mtd = dev_get_priv(udev->parent);
if (!mtd)
return 0;
ret = nand_read_skip_bad(mtd, off, &rwsize,
NULL, mtd->size,
(u_char *)(dst));