Skip to contentSkip to conversation

Add rkmtd command

PATCH Superseded Johan Jonker 2 participants 13 messages Oct 15, 2023 – Oct 18, 2023

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add rkmtd command

The command rkmtd creates a virtual block device to transfer Rockchip boot block data to and from NAND with block orientated tools like "ums" and "rockusb".

It uses the Rockchip MTD driver to scan for boot blocks and copies data from the first block in a GPT formatted virtual disk. Data must be written in U-boot "idbloader.img" format and start at partition "loader1" offset 64. The data header is parsed for length and offset. When the last sector is received it erases up to 5 erase blocks on NAND and writes boot blocks in a pattern depending on the NAND ID. Data is then verified. When a block turns out bad the block header is discarded.

Changed V4:
Sort includes
Replace constant by define
Enable rkmtd command in sandbox defconfig
Fix minor things in test

Changed V3:
Add documetation
Add test
Split driver from command
Split header
Use devm_kzalloc
Remove out of memory debug
Restyle

Changed V2:
Rename to rkmtd

Johan Jonker (8):
mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN option
rockchip: dm: prepare rkmtd UCLASS
rockchip: block: add rkmtd class and drivers
rockchip: block: blk-uclass: disable bounce buffer support for rkmtd
rockchip: cmd: add rkmtd command
rockchip: test: dm: add rkmtd test
rockchip: doc: add rkmtd.rst
rockchip: configs: sandbox: enable rkmtd command

 cmd/Kconfig                         |    8 +
 cmd/Makefile                        |    1 +
 cmd/rkmtd.c                         |  204 +++++
 configs/sandbox64_defconfig         |    1 +
 configs/sandbox_defconfig           |    1 +
 disk/part.c                         |    4 +
 doc/board/rockchip/index.rst        |    1 +
 doc/board/rockchip/rkmtd.rst        |  105 +++
 drivers/block/Kconfig               |    7 +
 drivers/block/Makefile              |    2 +
 drivers/block/blk-uclass.c          |    7 +-
 drivers/block/rkmtd.c               | 1135 +++++++++++++++++++++++++++
 drivers/mtd/nand/raw/Kconfig        |    9 +
 drivers/mtd/nand/raw/rockchip_nfc.c |    3 +
 include/dm/uclass-id.h              |    1 +
 include/rkmtd.h                     |  191 +++++
 test/dm/Makefile                    |    1 +
 test/dm/rkmtd.c                     |  200 +++++
 18 files changed, 1878 insertions(+), 3 deletions(-)
 create mode 100644 cmd/rkmtd.c
 create mode 100644 doc/board/rockchip/rkmtd.rst
 create mode 100644 drivers/block/rkmtd.c
 create mode 100644 include/rkmtd.h
 create mode 100644 test/dm/rkmtd.c

--
2.39.2

#1 lore raw

PATCH v4 1/8 mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN option

On Rockchip SoCs the first boot stages are written on NAND with help of manufacturer software that uses a different format then the MTD framework. Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN option to be able to pass the driver probe function and to let the original data unchanged.

---
 drivers/mtd/nand/raw/Kconfig        | 9 +++++++++
 drivers/mtd/nand/raw/rockchip_nfc.c | 3 +++
 2 files changed, 12 insertions(+)
drivers/mtd/nand/raw/Kconfig +9 -0
index d624589a892b..72547f00fbec 100644
@@ -611,6 +611,15 @@ config ROCKCHIP_NAND
 	    NFC v800: RK3308, RV1108
 	    NFC v900: PX30, RK3326
 
+config ROCKCHIP_NAND_SKIP_BBTSCAN
+	bool "Skip the automatic BBT scan with Rockchip NAND controllers"
+	depends on ROCKCHIP_NAND
+	default n
+	help
+	  Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN
+	  option when data content is not in MTD format or
+	  must remain unchanged.
+
 config TEGRA_NAND
 	bool "Support for NAND controller on Tegra SoCs"
 	depends on ARCH_TEGRA
drivers/mtd/nand/raw/rockchip_nfc.c +3 -0
index 6ad51df4acff..df6742c2f9bb 100644
@@ -981,6 +981,9 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum)
 	chip->bbt_options = NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
 	chip->options |= NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER;
 
