Commit Graph

4851 Commits

Author SHA1 Message Date
Peng Fan b86dc4195f UPSTREAM: SPL: Add FIT data-position property support
For external data, FIT has a optional property "data-position" which
can set the external data to a fixed offset to FIT beginning.
Add the support for this property in SPL FIT.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: "Andrew F. Davis" <afd@ti.com>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: "tomas.melin@vaisala.com" <tomas.melin@vaisala.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: "Cooper Jr., Franklin" <fcooper@ti.com>
Cc: George McCollister <george.mccollister@gmail.com>
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: Rick Altherr <raltherr@google.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: York Sun <york.sun@nxp.com>
(cherry picked from commit a1be94b65410c7ebba5e7695478b6623579b410c)
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I1cdcfe0358e5a39fed3dfcf0554a7ba0e16729b8

Change-Id: I44c3454addd85d70e6fba8e26b66a0278c5c1081
2020-03-06 18:18:20 +08:00
Joseph Chen d3a605e34d common: image: support reloc image at the given address
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia15f4dfa96602554f5c293dbf383f84a83a05950
2020-02-28 12:38:42 +08:00
Joseph Chen 277a68daf9 common: bootm: add bootm_board_start()
There maybe some board routine before bootm common
flow. The board can override this __weak function.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I6660f4ef27f3889d2dbc29594ad164a12ec6c934
2020-02-28 11:37:15 +08:00
Joseph Chen 998aeb5fa7 common: bootm: add board_do_bootm()
There maybe some board routine before do_bootm_states().
The board can override this __weak function.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Iab6a6742a02dae681e4d3221dc7cfffd2c3df98c
2020-02-28 11:37:15 +08:00
Joseph Chen ac459efd10 common: fit: add entry and load address set api
Add FIT_MULTI_PROP definition.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I5e98601799de88843f8110f118640339079905a5
2020-02-28 11:37:14 +08:00
Joseph Chen 01918c3fa9 common: android: update image end get for android v2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I4b2cddec072657d69b294dbddf300cf4d0471695
2020-02-28 11:37:14 +08:00
Joseph Chen c01d448924 sysmem: simplify the memblk name
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Icfe908ade21d1d8f568db796298f67ba9f013da6
2020-02-28 11:22:04 +08:00
Joseph Chen 98de7945ac common: bootm: improve decompess image message
Make it more meaningful.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ie26745d6c007cc1bae91ebf2fad88feb1742e8bb
2020-02-28 11:20:58 +08:00
Joseph Chen ea8a3d10b6 common: board_f: save U-Boot fdt blob
Saving it for late use, eg: fit verified boot process.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I6643fb643f2fd88795d80fc5bd21025b62dc6943
2020-02-28 11:17:03 +08:00
Joseph Chen fc722856eb common: board_r: add minimum nowhere env for board init.
Storage env or kernel dtb load depends on bootdev, while bootdev
depends on env varname: devtype, devnum and rkimg_bootdev, etc.
So we have to use nowhere env firstly and cover the storage env
after it is loaded.

Providing a minimum and necessary nowhere env for board init to
avoid covering the other varnames in storage env.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8362c24376e7530f15335f26197a7cddbcae579c
2020-02-25 14:18:15 +08:00
Jason Zhu 2241fc0f8b common: spl: rkfw: support resource file in spl
Change-Id: I14d0afd6131cd523cd0218bb727b9a3b48397943
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2020-02-24 17:27:50 +08:00
Jason Zhu 189f3a8c31 spl: atf: pass kernel parameters through bl33_ep_info->args
Pass when enable CONFIG_SPL_KERNEL_BOOT.

Change-Id: Iee442466df59eeaa0f477f264f523b026e516168
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2020-02-24 16:35:12 +08:00
Jason Zhu e3460df72d common: spl: rkfw: support boot kernel in spl
Load kernel through android format, then jump to kernel through ATF.

Change-Id: Idc77461bae0e4300c146c68f6a7e4e157c29db7f
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2020-02-24 14:03:43 +08:00
Jason Zhu dd04b7cb10 spl: add SPL_KERNEL_BOOT
Change-Id: I6460bf6fa4535c60d956bba6c3c2f00b6b61bf45
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2020-02-24 14:03:43 +08:00
Jason Zhu 49f617a949 spl: support SPL_KERNEL_ADDR & SPL_FDT_ADDR & SPL_RAMDISK_ADDR
Change-Id: I9c8d4ba9118c7c22504753a3c9de33706bea04fd
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2020-02-24 14:03:43 +08:00
Joseph Chen 1481bafe9d common: spl: enable D-cache by default to improve performance
Set CONFIG_SPL_SYS_MALLOC_F_LEN enough to promise the tlb buffer
can be malloc, actually this is a way to compatible all the current
boards without adding a new configure option.

I-cache has been setup at early assembly code by default.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I7e973299eddc358cd4c15846c5de154050bf9547
2020-02-20 17:14:04 +08:00
Joseph Chen aa1eec08bb rockchip: make boot_rkimg.c as basic mandory code
boot_rkimg.c is the basic code for rockchip platforms, such as
get boot devtype, setup download mode and get kernel dtb, etc.

CONFIG_RKIMG_BOOTLOADER actually makes no sense for rockchip
features any more, but we still leave it to compatile code
compilation since there is a lot of code depends on it. but it
maybe dropped in the future.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Iab922cbf3a70e7eb1444678d6e902b9d8e106dd1
2020-02-19 13:21:10 +08:00
Joseph Chen 0f0484481c common: image-fdt: skip image_check_type() for fdt
default image mkimage conflicts with fit mkimage on param: -T "flat_dt"
and failed to build fdt uImage.

error message:
"./tools/mkimage: Can't set header for FIT Image support: Success"

It's fine to drop that since the fdt_check_header() follows it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I50554765bac7cc75df7ab5920e94cafe78d14bdc
2020-01-16 11:50:49 +08:00
Joseph Chen 5b8e7bf473 common: image-fit: support "data-offset" and "data-size"
It seems the U-Boot proper fit code misses this.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I1e5255e20f4f309c083e601e6c2d0e37869bac20
2020-01-16 11:50:49 +08:00
Joseph Chen d04ada6cfd rockchip: clean boot_mode.c and boot_rkimg.c
Clean the code into where it belongs to.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia034b8c3d8b264796db72c7bf44bab95811ecb77
2020-01-09 14:27:25 +08:00
Joseph Chen e72b912575 common: rkimg: move rkimg boot code into bootrkp.c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I362e5ab0e1aee8b9126d51358ea1300d60d0a706
2020-01-09 14:17:53 +08:00
Michal Suchanek 92937b1f66 UPSTREAM: usb: Add nonblock argument to submit_int_msg
This will be used to implement non-blocking keyboard polling in case of
errors.

Conflicts:
	common/usb.c
	common/usb_kbd.c
	common/usb_storage.c
	include/usb.h

Change-Id: I4a951d779e2cf9e80380f93000a87a617453fb32
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 3437121c037f502a3b0faaec97059777034a1ead)
2020-01-07 17:25:00 +08:00
Frieder Schrempf e7093b518a UPSTREAM: usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Add support for loading u-boot FIT images over the USB SDP protocol in
the SPL

Change-Id: I41461b58c088a10eca6e48b0d49c76944c37c3fa
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
[Various build fixes]
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Tested-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 2c72ead7387404eba16c556d2f204c52c36c27f9)
2020-01-07 17:24:58 +08:00
Andrew F. Davis 09b32b41f2 UPSTREAM: spl: Kconfig: Drop the _SUPPORT postfix from SPL_DFU
The symbol CONFIG_SPL_DFU_SUPPORT in SPL build has the same
meaning as CONFIG_DFU in regular U-Boot. Drop the _SUPPORT
to allow for cleaner use in code.

Conflicts:
	arch/arm/mach-zynqmp/spl.c
	common/Makefile
	common/spl/Kconfig
	common/spl/spl_ram.c

Change-Id: I93f09d5953284d511df135e6e71c03c0552719a2
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
(cherry picked from commit 6536ca4d6676bf38e50784298e713edc30b9cde9)
2020-01-07 17:24:56 +08:00
Jean-Jacques Hiblot eccca8a35d UPSTREAM: Kconfig: rename CONFIG_SPL_USB_GADGET as CONFIG_SPL_USB_GADGET
The SPL option for USB gadget should be named after the option for u-boot
(CONFIG_USB_GADGET)

Conflicts:
	arch/arm/mach-imx/mx6/Kconfig
	arch/arm/mach-imx/spl.c
	configs/am335x_boneblack_vboot_defconfig
	configs/am335x_evm_usbspl_defconfig
	configs/am43xx_evm_defconfig
	configs/am43xx_hs_evm_defconfig
	configs/imx6q_logic_defconfig
	configs/mx6memcal_defconfig
	configs/mx6sabresd_defconfig
	configs/pico-hobbit-imx6ul_defconfig
	configs/pico-hobbit-imx7d_defconfig
	configs/pico-imx6ul_defconfig
	configs/pico-imx7d_defconfig
	configs/pico-pi-imx6ul_defconfig
	configs/pico-pi-imx7d_defconfig
	drivers/Makefile

