xref: /OK3568_Linux_fs/u-boot/cmd/mtd_blk.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) (C) Copyright 2016-2019 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <command.h>
9 #include <dm.h>
10 
11 static int mtd_curr_dev = -1;
12 
do_mtd_blk(cmd_tbl_t * cmdtp,int flag,int argc,char * const argv[])13 static int do_mtd_blk(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
14 {
15 	if (argc == 2) {
16 		return CMD_RET_FAILURE;
17 	}
18 
19 	return blk_common_cmd(argc, argv, IF_TYPE_MTD, &mtd_curr_dev);
20 }
21 
22 U_BOOT_CMD(
23 	mtd_blk, 8, 1, do_mtd_blk,
24 	"MTD Block device sub-system",
25 	"mtd_blk dev [dev] - show or set current MTD device\n"
26 	"mtd_blk part [dev] - print partition table of one or all MTD devices\n"
27 	"mtd_blk read addr blk# cnt - read `cnt' blocks starting at block\n"
28 	"     `blk#' to memory address `addr'\n"
29 	"mtd_blk write addr blk# cnt - write `cnt' blocks starting at block\n"
30 	"     `blk#' from memory address `addr'"
31 );
32