+	if (IS_ENABLED(CONFIG_ROCKCHIP_NAND_SKIP_BBTSCAN))
+		chip->options |= NAND_SKIP_BBTSCAN;
+
 	rk_nfc_hw_init(nfc);
 	ret = nand_scan_ident(mtd, nsels, NULL);
 	if (ret)

--
2.39.2

#2 lore raw

PATCH v4 2/8 rockchip: dm: prepare rkmtd UCLASS

In reply to Johan Jonker

Prepare a rkmtd UCLASS in use for writing Rockchip boot blocks in combination with existing userspace tools and rockusb command.

---
 disk/part.c                | 4 ++++
 drivers/block/blk-uclass.c | 1 +
 include/dm/uclass-id.h     | 1 +
 3 files changed, 6 insertions(+)
disk/part.c +4 -0
index 85244b09f359..36b88205eca7 100644
@@ -197,6 +197,7 @@ void dev_print(struct blk_desc *desc)
 	case UCLASS_PVBLOCK:
 	case UCLASS_HOST:
 	case UCLASS_BLKMAP:
+	case UCLASS_RKMTD:
 		printf ("Vendor: %s Rev: %s Prod: %s\n",
 			desc->vendor,
 			desc->revision,
@@ -330,6 +331,9 @@ static void print_part_header(const char *type, struct blk_desc *desc)
 	case UCLASS_PVBLOCK:
 		puts("PV BLOCK");
 		break;
+	case UCLASS_RKMTD:
+		puts("RKMTD");
+		break;
 	case UCLASS_VIRTIO:
 		puts("VirtIO");
 		break;
drivers/block/blk-uclass.c +1 -0
index f126547cc7e6..30ad5bbb0024 100644
@@ -36,6 +36,7 @@ static struct {
 	{ UCLASS_VIRTIO, "virtio" },
 	{ UCLASS_PVBLOCK, "pvblock" },
 	{ UCLASS_BLKMAP, "blkmap" },
+	{ UCLASS_RKMTD, "rkmtd" },
 };
 
 static enum uclass_id uclass_name_to_iftype(const char *uclass_idname)
include/dm/uclass-id.h +1 -0
index 0432c95c9edc..2fc672df0a3a 100644
@@ -120,6 +120,7 @@ enum uclass_id {
 	UCLASS_REGULATOR,	/* Regulator device */
 	UCLASS_REMOTEPROC,	/* Remote Processor device */
 	UCLASS_RESET,		/* Reset controller device */
+	UCLASS_RKMTD,		/* Rockchip MTD device */
 	UCLASS_RNG,		/* Random Number Generator */
 	UCLASS_RTC,		/* Real time clock device */
 	UCLASS_SCMI_AGENT,	/* Interface with an SCMI server */

--
2.39.2

Reviewed-by on v4 2/8
#3 lore raw

Re: [PATCH v4 2/8] rockchip: dm: prepare rkmtd UCLASS

Quoted 11 lines · Johan Jonker

Prepare a rkmtd UCLASS in use for writing Rockchip boot blocks in combination with existing userspace tools and rockusb command.

---
 disk/part.c                | 4 ++++
 drivers/block/blk-uclass.c | 1 +
 include/dm/uclass-id.h     | 1 +
 3 files changed, 6 insertions(+)
#4 lore raw

PATCH v4 3/8 rockchip: block: add rkmtd class and drivers

In reply to Johan Jonker

Add rkmtd class and drivers to create a virtual block device to transfer Rockchip boot block data to and from NAND with block orientated tools like "ums" and "rockusb".

---

Changed V4:
sort includes
replace constant by define

Changed V3:
New patch
Split driver from command
Split header
Use devm_kzalloc
Remove out of memory debug
Restyle

---
 drivers/block/Kconfig  |    7 +
 drivers/block/Makefile |    2 +
 drivers/block/rkmtd.c  | 1135 ++++++++++++++++++++++++++++++++++++++++
 include/rkmtd.h        |  191 +++++++
 4 files changed, 1335 insertions(+)
 create mode 100644 drivers/block/rkmtd.c
 create mode 100644 include/rkmtd.h
drivers/block/Kconfig +7 -0
index 1abea3f10db4..048a6caef00f 100644
@@ -262,3 +262,10 @@ config SYS_64BIT_LBA
 	help
 	  Make the block subsystem use 64bit sector addresses, rather than the
 	  default of 32bit.
+
+config RKMTD
+	bool "Rockchip rkmtd virtual block device"
+	help
+	  Enable "rkmtd" class and driver to create a virtual block device
+	  to transfer Rockchip boot block data to and from NAND with block
+	  orientate tools like "ums" and "rockusb".
drivers/block/Makefile +2 -0
index a161d145fd39..fdcba5c8318f 100644
@@ -11,6 +11,7 @@ endif
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_IDE) += ide.o
+obj-$(CONFIG_RKMTD) += rkmtd.o
 endif
 obj-$(CONFIG_SANDBOX) += sandbox.o host-uclass.o host_dev.o
 obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
@@ -19,3 +20,4 @@ obj-$(CONFIG_BLKMAP) += blkmap.o
 obj-$(CONFIG_EFI_MEDIA) += efi-media-uclass.o
 obj-$(CONFIG_EFI_MEDIA_SANDBOX) += sb_efi_media.o
 obj-$(CONFIG_EFI_MEDIA_BLK) += efi_blk.o
+
drivers/block/rkmtd.c new file +1135 -0

1,135 lines not on this page · raw message

include/rkmtd.h new file +191 -0

191 lines not on this page · raw message

--
2.39.2

#5 lore raw

PATCH v4 4/8 rockchip: block: blk-uclass: disable bounce buffer support for rkmtd

In reply to Johan Jonker

Disable bounce buffer support for rkmtd.

---

Changed V3:
New patch

---
 drivers/block/blk-uclass.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/blk-uclass.c +3 -3
index 30ad5bbb0024..ac1b43d757d8 100644
@@ -415,7 +415,7 @@ struct blk_bounce_buffer {
 
 static int blk_buffer_aligned(struct bounce_buffer *state)
 {
-#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)
 	struct blk_bounce_buffer *bbstate =
 		container_of(state, struct blk_bounce_buffer, state);
 	struct udevice *dev = bbstate->dev;
@@ -441,7 +441,7 @@ long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf)
 			  start, blkcnt, desc->blksz, buf))
 		return blkcnt;
 