Change-Id: I51305422f13cb7d743274f82c531000c0f93c144
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit f811e9763f4b6f6f5e3fe9c2fa30d2b6c62d289e)
2020-01-07 17:24:55 +08:00
Jean-Jacques Hiblot b95d44460f UPSTREAM: usb: gadget: Do not call board_usb_xxx() directly in USB gadget drivers
Add 2 functions to wrap the calls to board_usb_init() and
board_usb_cleanup().
This is a preparatory work for DM support for UDC drivers (DM_USB_GADGET).

Conflicts:
	cmd/fastboot.c
	cmd/rockusb.c
	cmd/usb_mass_storage.c

Change-Id: I2b3a567d9dff75a03176d76d9fd9775cd8a0792e
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit a06955ae1ef2a942f18025d4fefceea2c638a76f)
2020-01-07 17:24:53 +08:00
Sven Schwermer 3739bf7e20 UPSTREAM: usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/
This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Conflicts:
	drivers/usb/host/ehci-atmel.c
	drivers/usb/host/xhci-fsl.c

Change-Id: If6c980c620cf97c1dd131f60953c305e34dba505
Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit fd09c205fc57b90a782cac33449ef172575d0a8c)
2020-01-07 17:24:53 +08:00
Andre Heider 8e33586e7c UPSTREAM: usb: gadget: sdp: add missing line breaks
Cosmetic change.

Change-Id: Ia6606d3e491c3032882476f00d4e306c30da8953
Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 24ccd0c8fd6285636edb94d0ece2cbcf062d64eb)
2020-01-07 17:24:47 +08:00
Sven Schwermer c8f2d7ee94 UPSTREAM: usb: Remove CMD_USB dependency for common code
Common USB code is built whenever USB is enabled (in non-SPL builds).
The USB uclass is built whenever (SPL_)DM_USB is enabled. Both need to
be independent from CMD_USB.

Change-Id: Idb5e7ffeea8cb325855cb2d1b6713d62fe438120
Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ab5817027f9b4fce25f5f2a3e20577ac55bbd7e0)
2020-01-07 17:24:44 +08:00
Joseph Chen b6b05c7154 common: android: skip blk read and memcpy if image size is 0
blk_read() may return error code if image size is 0, it depends
on block layer implementation.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I29bab10835e9029780a957e871a600a6fbdf6068
2019-12-20 10:53:44 +08:00
Joseph Chen 6527836d2a common: android: rename and export load_android_image()
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I7398b83bff0fd0dedd77834ee2a8ff14f2ae11e0
2019-12-17 15:05:19 +08:00
Joseph Chen 7b2520c78e common: android: not go further if image is in-place
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I7ba27cd704638af933b8581f08192c3ab53c1928
2019-12-17 15:05:19 +08:00
Joseph Chen 470c509241 board_f/arm: fixup 4GB+ memory size
- fixup gd->bd->bi_dram[] before update "/memory" node
- append 4GB+ memory size when announce dram

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8908426c54d251e5cfa9216b0dc5470145e37cb5
2019-12-16 21:01:55 +08:00
Joseph Chen c484df2f85 common: android: refactor image load and sha1 verify
Unify single image load/memcpy to image_read(), containing
sha1 update.

Not support verify image by RK legacy mkbootimg tools.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ide88d2dda79f3335a6c34e41bdce56eac0d66408
2019-12-10 12:48:27 +08:00
Joseph Chen e1b9a8426d common: android: support decompress kernel for AVB bootflow
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: If253d573384d697338f92b591b28efde9dab48bf
2019-12-10 12:47:52 +08:00
Joseph Chen 3f7fb06b24 common: android: make image separate load mandory
Since this feature is stable and helpful to save boot time,
let't make it mandory.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I36f244c6d319d6b54ed3d54730352c8d5b4cc6bd
2019-12-10 12:47:52 +08:00
Joseph Chen b554a8f003 common: board_f: print new fdt address
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I61a9e6e65a5a81639424f27bda4d389e002f1132
2019-12-03 12:58:01 +08:00
Joseph Chen c641fb242b common: Kconfig: select SHA1 if !DM_CRYPTO for android image verify
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id010fe3e5947ad19fdba8a2dd97f421d83282105
2019-11-27 20:53:34 +08:00
Tony Xu 53bea680ec common: write keybox: always write storage flag to security sorage
Change-Id: Iaa536eb51216f46a35ae5999ed19ad5703509b6a
Signed-off-by: Tony Xu <tony.xu@rock-chips.com>
2019-11-27 11:31:04 +08:00
Jason Zhu fd633ddcf6 android: add function android_bcb_write
Change-Id: Ie65068dc4fca751a9bcc959c56209aaf4729f638
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-11-22 08:41:53 +08:00
Dayao Ji 0a34d7e5db common: android: support A/B with DP support
Need to pass androidboot.force_normal_boot=1 instead of
skip_initramfs when A/B supporting dynamic partition.

