Commit Graph

613 Commits

Author SHA1 Message Date
Rob Clark 2f0750eb18 UPSTREAM: efi_loader: refactor boot device and loaded_image handling
Get rid of the hacky fake boot-device and duplicate device-path
constructing (which needs to match what efi_disk and efi_net do).
Instead convert over to use efi_device_path helpers to construct
device-paths, and use that to look up the actual boot device.

Also, extract out a helper to plug things in properly to the
loaded_image.  In a following patch we'll want to re-use this in
efi_load_image() to handle the case of loading an image from a
file_path.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 95c5553ea268144056c4bafc318b9e8b5c096a6c)

Change-Id: Iaa6a9865f2cbd15d6537d200bd86662fa4baf5a0
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2020-01-06 11:45:12 +08:00
Lin Jinhan 8609b717aa cmd: crypto: unifiy hash output variable
rk1808 is not support SHA512.

Change-Id: Ica8c1a04553e862915417c36db6362df049e002e
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2019-12-10 08:39:32 +08:00
Joseph Chen 2eb7260f2e cmd: fdt: use gd->fdt_blob as default fdt address
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I16a413bcbca17842cd560367ebae6454a63354f2
2019-12-03 20:23:51 +08:00
Joseph Chen 27d36fbda0 cmd: crypto: make foo_data[] cacheline aligned
Crypto-v1 needs flush_dcache() for SHA, this avoids the warning
message "CACHE: Misaligned operation at range ...".

Change-Id: Ie766af60db83ec1f290103c2059863fa50d0a0ad
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-27 11:13:54 +08:00
Joseph Chen f501ba4438 cmd: boot: add mode args for "reset"
- Add "reboot" command as alias of "reset";
- Support command like: reboot loader/bootloader/recovery, etc.

Change-Id: I9748664aeca052a775a3f88f7fdf9b3923941026
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-12 19:34:04 +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 f988e29580 cmd: nvedit: add "env update ..." sub command
It supports to add/append/replace variable(s).

Change-Id: I1219e67e3dc778a634689516503e311d0577f35d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-10-24 09:12:10 +08:00
Joseph Chen 535b44c04d cmd: rockusb: forbid to flash mmc 1(sdcard)
Change-Id: I186bfe127e6146aab1df52f8bafb20da9d1647d2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-10-16 10:01:39 +08:00
Lin Jinhan c9d107b5b9 dm: crypto: add TRNG test
Change-Id: Id88d07ff36d20fa19e4be969673f88384f2f658e
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2019-10-14 20:57:26 +08:00
Joseph Chen 35ca3e037c cmd: bootrkp: fix always detect sdcard successfully
fixes:(1476830 cmd: bootrkp: clean up code)

Change-Id: I437174085875b70bd72768f900b7c64c33163822
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-10-14 20:45:38 +08:00
YouMin Chen e1f97ec39a driver: ram: rockchip: rename sdram_common.* to sdram.*
Change-Id: Idc6edee2906297d3ab681a36dc58c79283c0eb57
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2019-10-09 18:10:19 +08:00
Jason Zhu df57b34bfa fastboot: remove 'default y' from RK_AVB_LIBAVB_ENABLE_ATH_UNLOCK
Open RK_AVB_LIBAVB_ENABLE_ATH_UNLOCK if need advanced security requirements.

Change-Id: Ie01c6342d379b672fe69e367262496d97b5890e9
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-09-20 11:17:38 +08:00
Joseph Chen df3ff3726e cmd: android: round up image header size
Change-Id: I79e1b31ae2d018c0a8da030482f2ac0be44cb177
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-09-03 08:53:08 +08:00
Jason Zhu 2b4182c1ed cmd: rk_secure_storage: dump data which is written in OTP or efuse
Change-Id: I644add22f3aaed546d727de7727d3230ae1a6c01
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-08-21 12:58:49 +08:00
zain wang d38ae1a6d6 fastboot: export CONFIG_RK_AVB_LIBAVB_ENABLE_ATH_UNLOCK
Relate to commit 46a8a26905
("fastboot: add RK_AVB_LIBAVB_ENABLE_ATH_UNLOCK config")
Export config can help us select it easily.

Change-Id: I43a210f1efb35ff679102c8686cbca219d2def97
Signed-off-by: zain wang <wzz@rock-chips.com>
2019-08-20 11:00:56 +08:00
Jon Lin c4d5fc6337 cmd: mtd: fix compiler error
Change-Id: Idc4bcd902c02b5dbd6f5aac631f3977f257f606f
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-08-07 17:37:14 +08:00
Jon Lin b99d850cbd Revert "cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands"
This reverts commit 9671243e8d10defb06f2ea24fac138c87697d7fc.

