From: Johan Jonker <jbx6244@gmail.com>
To: kever.yang@rock-chips.com
Cc: sjg@chromium.org, philipp.tomsich@vrull.eu,
michael@amarulasolutions.com,
dario.binacchi@amarulasolutions.com, u-boot@lists.denx.de
Subject: [PATCH v1 0/3] Add rockmtd command
Date: Thu, 24 Aug 2023 15:27:38 +0200 [thread overview]
Message-ID: <cbbaecb0-19fc-018d-df63-c5f265156024@gmail.com> (raw)
Rockmtd 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.
Limitations:
Support for Rockchip boot block header type 1 only.
Pattern for listed NAND IDs only. (Logic still not disclosed by Rockchip)
The MTD framework driver data and NAND ID must be extracted at a lower level.
Only tested with rk3066 NFC v6.0.
Available rockmtd commands:
rockmtd bind <label> - bind ROCKMTD device
rockmtd unbind <label> - unbind ROCKMTD device
rockmtd info [<label>] - show all available ROCKMTD devices
rockmtd dev [<label>] - show or set current ROCKMTD device
U-boot settings:
Config to enable Rockchip MTD support:
CONFIG_MTD=y
CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT=y
CONFIG_SYS_NAND_USE_FLASH_BBT=y
CONFIG_ROCKCHIP_NAND=y
Option to keep existing NAND data unchanged:
CONFIG_ROCKCHIP_NAND_SKIP_BBTSCAN=y
Commands to enable:
CONFIG_CMD_USB=y
CONFIG_CMD_ROCKMTD=y
CONFIG_CMD_ROCKUSB=y
CONFIG_CMD_USB_MASS_STORAGE=y
Linux Host (PC) tool commands combinations that work:
U-boot Linux
rockmtd bind 0
# rockusb
rockusb 0 rkmtd 0
upgrade_tool pl
upgrade_tool wl 64 idbloader.img
upgrade_tool rl 64 512 upgrade_tool_rl_64_512.img
upgrade_tool rd
rkdeveloptool ppt
rkdeveloptool wlx loader1 idbloader.img
rkdeveloptool wl 64 idbloader.img
rkdeveloptool rl 64 512 rkdeveloptool_rl_64_512.img
rkdeveloptool rd
rkflashtool w 64 512 < idbloader.img
rkflashtool r 64 512 > rkflashtool_r_64_512.img
# ums
ums 0 rkmtd 0
dd if=idbloader.img of=/dev/sda1
dd if=/dev/sda1 of=ums_0_idb_0_rd.img
Johan Jonker (3):
mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN option
dm: prepare rkmtd UCLASS
rockchip: cmd: add rockmtd command
cmd/Kconfig | 7 +
cmd/Makefile | 1 +
cmd/rockmtd.c | 1429 +++++++++++++++++++++++++++
disk/part.c | 4 +
drivers/block/blk-uclass.c | 1 +
drivers/mtd/nand/raw/Kconfig | 9 +
drivers/mtd/nand/raw/rockchip_nfc.c | 3 +
include/dm/uclass-id.h | 1 +
8 files changed, 1455 insertions(+)
create mode 100644 cmd/rockmtd.c
--
2.30.2
next reply other threads:[~2023-08-24 13:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 13:27 Johan Jonker [this message]
2023-08-24 13:28 ` [PATCH v1 1/3] mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN option Johan Jonker
2023-09-28 3:04 ` Kever Yang
2023-08-24 13:29 ` [PATCH v1 2/3] dm: prepare rkmtd UCLASS Johan Jonker
2023-09-28 3:04 ` Kever Yang
2023-08-24 13:29 ` [PATCH v1 3/3] rockchip: cmd: add rockmtd command Johan Jonker
2023-09-28 3:11 ` Kever Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cbbaecb0-19fc-018d-df63-c5f265156024@gmail.com \
--to=jbx6244@gmail.com \
--cc=dario.binacchi@amarulasolutions.com \
--cc=kever.yang@rock-chips.com \
--cc=michael@amarulasolutions.com \
--cc=philipp.tomsich@vrull.eu \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox