cmd: rksfc: add sfc u-boot command

rksfc driver with block interface

Change-Id: I395cf78e939ce9ddbd07a9afad794474f0482542
Signed-off-by: Dingqiang Lin <jon.lin@rock-chips.com>
This commit is contained in:
Dingqiang Lin 2018-04-26 14:09:07 +08:00 committed by Kever Yang
parent ad309a883b
commit d5f538dc02
5 changed files with 98 additions and 0 deletions

View File

@ -898,6 +898,13 @@ config CMD_RKNAND
help help
Rockchip NAND FLASH device support Rockchip NAND FLASH device support
config CMD_RKSFC
bool "rksfc"
depends on (RKSFC_NOR || RKSFC_NAND)
default y if (RKSFC_NOR || RKSFC_NAND)
help
Rockchip SFC device support
config CMD_SATA config CMD_SATA
bool "sata - Access SATA subsystem" bool "sata - Access SATA subsystem"
select SATA select SATA

View File

@ -115,6 +115,7 @@ obj-$(CONFIG_CMD_SATA) += sata.o
obj-$(CONFIG_CMD_NVME) += nvme.o obj-$(CONFIG_CMD_NVME) += nvme.o
obj-$(CONFIG_CMD_ROCKUSB) += rockusb.o obj-$(CONFIG_CMD_ROCKUSB) += rockusb.o
obj-$(CONFIG_CMD_RKNAND) += rknand.o obj-$(CONFIG_CMD_RKNAND) += rknand.o
obj-$(CONFIG_CMD_RKSFC) += rksfc.o
obj-$(CONFIG_CMD_SF) += sf.o obj-$(CONFIG_CMD_SF) += sf.o
obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o
obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o

41
cmd/rksfc.c Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: (GPL-2.0+ OR MIT)
*/
#include <common.h>
#include <command.h>
#include <dm.h>
#include <rksfc.h>
static int rksfc_curr_dev;
static int do_rksfc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int ret;
if (argc == 2) {
if (strncmp(argv[1], "scan", 4) == 0) {
ret = rksfc_scan_namespace();
if (ret)
return CMD_RET_FAILURE;
return ret;
}
}
return blk_common_cmd(argc, argv, IF_TYPE_RKSFC, &rksfc_curr_dev);
}
U_BOOT_CMD(
rksfc, 8, 1, do_rksfc,
"rockchip sfc sub-system",
"scan - scan Sfc devices\n"
"rksfc info - show all available Sfc devices\n"
"rksfc device [dev] - show or set current Sfc device\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"
"rksfc write addr blk# cnt - write `cnt' blocks starting at block\n"
" `blk#' from memory address `addr'"
);

29
doc/README.rksfc Normal file
View File

@ -0,0 +1,29 @@
rksfc (Rockchip SPI FLASH SFC drivers)
=====================================================
Overview
--------
The rksfc is used for Rockchip Soc sfc devices with
block interface.
Status
------
It supprot SFC SPI NOR.
Usage in U-Boot
---------------
To list all of the rksfc hard disks, try:
=> rksfc info
Device 0: Vendor: 0x0308 Rev: V1.00 Prod: rksfc
Type: Hard Disk
Capacity: 32.0 MB = 0.0 GB (65600 x 512)
To find and initialize sfc devices, try:
=> rksfc dev 0
Device 0: Vendor: 0x0308 Rev: V1.00 Prod: rksfc
Type: Hard Disk
Capacity: 32.0 MB = 0.0 GB (65600 x 512)
... is now current device

20
include/rksfc.h Normal file
View File

@ -0,0 +1,20 @@
/*
* Copyright (C) 2018 Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __RKSFC_H__
#define __RKSFC_H__
/**
* rksfc_scan_namespace - scan all namespaces attached to RK SFC
* controllers
*
* This probes all registered RK SFC uclass device drivers in the
* system,and tries to find all namespaces attached to the RK SFC
* controllers.
*
* @return: 0 on success, -ve on error
*/
int rksfc_scan_namespace(void);
#endif