cmd: rksfc: change dev if_type

1.In rkflash driver, SPI Nand and SPI Nor are registered as two
different if_type
block dev. They are both the child_dev of sfc;
2.Here we send cmd to "rksfc" to operate it's child-dev spi flash device.

Change-Id: I9314ef9c556f8cfbe023021bd66bebec137a4e71
Signed-off-by: Dingqiang Lin <jon.lin@rock-chips.com>
This commit is contained in:
Dingqiang Lin 2018-07-26 21:44:39 +08:00 committed by Kever Yang
parent c8638ec3c0
commit aa16b1f803
1 changed files with 18 additions and 1 deletions

View File

@ -13,6 +13,12 @@ static int rksfc_curr_dev;
static int do_rksfc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int ret;
u32 dev_type = IF_TYPE_UNKNOWN;
if (rksfc_curr_dev == 0)
dev_type = IF_TYPE_SPINAND;
else if (rksfc_curr_dev == 1)
dev_type = IF_TYPE_SPINOR;
if (argc == 2) {
if (strncmp(argv[1], "scan", 4) == 0) {
@ -24,7 +30,16 @@ static int do_rksfc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
}
return blk_common_cmd(argc, argv, IF_TYPE_RKSFC, &rksfc_curr_dev);
if (argc == 3) {
if (strncmp(argv[1], "dev", 3) == 0) {
if ((int)simple_strtoul(argv[2], NULL, 10) == 0)
dev_type = IF_TYPE_SPINAND;
else
dev_type = IF_TYPE_SPINOR;
}
}
return blk_common_cmd(argc, argv, dev_type, &rksfc_curr_dev);
}
U_BOOT_CMD(
@ -33,6 +48,8 @@ U_BOOT_CMD(
"scan - scan Sfc devices\n"
"rksfc info - show all available Sfc devices\n"
"rksfc device [dev] - show or set current Sfc device\n"
" dev 0 - spinand\n"
" dev 1 - spinor\n"
"rksfc part [dev] - print partition table of one or all Sfc devices\n"
"rksfc read addr blk# cnt - read `cnt' blocks starting at block\n"
" `blk#' to memory address `addr'\n"