dm: blk: fix spi flash uclass different error when use mtd block

Add more condition to decide which dev is "mtd 2".
More info seen in 82ee425415.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Iea84b5a7307969dad785f3136b0af8b9f45e94f6
This commit is contained in:
Jason Zhu 2021-01-11 11:12:58 +08:00
parent d84179b5cb
commit a2875f15a8
1 changed files with 3 additions and 2 deletions

View File

@ -135,8 +135,9 @@ struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum)
* the UCLASS_MTD when find the mtd block device.
* Fix it here when enable CONFIG_MTD_BLK.
*/
if ((if_type == IF_TYPE_MTD) &&
(devnum == BLK_MTD_SPI_NOR)) {
if (device_get_uclass_id(dev->parent) == UCLASS_SPI_FLASH &&
if_type == IF_TYPE_MTD &&
devnum == BLK_MTD_SPI_NOR) {
debug("Fix the spi flash uclass different\n");
} else {
debug("%s: parent uclass %d, this dev %d\n",