rockchip: spl-boot-order: adjust nand flash dectecting strategy
Now the nand device is attached to mtd block, so change its dectecting strategy. Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com> Change-Id: I7b5063ad1d1ba2d8305c84e4d67e09932b30574b
This commit is contained in:
parent
f21c060e4b
commit
14be0258b5
|
|
@ -29,7 +29,6 @@
|
|||
* -1, for unspecified failures
|
||||
* a positive integer (from the BOOT_DEVICE_... family) on succes.
|
||||
*/
|
||||
|
||||
static int spl_node_to_boot_device(int node)
|
||||
{
|
||||
struct udevice *parent;
|
||||
|
|
@ -76,13 +75,32 @@ static int spl_node_to_boot_device(int node)
|
|||
return BOOT_DEVICE_SPI;
|
||||
#else
|
||||
return BOOT_DEVICE_MTD_BLK_SPI_NOR;
|
||||
if (!uclass_get_device_by_of_offset(UCLASS_MTD, node, &parent))
|
||||
return BOOT_DEVICE_MTD_BLK_SPI_NAND;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPL_NAND_SUPPORT
|
||||
if (!rk_nand_init())
|
||||
return BOOT_DEVICE_NAND;
|
||||
if (!uclass_get_device_by_of_offset(UCLASS_MTD, node, &parent)) {
|
||||
struct udevice *dev;
|
||||
struct blk_desc *desc = NULL;
|
||||
|
||||
for (device_find_first_child(parent, &dev);
|
||||
dev;
|
||||
device_find_next_child(&dev)) {
|
||||
if (device_get_uclass_id(dev) == UCLASS_BLK) {
|
||||
desc = dev_get_uclass_platdata(dev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!desc)
|
||||
return -ENOENT;
|
||||
|
||||
switch (desc->devnum) {
|
||||
case 0:
|
||||
return BOOT_DEVICE_MTD_BLK_NAND;
|
||||
case 1:
|
||||
return BOOT_DEVICE_MTD_BLK_SPI_NAND;
|
||||
default:
|
||||
return -ENOSYS;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue