Skip to content

Commit aa16b1f

Browse files
Dingqiang Linkeveryang
authored andcommitted
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 <[email protected]>
1 parent c8638ec commit aa16b1f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

cmd/rksfc.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ static int rksfc_curr_dev;
1313
static int do_rksfc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1414
{
1515
int ret;
16+
u32 dev_type = IF_TYPE_UNKNOWN;
17+
18+
if (rksfc_curr_dev == 0)
19+
dev_type = IF_TYPE_SPINAND;
20+
else if (rksfc_curr_dev == 1)
21+
dev_type = IF_TYPE_SPINOR;
1622

1723
if (argc == 2) {
1824
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[])
2430
}
2531
}
2632

27-
return blk_common_cmd(argc, argv, IF_TYPE_RKSFC, &rksfc_curr_dev);
33+
if (argc == 3) {
34+
if (strncmp(argv[1], "dev", 3) == 0) {
35+
if ((int)simple_strtoul(argv[2], NULL, 10) == 0)
36+
dev_type = IF_TYPE_SPINAND;
37+
else
38+
dev_type = IF_TYPE_SPINOR;
39+
}
40+
}
41+
42+
return blk_common_cmd(argc, argv, dev_type, &rksfc_curr_dev);
2843
}
2944

3045
U_BOOT_CMD(
@@ -33,6 +48,8 @@ U_BOOT_CMD(
3348
"scan - scan Sfc devices\n"
3449
"rksfc info - show all available Sfc devices\n"
3550
"rksfc device [dev] - show or set current Sfc device\n"
51+
" dev 0 - spinand\n"
52+
" dev 1 - spinor\n"
3653
"rksfc part [dev] - print partition table of one or all Sfc devices\n"
3754
"rksfc read addr blk# cnt - read `cnt' blocks starting at block\n"
3855
" `blk#' to memory address `addr'\n"

0 commit comments

Comments
 (0)