-
Notifications
You must be signed in to change notification settings - Fork 51
Rockchip SoC support #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a900d52
7d1b2aa
bf88b8a
f2d01e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -289,3 +289,142 @@ extract the FSBL and PMUFW from the complete boot image. | |||||
configuration: | ||||||
* path | ||||||
|
||||||
## For Rockchip devices | ||||||
|
||||||
Current implementation of support for the Rockchip SoCs, RAMboot and | ||||||
SPL DFU are supported. | ||||||
|
||||||
As there's no implementation for Rockchip USB protocol support, it is | ||||||
possible to push the DDR init files and SPL files from Rockchip but the next | ||||||
step will fail. | ||||||
|
||||||
Mainline u-boot does not support boot from RAM and boot from SPL DFU, | ||||||
it has to be patched. | ||||||
|
||||||
The patches have been sent to the u-boot mailing list by their authors | ||||||
and not yet merged. The patches can all be found inside this | ||||||
[merge request](https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/merge_requests/7). | ||||||
|
||||||
### Using binary generated by Rockchip's ``boot_merger`` | ||||||
|
||||||
[example](../src/snagrecover/templates/rockchip-merger.yaml) | ||||||
|
||||||
Snagboot can upload the ``CODE471_OPTION`` and ``CODE472_OPTION`` of a binary | ||||||
generated with the ``boot_merger`` tool and configuration files from | ||||||
[Rockchip rkbin](https://github.com/radxa/rkbin/tree/develop-v2024.03/). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably link to "upstream" https://github.com/rockchip-linux/rkbin tree.
Suggested change
|
||||||
|
||||||
In case of u-boot, this would mean to upload the TPL, SPL and then use SPL DFU | ||||||
to boot u-boot proper (see later section for SPL DFU). | ||||||
|
||||||
An example configuration for rk3399 would be: | ||||||
``` | ||||||
[CHIP_NAME] | ||||||
NAME=RK330C | ||||||
[VERSION] | ||||||
MAJOR=1 | ||||||
MINOR=123 | ||||||
[CODE471_OPTION] | ||||||
NUM=1 | ||||||
Path1=tpl/u-boot-tpl-dtb.bin | ||||||
Sleep=1 | ||||||
[CODE472_OPTION] | ||||||
NUM=1 | ||||||
Path1=spl/u-boot-spl-dtb.bin | ||||||
Sleep=3000 | ||||||
[LOADER_OPTION] | ||||||
NUM=2 | ||||||
LOADER1=FlashData | ||||||
LOADER2=FlashBoot | ||||||
FlashData=spl/u-boot-spl-dtb.bin | ||||||
FlashBoot=u-boot.itb | ||||||
[OUTPUT] | ||||||
PATH=rk3399_uboot.bin | ||||||
[FLAG] | ||||||
471_RC4_OFF=false | ||||||
``` | ||||||
|
||||||
The ``tpl/u-boot-tpl-dtb.bin``, ``spl/u-boot-spl-dtb.bin``, ``u-boot.itb`` | ||||||
files are generated during u-boot's build. Please note has the ``LOADER_OPTION`` | ||||||
is not handled by snagboot. | ||||||
|
||||||
rgantois marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
The configuration parameters are: | ||||||
|
||||||
**xpl:** Binary blob generated with bootmerger. For instance, here, ``rk3399_uboot.bin``. | ||||||
* path: path to the blob | ||||||
|
||||||
**u-boot-fit:** U-boot FIT image. | ||||||
* path: Path to the FIT image. Typically, ``u-boot.itb`` | ||||||
|
||||||
|
||||||
### Boot from Ram | ||||||
|
||||||
[example](../src/snagrecover/templates/rockchip-ramboot.yaml) | ||||||
|
||||||
When building u-boot with the previously mentioned patches, u-boot will generate two files: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the latest U-Boot RK RAM-boot series you should build U-Boot with something like following to produce
|
||||||
|
||||||
- ``u-boot-rockchip-usb471.bin`` | ||||||
- ``u-boot-rockchip-usb472.bin`` | ||||||
|
||||||
These are the files needed to boot from RAM. | ||||||
|
||||||
The configuration parameters are: | ||||||
|
||||||
**code471:** File to use for maskrom code 0x471. | ||||||
|
||||||
configuration: | ||||||
* path: Path to the ``u-boot-rockchip-usb471.bin`` file | ||||||
* delay: Optional delay in milliseconds before loading next binary | ||||||
|
||||||
**code472:** File to use for maskrom code 0x472. | ||||||
|
||||||
configuration: | ||||||
* path: Path to the ``u-boot-rockchip-usb472.bin`` file | ||||||
|
||||||
rgantois marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
### Boot from SPL DFU | ||||||
|
||||||
[example](../src/snagrecover/templates/rockchip-spl-dfu.yaml) | ||||||
|
||||||
To enable u-boot with SPL DFU support in the u-boot configuration, ensure that the | ||||||
following options are enabled: | ||||||
|
||||||
``` | ||||||
CONFIG_SPL_DM_USB_GADGET=y | ||||||
CONFIG_SPL_USB_GADGET=y | ||||||
CONFIG_SPL_DFU=y | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I encountered an issue while using this configuration. After I found out that the board's DDR was not properly erased after a reset, A solution to this would be to disable U-Boot's configuration option Could you please add this option to the list along with the explanation that I gave? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, right. On reset/reboot, the RAM is not reset so it'll find the ramboot binary and use it instead of DFU. I've added some notes in the doc about that. |
||||||
``` | ||||||
|
||||||
On some systems, rebooting the system won't reset the memory content. This means that | ||||||
booting over DFU after having done a boot from RAM will result in u-boot loading the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello Arnaud, I think the current explanation might mislead some users. U-Boot SPL will boot a U-Boot proper if it is present in RAM, whether it was put there by "boot from DFU" or by "boot from RAM". This could lead some users that only use "boot from DFU" to not disable CONFIG_SPL_RAM_DEVICE. We could maybe write something along the lines of: "This means that booting over DFU when there is already u-boot proper in RAM will boot the later and not download the new one from DFU, e.g. if you run snagrecover two times in a row, u-boot proper might not be updated in these cases" |
||||||
u-boot version from the boot from RAM boot and won't try to load u-boot over DFU. | ||||||
|
||||||
To solve this, disable boot from RAM with: | ||||||
|
||||||
``` | ||||||
# CONFIG_SPL_RAM_DEVICE is not set | ||||||
``` | ||||||
|
||||||
The (SPL) USB gadget driver needs to be enabled too. | ||||||
|
||||||
At the end of the build, the following files will be needed: | ||||||
|
||||||
- ``mkimage-in-simple-bin.mkimage-u-boot-tpl`` or ``mkimage-in-simple-bin.mkimage-rockchip-tpl`` | ||||||
- ``mkimage-in-simple-bin.mkimage-u-boot-spl`` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These |
||||||
- ``u-boot.itb`` | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: you're missing a "configuration:" after the "u-boot-fit:" entry. |
||||||
The configuration parameters are: | ||||||
|
||||||
**code471:** File to use for maskrom code 0x471. | ||||||
|
||||||
configuration: | ||||||
* path: Path to the TPL file. For instance, ``mkimage-in-simple-bin.mkimage-rockchip-tpl``. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
* delay: Optional delay in milliseconds before loading next binary | ||||||
|
||||||
**code472:** File to use for maskrom code 0x472. | ||||||
|
||||||
configuration: | ||||||
* path: Path to the SPL. For instance, ``mkimage-in-simple-bin.mkimage-u-boot-spl``. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
* delay: Optional delay in milliseconds before loading next binary | ||||||
|
||||||
**u-boot-fit:** U-boot FIT image. | ||||||
* path: Path to the FIT image. Typically, ``u-boot.itb`` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,3 +76,21 @@ SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="d022", MODE="0660" | |
|
||
#Xilinx rules | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0050", MODE="0660", TAG+="uaccess" | ||
|
||
#Rockchip systems | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="2207", MODE="0660", TAG+="uaccess" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you seen a device use PID This list is missing the following known PIDs:
You could probably just use |
||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="110a", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="110b", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="300a", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="301a", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="310b", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="310c", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="320a", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="320b", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="320c", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="330a", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="330c", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="330d", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="330e", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="350a", MODE="0660", TAG+="uaccess" | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2207", ATTRS{idProduct}=="350b", MODE="0660", TAG+="uaccess" |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -52,6 +52,23 @@ | |||||||||||||||
"imx8mm": "1fc9:0134", | ||||||||||||||||
"imx8mq": "1fc9:012b", | ||||||||||||||||
"imx53" : "15a2:004e", | ||||||||||||||||
}, | ||||||||||||||||
"rockchip": { | ||||||||||||||||
"rv1108": "2207:110a", | ||||||||||||||||
"rv1126": "2207:110b", | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is missing RV1106, RV1103B and RV1126B.
Suggested change
|
||||||||||||||||
"rk3066": "2207:300a", | ||||||||||||||||
"rk3036": "2207:301a", | ||||||||||||||||
"rk3188": "2207:310b", | ||||||||||||||||
"rk3128": "2207:310c", | ||||||||||||||||
"rk3288": "2207:320a", | ||||||||||||||||
"rk322x": "2207:320b", | ||||||||||||||||
"rk3328": "2207:320c", | ||||||||||||||||
"rk3368": "2207:330a", | ||||||||||||||||
"rk3399": "2207:330c", | ||||||||||||||||
"px30": "2207:330d", | ||||||||||||||||
"rk3308": "2207:330e", | ||||||||||||||||
"rk3568": "2207:350a", | ||||||||||||||||
"rk3588": "2207:350b" | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is missing RK3528, RK3562, RK3576 and RK3506.
Suggested change
|
||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
|
@@ -80,6 +97,8 @@ def init_config(args: list): | |||||||||||||||
if args.usb_path is None: | ||||||||||||||||
if soc_family == "imx": | ||||||||||||||||
usb_ids = default_usb_ids["imx"][soc_model] | ||||||||||||||||
elif soc_family == "rockchip": | ||||||||||||||||
usb_ids = default_usb_ids["rockchip"][soc_model] | ||||||||||||||||
else: | ||||||||||||||||
usb_ids = default_usb_ids[soc_family] | ||||||||||||||||
|
||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch is using outdated U-Boot RAM-boot patches, please update the MR to use latest version of the series, at the moment v2. Also plan on sending a v3 with a small update next few days/week.