-	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
 		struct blk_bounce_buffer bbstate = { .dev = dev };
 		int ret;
 
@@ -478,7 +478,7 @@ long blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
 
 	blkcache_invalidate(desc->uclass_id, desc->devnum);
 
-	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
 		struct blk_bounce_buffer bbstate = { .dev = dev };
 		int ret;
 

--
2.39.2

#6 lore raw

Re: [PATCH v4 4/8] rockchip: block: blk-uclass: disable bounce buffer support for rkmtd

Hi Johan,

Quoted 18 lines · Johan Jonker

Disable bounce buffer support for rkmtd.

---

Changed V3:
New patch

---
 drivers/block/blk-uclass.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/blk-uclass.c +0 -0
index 30ad5bbb0024..ac1b43d757d8 100644

drivers/block/blk-uclass.c struct blk_bounce_buffer { · line 418

Quoted 5 lines
drivers/block/blk-uclass.c +1 -1
@@ -415,7 +415,7 @@ struct blk_bounce_buffer {
 
 static int blk_buffer_aligned(struct bounce_buffer *state)
 {
-#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)

We should not have arch-specific code in a generic file. Can you make BOUNCE_BUFFER depend on !RKMTD ?

Quoted 22 lines
drivers/block/blk-uclass.c +2 -3
        struct blk_bounce_buffer *bbstate =
                container_of(state, struct blk_bounce_buffer, state);
        struct udevice *dev = bbstate->dev;
@@ -441,7 +441,7 @@ long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf)
                          start, blkcnt, desc->blksz, buf))
                return blkcnt;
 
-       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
                struct blk_bounce_buffer bbstate = { .dev = dev };
                int ret;
 
@@ -478,7 +478,7 @@ long blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
 
        blkcache_invalidate(desc->uclass_id, desc->devnum);
 