Change-Id: Ie34f9feb06aa0525c9fa59d79ecf687a9a572491
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-08-07 17:37:09 +08:00
Jon Lin b62a0f65a9 Revert "cmd: mtd: fix compilation warning for help when SYS_LONGHELP=n"
This reverts commit a645831ca0962532660e4db3155a8be85e5ca312.

Change-Id: Ida32a1a893b88503cffe432705d5d02921dfab09
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-08-07 17:37:05 +08:00
Lin Jinhan e7b6c6a93f dm: crypto: add SHA512 test
Change-Id: If7bb7bb559a9d4d5e70e1f27eabb8995c85872d9
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2019-08-05 17:51:21 +08:00
Lin Jinhan 2061474232 cmd: Kconfig: CMD_CRYPTO select SHA512
when CMD_CRYPTO is enabled, SHA512 will be selected.

Change-Id: I2a4dfa1ed024b9a6cc39417836e45ee1309fdfa1
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2019-08-05 17:46:03 +08:00
Joseph Chen fbf99d9116 cmd: add "download" to enter rockusb/bootrom mode
Effect order: rockusb => bootrom.

Change-Id: Ie206f565e1c79e72c173c25f6970c93c8306332f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-01 10:05:41 +08:00
Adam Ford 1490eb89f4 UPSTREAM: Convert CONFIG_SPI to Kconfig
This converts the following to Kconfig:
   CONFIG_SPI

This partly involves updating code that assumes that CONFIG_SPI implies
things that are specific to the MPC8xx SPI driver.  For now, just update
the CONFIG tests.  This also involves reworking the default for
CONFIG_SYS_DEF_EEPROM_ADDR so that we don't set it when we cannot make a
reasonable default, as it does not cause any compile failures.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
(cherry picked from commit f1b1f77060beadbfe9f42a3be00019bd025afbd6)
Change-Id: Ie9f15ada869105eb407f41d4df7eecbaa916b940
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-07-23 17:15:32 +08:00
Christophe Leroy 87e4c6020e UPSTREAM: powerpc: mpc8xx: Change CONFIG_8xx to CONFIG_MPC8xx
CONFIG_8xx doesn't mean much outside of arch/powerpc/
This patch renames it CONFIG_MPC8xx just like CONFIG_MPC85xx etc ...
It also renames 8xx_immap.h to immap_8xx.h to be consistent with
other file names.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
(cherry picked from commit ee1e600c13d16febd517ab7d0d2c243db174789b)
Change-Id: I564708bb6517b699749e8a54c013d032f785e459
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-07-23 17:15:32 +08:00
Joseph Chen eae0a6b103 cmd: add command "android_print_hdr" support
This is useful for debug.

Change-Id: I6e56255d6e32e692031c6c3226d0dc041433dd48
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-07-22 19:24:57 +08:00
Joseph Chen 1476830723 cmd: bootrkp: clean up code
Change-Id: Ic76a6cabca67263a792eece7ecc7ee46e521ef97
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-07-19 11:29:56 +08:00
Hisping Lin b9a7e756c4 lib: optee_client: change the condition for eMMC devices
1.dev_desc->if_type == IF_TYPE_MMC for SD and eMMC device,
  dev_desc->devnum == 1 is SD devices,
  dev_desc->devnum == 0 is eMMC devices
2.SD devices do not have rpmb
3.we prefer to use rpmb for eMMC devices, use security
  partition for nand or SD devices

Change-Id: Ifc21bd4da7c3ee91e2ecc845c343182c78d52dc1
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
2019-07-15 17:06:52 +08:00
Quentin Schulz fb504314e8 UPSTREAM: cmd: mtd: fix compilation warning for help when SYS_LONGHELP=n
cmd/mtd.c:447:13: warning: ‘mtd_help_text’ defined but not used [-Wunused-variable]
static char mtd_help_text[] =
            ^~~~~~~~~~~~~

When SYS_LONGHELP is not defined. After looking at how other commands
work, we should surround the whole help text (even its declaration) with
an #ifdef CONFIG_SYS_LONGHELP, since it's compiled out when calling
_CMD_HELP[1] on the help text variable argument to U_BOOT_CMD.

[1] https://elixir.bootlin.com/u-boot/latest/source/include/command.h#L181

Change-Id: If84aae3167fd8826e33f717b7debefe32920dd0b
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit a645831ca0962532660e4db3155a8be85e5ca312)
2019-07-12 11:02:53 +08:00
Boris Brezillon b3d8fba6e0 cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands
It's way simpler this way, and we also gain auto-completion support for
free (MTD name auto-completion has been added with mtd_name_complete())

change-Id: I4292fde7affaddd8eb5a51fe8ec4265ae4984a21
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit 9671243e8d10defb06f2ea24fac138c87697d7fc)
2019-07-12 11:02:53 +08:00
Jason Zhu 65eeaea569 cmd: cmd_blk: rename the command mtd to mtd_blk
Since the command mtd is used in the file cmd/mtd.c, rename
the command mtd to mtd_blk.

Change-Id: I3a76aa8cc1da3f4b098f376d13fb0cdcf76ab246
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-07-09 15:06:41 +08:00
Patrick Delaunay ee9b3572a4 UPSTREAM: dm: spi: Read default speed and mode values from DT
This patch update the behavior introduced by
commit 96907c0fe5 ("dm: spi: Read default speed and mode values from DT")

In case of DT boot, don't read default speed and mode for SPI from
CONFIG_* but instead read from DT node. This will make sure that boards
with multiple SPI/QSPI controllers can be probed at different
bus frequencies and SPI modes.

Remove also use in boards of the value speed=0 (no more supported)
for ENV in SPI by using CONFIG_ENV_SPI_MAX_HZ=0.

DT values will be always used when available (full DM support of
SPI slave with available DT node) even if speed and mode are requested;
for example in splash screen support (in splash_sf_read_raw)
or in SPL boot (in spl_spi_load_image).
The caller of spi_get_bus_and_cs() no more need to force speed=0.

But the current behavior don't change if the SPI slave is not
present (device with generic driver is created automatically)
or if platdata is used (CONFIG_OF_PLATDATA).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Change-Id: I6f5990b73f33815a7acb9b5da9c90dce48b6211d
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit b0cc1b846fcb310c0ac2f8cbeb4ed5947dc52912)
2019-07-05 19:33:50 +08:00
Miquel Raynal f87151b325 UPSTREAM: cmd: mtd: add 'mtd' command
There should not be a 'nand' command, a 'sf' command and certainly not
a new 'spi-nand' command. Write a 'mtd' command instead to manage all
MTD devices/partitions at once. This should be the preferred way to
access any MTD device.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Change-Id: I68bcf4f0126c3a9d6ae0481dafcfcaab0506bd3f
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit 5db66b3aee6f2c057706d8715f7e5c472e82f047)
2019-07-05 19:33:44 +08:00
Jon Lin fe85de89e4 cmd: mtd: rename mtd.c to mtd_blk.c
Change-Id: Ie35d54afdbc0580af06805eca9f0db813db2dfe5
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-07-05 19:33:44 +08:00
Adam Ford 577968e566 UPSTREAM: Convert CONFIG_MTD_PARTITIONS et al to Kconfig
This converts the following to Kconfig:
   CONFIG_MTD_PARTITIONS
   CONFIG_MTD_DEVICE

Signed-off-by: Adam Ford <aford173@gmail.com>
Change-Id: I90c45c7716965009c00d18a19f5491f19b1ab8b3
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit 9c5b00973bceb7c0192bd6b03672d69b092700b4)
2019-07-05 19:33:40 +08:00
Masahiro Yamada 331c237568 UPSTREAM: mtd: nand: Rename nand.h into rawnand.h
This header was renamed to rawnand.h in Linux.

The following is the corresponding commit in Linux.

  commit d4092d76a4a4e57b65910899948a83cc8646c5a5
  Author: Boris Brezillon <boris.brezillon@free-electrons.com>
  Date:   Fri Aug 4 17:29:10 2017 +0200

      mtd: nand: Rename nand.h into rawnand.h

      We are planning to share more code between different NAND based
      devices (SPI NAND, OneNAND and raw NANDs), but before doing that
      we need to move the existing include/linux/mtd/nand.h file into
      include/linux/mtd/rawnand.h so we can later create a nand.h header
      containing all common structure and function prototypes.

Change-Id: Ia387c26297c268a449e3451c7adfabcd6417b278
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit 6ae3900a86b52429bf7a73ad832f0ad02acc2282)
2019-07-05 19:21:04 +08:00
Jason Zhu 06c1e1b3ae cmd: rockusb: fix usb serial number bug
Some special characters will be treated as a path in windows environment,
such as '\\' and '/'. If the usb upload its serial number with these
special characters, the usb drive will unwork. So use '_' to replace them.

Change-Id: Ic249316f2b03b0dcb73680078f122e23003e6e3d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-06-27 08:31:20 +08:00
Jason Zhu b75a3992f5 cmd: mmc: find current device first before find mmc device
Find the current device before find mmc device, otherwise '-1'
will be use as curr_device and error occur. The error log is
"MMC Device -1 not found".

Change-Id: Id6157f73d006f4bbe1c4d105244eb59ca7290c13
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-06-26 10:59:13 +08:00
Jason Zhu de8452aebf cmd: mtd: support mtd command
Change-Id: I5d5548e97535c6d928d2ff84f055de259577c11a
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-06-18 18:02:29 +08:00
Lin Jinhan 5d8287bf26 dm: crypto: support crypto v2 test
Change-Id: Ia6247f9d91780cebf7806a3c7fb606fe0a2de004
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2019-06-06 15:00:04 +08:00
Joseph Chen 2ba7147f80 env: add a common env driver for block device
The driver implementation refers to env/mmc.c, the storage media
binding to block layer can use it(Nand/Nor Flash...).

Support configure:
	- CONFIG_ENV_OFFSET
	- CONFIG_ENV_SIZE
	- CONFIG_ENV_OFFSET_REDUND (optional)
	- CONFIG_ENV_SIZE_REDUND (optional)
	- CONFIG_SYS_MMC_ENV_PART (optional)

Change-Id: Ibb16f0dd7af1331f454784968fbdc9002f4b769c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-05-24 11:35:28 +08:00
Joseph Chen cc6ac5d64f dm: add crypto uclass and cmd support
Change-Id: I2241c90aca9695cd28bb9ca2a220d0e1af8ca932
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-05-16 15:27:48 +08:00
Joseph Chen 94cf1096ee power: charge animation: fix cmd compile error
cmd depends on DM_CHARGE_DISPLAY and default y.

Change-Id: I5e685e0020c4aa1da80ffc27e5a576bc8969c3be
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-04-30 11:38:48 +08:00
Joseph Chen 6213b40154 cmd: CMD_DTMIG: select OF_LIBFDT_OVERLAY
Change-Id: I67d7040d477712169c815273dfaf913a4cf258e7
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-04-30 10:41:57 +08:00
Joseph Chen c5449fd30c dm: dvfs: don't print fail message when there is no device
Change-Id: I8ec8920972261e8009dfd9306d8ab898460a71df
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-27 08:59:47 +08:00
Joseph Chen 6e15146eff lib: sysmem: refactor code
- import memblk id to manage memory blocks;
- change "sysmem_property" to generic "memblock";
- use alloc instead of reserve for all memory blocks;
- clean up and fix some logic;
- add U-Boot cmd for sysmem;

Change-Id: I614223ce3bf97a7b3566412a9d1864fb30b68fd8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-26 11:04:33 +08:00
Shunqian Zheng 957c1cf2af usb: rockusb: Forbid data beyond 32MB reading
Simply return magic char if one is trying to read data beyond 32MB.

Fixes: 628c827 ("usb: rockusb: forbid reading data beyond addr 32MB")

Change-Id: If2cdf05dbf9d6dcdd4cf8f9605ab84480fbca32d
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
2019-03-14 19:24:48 +08:00
Andy Yan 4701d790f4 cmd: bootrkp: return CMD_RET_FAILURE on error
A cmd only returned with CMD_RET_XXX defined
by command_ret_t can ensure it work well when
called from shell.

Change-Id: I16e76ed62928380eaaf3c352efb4df9463b7e72d
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2019-03-08 16:50:55 +08:00
Hisping Lin f4e1db9544 lib: optee_client: add judgment of return value
Change-Id: If616f89ffb2c3ea30afb7bced56a1ca28b1232b2
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
2019-03-06 18:44:39 +08:00
Jason Zhu 562a66d432 cmd: fastboot: test the fastboot memory space availability
Use the sysmem to test fastboot memory is available or not.

Change-Id: I021152827b6948fabd5ea41e111ea20adf43167f
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-03-05 11:19:41 +08:00
Jason Zhu 628c827194 usb: rockusb: forbid reading data beyond addr 32MB
Forbid reading data beyong addr 32MB to protect user data & firmware. Excess
partial is filled with 0xcc. The addr 32MB is quoted from pre-loader.

Change-Id: I96f4fb3bb0d88a309fef20650863011cd9f0dfd9
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-02-25 17:14:46 +08:00