Change-Id: I1748690d04d4ef16e121d8dc88f69745a3cbb77d
Signed-off-by: Dayao Ji <jdy@rock-chips.com>
2019-11-15 10:00:47 +08:00
Joseph Chen a84f21ebb8 rockchip: add misc BCB message offset compatibility
Rockchip platforms defines BCB message at the 16KB offset of
misc partition while the Google defines it at 0x0 offset.

From Android-Q, the 0x0 offset is mandary on Google VTS, so this
patch is a compatibility according to android image 'os_version'.

Android os version >= 10 is at 0x0 offset, otherwise at 16KB offset.

Change-Id: I54a7674e2dc2e0c29fc624f17b4453663c9ea462
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-14 11:08:45 +08:00
Joseph Chen c092b1390d common: image: provide BCB offset according to android os version
Rockchip platforms defines BCB message at the 16KB offset of
misc partition while the Google defines it at 0x0 offset.

From Android-Q, the 0x0 offset is mandary on Google VTS.

Change-Id: Iac36d421ed605684353c30bfe0e9982bdd5de065
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-14 11:08:45 +08:00
Joseph Chen 3c9d2903a9 common: image: fix parse kernel compressed type issue
This issue happens on the SDK version < 8.1. The reason is we don't
read enough blocks from storage for kernel compressed type validation.

ANDROID_ROCKCHIP_LEGACY_PAGE_SIZE(16KB) is defined by rockchip legacy
mkboot tool(SDK version < 8.1) and larger than Google defined.

To compatible this, we malloc enough buffer but only read android
header and kernel image(1 block) from storage.

Change-Id: I9800e4150985adcd5dbd78c28c471604eb403eae
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-07 14:58:09 +08:00
Jason Zhu e1c1c23dd8 android: change the verification mode
The mode AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE will add
"androidboot.vbmeta.invalidate_on_error=yes" to cmdline, and kernel
will invalidate vbmeta if verified fail. This will modify the vbmeta.img
head and make uboot verify vbmeta.img fail in avb system. And in avb & ab
system, we can use the retry-count to change slot if verify fail without
modify the vbmeta. So just use the mode AVB_HASHTREE_ERROR_MODE_RESTART.

Change-Id: I98d60683d5365b996fcca2e85d4847d4a6df2ef6
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-11-06 14:41:53 +08:00
Joseph Chen c6666740ee common: android/rkimg: remove/clean android a/b (slot) code
- the partition disk layer takes over the responsibility of slot suffix
  appending, we remove relative code to make file clean;
- put android a/b code together and name them to be eary understood,
  this makes file esay to read.

Change-Id: Id8c838da682ce6098bd7192d7d7c64269f4e86ba
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-04 15:43:46 +08:00
Joseph Chen 0ed06f16e2 rockchip: support boot from U-disk
- The U-disk boot is only supported from U-Boot, the earlier preloader
  doesn't support it;
- MMC1(SD) has higher priority than U-disk;
- Always boot into recovery mode and deliver "usbfwupdate" to cmdline;
- Usb driver may depend on clock/regulator init, so behind of them;
- Suggest to add ./dts/kern.dtb file to promise the kernel dtb always
  to be loaded successfully even the native images are all damaged.

Change-Id: Ibbb2a061a727752277ac1b80abf362de5d94cca2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-04 14:53:45 +08:00
Joseph Chen 01f0422dca common: bootm: skip usb_stop() if usb is boot device
We may access usb at late sequence.

Change-Id: I8e8b40fc7e1018fe279f384282481805bceb5daa
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-04 14:53:45 +08:00
Joseph Chen d935323b7d common: board_info: print "AArch32" cpu mode
Change-Id: I7384f1fd1e8cad69464a3b218d7570e044905daa
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-10-24 10:52:45 +08:00
Tony Xu 86574b32ce common: write_keybox: support write keybox by RKDevInfoWriteTool
Change-Id: I853663623f4550469b676239c44586e5efb6b21f
Signed-off-by: Tony Xu <tony.xu@rock-chips.com>
2019-10-22 14:48:33 +08:00