-       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
                struct blk_bounce_buffer bbstate = { .dev = dev };
                int ret;
 
--
Quoted 2 lines

2.39.2

Regards,
Simon

#7 lore raw

Re: [PATCH v4 4/8] rockchip: block: blk-uclass: disable bounce buffer support for rkmtd

Quoted 22 lines · Simon Glass

Hi Johan,

Quoted 19 lines · Johan Jonker

Disable bounce buffer support for rkmtd.

---

Changed V3:
New patch

---
 drivers/block/blk-uclass.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/blk-uclass.c +0 -0
index 30ad5bbb0024..ac1b43d757d8 100644
@@ -415,7 +415,7 @@ struct blk_bounce_buffer {
 
Quoted 8 lines

drivers/block/blk-uclass.c struct blk_bounce_buffer { · line 418

Quoted 4 lines
drivers/block/blk-uclass.c +1 -1
 static int blk_buffer_aligned(struct bounce_buffer *state)
 {
-#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)

We should not have arch-specific code in a generic file. Can you make BOUNCE_BUFFER depend on !RKMTD ?

Hi Simon, Marek,

No that doesn't work that way.

On Rockchip mainline boards MMC_DW is always our boot device BOOT_DEVICE_MMCx. Therefore BOUNCE_BUFFER is also standard enabled.

The solution in this patch below is wrong as it assumes that if BOUNCE_BUFFER is enabled it must be used all over the place.

blk: Add bounce buffer support to read/write operations
https://source.denx.de/u-boot/u-boot/-/commit/75191f75bce45f3b9aff607c88f17778d3805c61

All implementations of bounce_buffer_start and bounce_buffer_start_extalign are located in the individual drivers

https://elixir.bootlin.com/u-boot/latest/C/ident/bounce_buffer_start
https://elixir.bootlin.com/u-boot/latest/C/ident/bounce_buffer_start_extalign

The use of a bounce_buffer in block devices should only be allowed if needed.
Lack of "ops->buffer_aligned" does not prevent the creation of a bounce_buffer and is not a good selector yet.

	if (ops->buffer_aligned)
		return ops->buffer_aligned(dev, state);

Current blk_ops has no option to communicate the needed resources.
Please advise how to select the creation of a bounce buffer per device or other solution.

Johan

===
config MMC_DW
bool "Synopsys DesignWare Memory Card Interface" select BOUNCE_BUFFER

Without BOUNCE_BUFFER selected /drivers/mmc/dw_mmc.c does not compile even rk3066 only uses "fifo_mode".

arm-linux-gnueabihf-ld.bfd: drivers/mmc/dw_mmc.o: in function `dwmci_send_cmd':
/drivers/mmc/dw_mmc.c:285: undefined reference to `bounce_buffer_start'

		if (host->fifo_mode) {
			dwmci_writel(host, DWMCI_BLKSIZ, data->blocksize);
			dwmci_writel(host, DWMCI_BYTCNT,
				     data->blocksize * data->blocks);
			dwmci_wait_reset(host, DWMCI_CTRL_FIFO_RESET);
		} else {
			if (data->flags == MMC_DATA_READ) {
				ret = bounce_buffer_start(&bbstate,
						(void*)data->dest,
						data->blocksize *
						data->blocks, GEN_BB_WRITE);
			} else {
				ret = bounce_buffer_start(&bbstate,
						(void*)data->src,
						data->blocksize *
						data->blocks, GEN_BB_READ);
			}
[..]
		}

arm-linux-gnueabihf-ld.bfd: /drivers/mmc/dw_mmc.c:393: undefined reference to `bounce_buffer_stop'

		/* only dma mode need it */
		if (!host->fifo_mode) {
[..]
			bounce_buffer_stop(&bbstate);
		}
Quoted 28 lines
Quoted 23 lines
drivers/block/blk-uclass.c +2 -3
        struct blk_bounce_buffer *bbstate =
                container_of(state, struct blk_bounce_buffer, state);
        struct udevice *dev = bbstate->dev;
@@ -441,7 +441,7 @@ long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf)
                          start, blkcnt, desc->blksz, buf))
                return blkcnt;
 
-       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
                struct blk_bounce_buffer bbstate = { .dev = dev };
                int ret;
 
@@ -478,7 +478,7 @@ long blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
 
        blkcache_invalidate(desc->uclass_id, desc->devnum);
 
-       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
                struct blk_bounce_buffer bbstate = { .dev = dev };
                int ret;
 
--
Quoted 2 lines

2.39.2

Regards,
Simon

#8 lore raw

Re: [PATCH v4 4/8] rockchip: block: blk-uclass: disable bounce buffer support for rkmtd

Hi Johan,

Quoted 52 lines · Johan Jonker
Quoted 22 lines · Simon Glass

Hi Johan,

Quoted 19 lines · Johan Jonker

Disable bounce buffer support for rkmtd.

---

Changed V3:
New patch

---
 drivers/block/blk-uclass.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/blk-uclass.c +0 -0
index 30ad5bbb0024..ac1b43d757d8 100644
@@ -415,7 +415,7 @@ struct blk_bounce_buffer {
 
Quoted 8 lines

drivers/block/blk-uclass.c struct blk_bounce_buffer { · line 418

Quoted 4 lines
drivers/block/blk-uclass.c +1 -1
 static int blk_buffer_aligned(struct bounce_buffer *state)
 {
-#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)

We should not have arch-specific code in a generic file. Can you make BOUNCE_BUFFER depend on !RKMTD ?

Hi Simon, Marek,

No that doesn't work that way.

On Rockchip mainline boards MMC_DW is always our boot device BOOT_DEVICE_MMCx. Therefore BOUNCE_BUFFER is also standard enabled.

The solution in this patch below is wrong as it assumes that if BOUNCE_BUFFER is enabled it must be used all over the place.

blk: Add bounce buffer support to read/write operations
https://source.denx.de/u-boot/u-boot/-/commit/75191f75bce45f3b9aff607c88f17778d3805c61

All implementations of bounce_buffer_start and bounce_buffer_start_extalign are located in the individual drivers

https://elixir.bootlin.com/u-boot/latest/C/ident/bounce_buffer_start
https://elixir.bootlin.com/u-boot/latest/C/ident/bounce_buffer_start_extalign

Quoted 8 lines

The use of a bounce_buffer in block devices should only be allowed if needed.
Lack of "ops->buffer_aligned" does not prevent the creation of a bounce_buffer and is not a good selector yet.

        if (ops->buffer_aligned)
                return ops->buffer_aligned(dev, state);

Current blk_ops has no option to communicate the needed resources.
Please advise how to select the creation of a bounce buffer per device or other solution.

OK, I thought you might say that. So what about a flag in blk_desc which you can set for this driver, after the block device is created?

[..]

Regards,
Simon

#9 lore raw

PATCH v4 5/8 rockchip: cmd: add rkmtd command

In reply to Johan Jonker

The command rkmtd creates a virtual block device to transfer Rockchip boot block data to and from NAND with block orientated tools like "ums" and "rockusb".

It uses the Rockchip MTD driver to scan for boot blocks and copies data from the first block in a GPT formated virtual disk. Data must be written in U-boot "idbloader.img" format and start at partition "loader1" offset 64. The data header is parsed for length and offset. When the last sector is received it erases up to 5 erase blocks on NAND and writes bootblocks in a pattern depending on the NAND ID. Data is then verified. When a block turns out bad the block header is discarded.

---

Changed V4:
Sort includes

Changed V3:
Split driver from command
Split header
Restyle

---
 cmd/Kconfig  |   8 ++
 cmd/Makefile |   1 +
 cmd/rkmtd.c  | 204 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 213 insertions(+)
 create mode 100644 cmd/rkmtd.c
cmd/Kconfig +8 -0
index 6470b138d2f8..1979c6c62aa7 100644
@@ -1561,6 +1561,14 @@ config CMD_USB_SDP
 	  Enables the command "sdp" which is used to have U-Boot emulating the
 	  Serial Download Protocol (SDP) via USB.
 
+config CMD_RKMTD
+	bool "rkmtd"
+	select RKMTD
+	help
+	  Enable the command "rkmtd" to create a virtual block device to transfer
+	  Rockchip boot block data to and from NAND with block orientated tools
+	  like "ums" and "rockusb".
+
 config CMD_ROCKUSB
 	bool "rockusb"
 	depends on USB_FUNCTION_ROCKUSB
cmd/Makefile +1 -0
index 9bebf321c397..11927a5904e6 100644
@@ -151,6 +151,7 @@ obj-$(CONFIG_CMD_REISER) += reiser.o
 obj-$(CONFIG_CMD_REMOTEPROC) += remoteproc.o
 obj-$(CONFIG_CMD_RNG) += rng.o
 obj-$(CONFIG_CMD_KASLRSEED) += kaslrseed.o
+obj-$(CONFIG_CMD_RKMTD) += rkmtd.o
 obj-$(CONFIG_CMD_ROCKUSB) += rockusb.o
 obj-$(CONFIG_CMD_RTC) += rtc.o
 obj-$(CONFIG_SANDBOX) += host.o
cmd/rkmtd.c new file +204 -0

204 lines not on this page · raw message

--
2.39.2

#10 lore raw

PATCH v4 6/8 rockchip: test: dm: add rkmtd test

In reply to Johan Jonker

Add Rockchip rkmtd test:
Create/attach/detach RKMTD device. Send/read data with Rockchip boot block header. Test that reusing the same label should work. Basic test of 'rkmtd' commands.

---

Changed V4:
sort includes
rename define
use '\0'
use UT_TESTF_CONSOLE_REC flag
check RC4 result

Changed V3:
New patch

---
 test/dm/Makefile |   1 +
 test/dm/rkmtd.c  | 200 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 201 insertions(+)
 create mode 100644 test/dm/rkmtd.c
test/dm/Makefile +1 -0
index 7ed00733c1a6..a5e0a2744375 100644
@@ -100,6 +100,7 @@ obj-$(CONFIG_REMOTEPROC) += remoteproc.o
 obj-$(CONFIG_DM_RESET) += reset.o
 obj-$(CONFIG_SYSRESET) += sysreset.o
 obj-$(CONFIG_DM_REGULATOR) += regulator.o
+obj-$(CONFIG_CMD_RKMTD) += rkmtd.o
 obj-$(CONFIG_DM_RNG) += rng.o
 obj-$(CONFIG_DM_RTC) += rtc.o
 obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
test/dm/rkmtd.c new file +200 -0

200 lines not on this page · raw message

--
2.39.2

#11 lore raw

PATCH v4 7/8 rockchip: doc: add rkmtd.rst

In reply to Johan Jonker

Add documention for Rockchip rkmtd virtual block device.

---

Changed V3:
New patch

---
 doc/board/rockchip/index.rst |   1 +
 doc/board/rockchip/rkmtd.rst | 105 +++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 doc/board/rockchip/rkmtd.rst
doc/board/rockchip/index.rst +1 -0
index 0c377e9bbba0..9a87a035e95e 100644
@@ -8,3 +8,4 @@ Rockchip
    :maxdepth: 2
 
    rockchip
+   rkmtd
doc/board/rockchip/rkmtd.rst new file +105 -0

105 lines not on this page · raw message

--
2.39.2

#12 lore raw

PATCH v4 8/8 rockchip: configs: sandbox: enable rkmtd command

In reply to Johan Jonker

Enable rkmtd command for testing with sandbox_defconfig and sandbox64_defconfig.

---

Changed V3:
New patch

---
 configs/sandbox64_defconfig | 1 +
 configs/sandbox_defconfig   | 1 +
 2 files changed, 2 insertions(+)
configs/sandbox64_defconfig +1 -0
index 1a033b22018b..1a01f51a0b75 100644
@@ -58,6 +58,7 @@ CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_TEMPERATURE=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_RKMTD=y
 CONFIG_CMD_WDT=y
 CONFIG_CMD_WRITE=y
 CONFIG_CMD_CAT=y
configs/sandbox_defconfig +1 -0
index 01830c7bd255..cc54e6dec5af 100644
@@ -84,6 +84,7 @@ CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_TEMPERATURE=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_RKMTD=y
 CONFIG_CMD_WDT=y
 CONFIG_CMD_WRITE=y
 CONFIG_CMD_AXI=y

--
2.39.2