Commit Graph

17079 Commits

Author SHA1 Message Date
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
Jason Zhu 813227ad54 lib: avb: add init ab metadata interface
Change-Id: Ifad6c8ca70568c2dc8eea0a4ead23e3e7a2a0e74
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-04-29 11:05:35 +08:00
Yu YongZhen f992fe3334 clk: rockchip: rk3308: Make DCLK_VOP clock id consistent with kernel
Change-Id: I3e5b042a5e7b4bd4a7724451b30cfa9601955541
Signed-off-by: Yu YongZhen <yuyz@rock-chips.com>
2019-04-16 09:06:52 +08:00
Elaine Zhang 6b5ade5a57 clk: rockchip: rk1808: fix up the clk_set_default failed
Change-Id: If49d6def0e16b93238311885217f30a4b7a2e7c3
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-10 12:04:10 +08:00
Joseph Chen 5a54baa793 dm: key: refactor code
- use standard dm framework to implement all key drivers;
- all key node to be children and attach to key bus;
- dm key uclass takes over most work;
- reduce a lot of driver code size;

Change-Id: I9ea4515249d493eb4434890b90350f694c07404f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-04-09 10:54:14 +08:00
Joseph Chen 4388deca72 dm: add amp uclass and rockchip amp driver support
- add amp uclass;
- add a simple rockchip amp driver.

An example for amps dts node configure:
amps {
	compatible = "uboot,rockchip-amp";
	status = "okay";

	amp@0 {
		description  = "mcu-os1";
		partition    = "mcu1";
		cpu          = <0x1>; // this is mpidr!
		load         = <0x800000>;
		entry        = <0x800000>;
		memory       = <0x800000 0x400000>;
	};

	amp@1 {
		......
	};

	......
};

U-Boot loads "mcu-os1" firmware to "0x800000" address from partiton
"mcu1" for cpu[1], the cpu[1] entry address is 0x800000. And
U-Boot reserve memory from 0x800000 with 0x400000 size in order
to make it invisible for kernel.

Please use rockchip tool "mkkrnlimg" to pack firmware binary, example:
./scripts/mkkrnlimg mcu-os1.bin mcu-os1.img

Change-Id: I127d5d9f460ec0c1812a76fb4c3702e82f21c9a6
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-04-08 20:53:44 +08:00
Shengfei Xu ba76dc003e power: pmic: rk8xx: enable under-voltage protection to rk817/rk809
The under-voltage protection will shutdown the LDO3 and reset the PMIC.

Change-Id: Ic84c7ad1a2eed8c1f983e761988ffb903fc878af
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
2019-04-02 19:09:07 +08:00
XiaoDong Huang 1380460aee rockchip: rk3368: Use timer0 as timer_irq
Change-Id: I75ee18ee55207ead6a30d588529e7363fe361009
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2019-03-29 10:39:22 +08:00
Kever Yang 1d0603dbce rockchip: px5: update SPL size for spl/tpl
Change-Id: I447976f9030a59f18393027e8392a065d4c6c425
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2019-03-26 16:13:09 +08:00
Joseph Chen 32c868cf11 common: android: add hotkey for sysmem and bidram dump
Change-Id: Ic866dcc2b160ebd92d518e517e0bc8870aec84d0
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-26 11:04:33 +08:00
Joseph Chen da051cc8bb rockchip: add ctrl+f hotkey to enter fastboot mode
Change-Id: I1f0a98793307b5a261958fe8c29da3271f2d8e4e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-26 11:04:33 +08:00
Joseph Chen 483d049321 lib: introduce bidram for GD board bi_dram[] memory management
Some platform provides more than one dram banks and reserved firmware
regions (eg. ATF, OP-TEE, etc) by pre-loader dynamically. It means
there are memory holes in board dram layout. What's more, U-Boot will
reserved regions at the late bootflow(eg. firmware reserved for AMP).

So we introduce bidram mechanism to manage GD board bi_dram[], which
provides a way to easily manage memory holes and update bi_dram[]. It
dpends on LMB which provides a good algorithm to manage memory blocks.

What's different from sysmem?
- bidram manage and pass the avaliable memory blocks to kernel;
- sysmem is only for U-Boot memory management to avoid ram overlap,
  it doesn't matter about kernel avaliable memory.

Change-Id: I697cbb80bdc961e4ad5ab94548e2dc93feefde6f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-26 11:04:33 +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
Joseph Chen 88bfa97963 include: add memblk.h
Provide generic id and struct for memory blocks.

Change-Id: I1fe00dfdb8ee8209eca55c8e7ebbedcafa0371a1
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-26 11:04:33 +08:00
Joseph Chen a78c73bb66 include: lmb: increase MAX_LMB_REGIONS to 16
Maybe 8 is not enough.

Change-Id: Idc4813fa406def5401fdf423cdf30d47555d1a92
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-22 09:46:06 +08:00
Zhihuan He e5f393836b driver: ram: rv1108: use common code to setup ddr parameter
use rockchip_setup_ddr_param to setup ddr parameter.
The dram_init() and dram_init_banksize() make use of
sdram common code.

Change-Id: Icfc6cbef9fcc128e3a835184b46b89b9b22aab16
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2019-03-22 09:00:32 +08:00
Hisping Lin b4a0434fc9 lib: optee_client: do not init RK FS if security not exist
Change-Id: I91e780448cee7884c7477cb0b5720f962b2df00d
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
2019-03-15 15:28:38 +08:00
Joseph Chen dd9ee2cc6f rockchip: rk3368: correct MMU ram map size
Change-Id: I4884a88613fe5c2fa515360d4c754f4eade84ed3
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-08 17:41:06 +08:00
Jason Zhu 1f670f7cc9 lib: avb: get public key by atags
Change-Id: I0d77229585263e81e8be4f5c67a02080c07b0e55
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-03-08 15:32:09 +08:00
Jason Zhu 9b83ce70a9 lib: avb: add get&set perm-attr cer
Change-Id: I89d3a30f43659ae8c9d107ede5db1590b022440d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-03-08 15:32:09 +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 7cca3dd4d7 lib: avb: support last boot
Change-Id: I803e3deda068be34061a302c27009db5e444f290
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-03-06 17:16:13 +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
Joseph Chen 269512fdf6 irq: clean up code
- using IRQ_X() to print message;
- update some comment;
- rename some function;
- add more strict irq sanity;

Change-Id: If5432818d4bc12fc1aa0b8aca6898bbf79dfa9fb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 14:29:34 +08:00
Joseph Chen ebe3d004b5 power: charge animation: clean up code
Change-Id: I0d76d7ad28ef3683bbc78f36d4a0f00d5517e2fa
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 14:29:33 +08:00
Elaine Zhang 47bc0dad56 rtc: add rk8xx rtc support
support rtc alarm interrupt and alarm trigger power up.

Change-Id: I7752f173d524f579b57b862d2788296ab1486c14
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-02-25 10:08:47 +08:00
Joseph Chen 8696cc3875 irq: add irq busy validation
return -EBUSY when this irq is occupied.

Change-Id: I75ad6c0b13e167762cab2b8f9a2b786e588b2ade
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 09:59:46 +08:00
Wyon Bi cfb50d9acf media: Add MEDIA_BUS_FMT_RGB666_1X7X3_JEIDA media bus code definitions
This patch adds a new RGB media bus formats that describe
18-bit samples transferred over an LVDS bus with three
differential data pairs, serialized into 7 time slots,
using standard JEIDA data ordering.

Change-Id: I54b674aa8b067452007de076010dbd6a3c7f4a52
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-20 09:14:12 +08:00
Joseph Chen 2c9d117912 sysmem: fdt: reserve more CONFIG_SYS_FDT_PAD size for fdt
Sometimes, framework or user would call fdt_increase_size() to update
fdt size, it's better reserve more space to avoid sysmem gives the fdt
region overflow report.

The CONFIG_SYS_FDT_PAD default value is sync with bootm framework
in: common/image-fdt.c

Change-Id: I363e9a4182e13b1628a76666acd8272d25db659d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-19 14:37:36 +08:00
Wyon Bi 1953e61947 video/drm: Sync MIPI DSI Bus helper from Linux 4.9
This imports drivers/gpu/drm/drm_mipi_dsi.c from Linux kernel 4.9.
It can be very helpful when porting Linux mipi dsi driver to U-Boot.

DSI hosts expose operations which can be used by DSI peripheral drivers
to access associated devices.

Change-Id: Iccfa9d946f33458867f4d4db0ce04aeb1918e855
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-15 11:37:45 +08:00
Wyon Bi c5bb939d42 include: mipi_display: Add new DCS commands in the enum list
Adding new DCS commands which are specified in the
DCS 1.3 spec related to CABC.

Change-Id: I42aeb4189f3444a8387a868ae25c8518a2f8d596
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-15 11:36:36 +08:00
Joseph Chen 13f190efec console: add console event key definition and gd->console_evt
"console event" is similar to some hotkey event(mainly long press),
we can make something triggered by hotkey.

Change-Id: I845d9820997b4a90d55c9575e424b0eaafbc7b0c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-15 09:04:24 +08:00
Hisping Lin df99e5808c cmd: add test case for secure storage
1.mmc testsecurestorage to test secure storage
2.test secure storage in rpmb and test secure storage in
  security partition when use emmc
3.test secure storage in security partition when use nand

Change-Id: Id6f72893c002c5040cb1790051c9685911878df7
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
2019-02-14 19:58:09 +08:00
Joseph Chen d0df954bf3 arm: lib: add arm32/64 stacktrace support
This patch supports dump arm32/64 stacktrace as the format of raw
address info. The U-Boot symbol table is not available now, please
use ./scripts/stacktrace.sh script to parse stacktrace info with command:

    ./scripts/stacktrace.sh <file>       // stacktrace info file

Example on RK3399:
    Call trace:
     PC:   [< 00258a7c >]  dwc3_gadget_uboot_handle_interrupt+0xa0/0x5bc
     LR:   [< 002052f8 >]  usb_gadget_handle_interrupts+0x10/0x1c

    Stack:
           [< 00258a7c >]  dwc3_gadget_uboot_handle_interrupt+0xa0/0x5bc
           [< 0025bd6c >]  sleep_thread.isra.20+0xb0/0x114
           [< 0025cf58 >]  fsg_main_thread+0x2c8/0x1814
           [< 0020db58 >]  do_rkusb+0x250/0x338
           [< 00226a00 >]  cmd_process+0xac/0xe0
           [< 00212df4 >]  run_list_real+0x6fc/0x72c
           [< 00212f94 >]  parse_stream_outer+0x170/0x67c
           [< 002126e0 >]  parse_string_outer+0xdc/0xf4
           [< 00212bb0 >]  run_list_real+0x4b8/0x72c
           [< 00212f94 >]  parse_stream_outer+0x170/0x67c
           [< 00212698 >]  parse_string_outer+0x94/0xf4
           [< 00225f30 >]  run_command_list+0x38/0x90
           [< 00202d08 >]  rockchip_dnl_mode_check+0x4c/0xd4
           [< 00202db0 >]  setup_boot_mode+0x20/0xf0
           [< 00203010 >]  board_late_init+0x10/0x40
           [< 0027071c >]  initcall_run_list+0x44/0x80
           [< 00213d68 >]  board_init_r+0x20/0x24

The "dump_stack()" is available to trigger stacktrace.

Change-Id: Ib1423269dd255fa4a34231489cd3b7e6ddd22540
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-13 09:04:23 +08:00
Elaine Zhang 5561190119 clk: rockchip: rk3288: add clk_set_default
support aclk_vio\hclk_vio clk setting.

Change-Id: Ie826c770670598161f22208f504d8762b8597811
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-02-01 16:17:34 +08:00
Shengfei Xu 9e9e0e07b5 power: pmic: rk8xx: save PMIC_POWER_EN register for rk817/rk809
rk817/rk809 must restore the PMIC_POWER_EN OTP value before the system reboot.

Change-Id: Ia62cb8f5b0dc9fef8a32a3af5f087c55a9888d78
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
2019-02-01 10:31:28 +08:00
Tony Xu 9780bd18ce common: write keybox: Add readback check interface
Change-Id: Ic020bd7e80869c2e3096637fce0adced654d3ce4
Signed-off-by: Tony Xu <tony.xu@rock-chips.com>
2019-01-31 11:08:44 +08:00
Joseph Chen 8e66ecd25d android: fix get wrong ramdisk address when avb verify
- add interface to get android avb enable state;
- get ramdisk from "ramdisk_addr_r" only when android avb disabled
  and CONFIG_ANDROID_BOOT_IMAGE_SEPARATE is enabled;

(fixes: 644e344 android: support loading android image separate)

Change-Id: I7280f911a0c5db851d119acb458b3f335dc28bce
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-30 16:51:22 +08:00
Jason Zhu 726087de6e crypto: support rockchip hardware crypto
Support: rsa & sha algorithm
Usage: Set CONFIG_RK_CRYPTO to enable rk crypto.

Change-Id: I2b6a920308fcdf46481bcf38fc6be532a02255bd
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-01-28 20:42:54 +08:00
Jason Zhu 564654eb9c lib: optee_client: add read&wite permanent attributes certificate
Change-Id: I83321afcf9d89b0cde0bcc78f1f02c847f85a115
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2019-01-28 20:42:54 +08:00
Joseph Chen f36a2342cd rockchip: board: move charge display function to charge display uclass
Change-Id: Ib5143d8bd9beafc585438e57216f2b7c17932859
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-24 15:44:08 +08:00
Joseph Chen a384e3f1db common: image-fdt: add boot_fdt_add_sysmem_rsv_regions()
It reserves fdt reserved memory for sysmem.

Change-Id: I7ce1be9bd25a3609bc6dabdc265addbd2571076c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-24 15:33:12 +08:00
Joseph Chen ffa8f8b76e lib: introduce sysmem for permanent memory management
U-Boot provides MALLOC for runtime temporary memory management and
LMB for bootm memory management. There is not a mechanism for permanent
memory management. so that the memory blocks are easy to overlap with
each other.

What does permanent memory mean ?
 - The memory can't be touched by U-Boot(ATF/OPTEE/SHM/kernel-reserved, etc);
 - The memory occupied even in kernel, such as some firmware load buffer;

This patch introduces sysmem to do permanent memory management, which
implements base on LMB. It provides memory block (pool):
 - init;
 - add;
 - alloc;
 - free;
 - reserve;
 - stat;
 - overflow check;

Here is an example for RK3399 sysmem boot stat(assume the "fdt" region is Overflow)
called by sysmem_dump_all():

sysmem_dump_all:
    ------------------------------------------------------
    memory.rgn[0].base     = 0x00000000
                 .size     = 0x00000000
    memory.rgn[1].base     = 0x00200000
                 .size     = 0x08200000
    memory.rgn[2].base     = 0x0a200000
                 .size     = 0x75e00000

    memory.total           = 0x7e000000 (2016 MiB. 0 KiB)
    ------------------------------------------------------
    reserved.rgn[0].name   = "ATF"
                   .base   = 0x00000000
                   .size   = 0x00100000
    reserved.rgn[1].name   = "PSTORE/ATAGS/SHM"
                   .base   = 0x00100000
                   .size   = 0x00100000
    reserved.rgn[2].name   = "OP-TEE"
                   .base   = 0x08400000
                   .size   = 0x01e00000
    reserved.rgn[3].name   = "U-Boot"
                   .base   = 0x71be03c0
                   .size   = 0x0e41fc40
    reserved.rgn[4].name   = "secure-memory@20000000"
                   .base   = 0x20000000
                   .size   = 0x10000000

    reserved.total         = 0x2041fc40 (516 MiB. 127 KiB)
    ------------------------------------------------------
    allocated.rgn[0].name  = "fdt"      (Overflow)
                    .base  = 0x01f00000
                    .size  = 0x00009704
    allocated.rgn[1].name  = "kernel"
                    .base  = 0x0027c000
                    .size  = 0x0129da04
    allocated.rgn[2].name  = "ramdisk"
                    .base  = 0x0a200000
                    .size  = 0x001e6c04

    allocated.total        = 0x0148dd0c (20 MiB. 567 KiB)
    ------------------------------------------------------
    LMB.reserved[0].base   = 0x00000000
                   .size   = 0x00200000
    LMB.reserved[1].base   = 0x0027c000
                   .size   = 0x0129da04
    LMB.reserved[2].base   = 0x01f00000
                   .size   = 0x00009704
    LMB.reserved[3].base   = 0x08400000
                   .size   = 0x01fe6c04
    LMB.reserved[4].base   = 0x20000000
                   .size   = 0x10000000
    LMB.reserved[5].base   = 0x71be03c0
                   .size   = 0x0e41fc40

    reserved.core.total    = 0x218ad94c (536 MiB. 694 KiB)
    ------------------------------------------------------

Change-Id: If63b7abed2cdd3c054719511fcceed733ddf606d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-24 15:33:12 +08:00
Joseph Chen 47ad810789 rockchip: rk1808: enable GICV3
Change-Id: I47a459e2408a7a56794cf7f72ff58a616100b7eb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-23 21:17:03 +08:00
Chen Jinsen 2a987bff2b configs: rk3288: enable avb for Android P
Change-Id: Ie06e7b32dcb49dbf385148a4b4414a2c5fefb36f
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
2019-01-22 17:06:47 +08:00
Zorro Liu 2dfbc57d3a configs: rk3368_defconfig: enable avb for rk3368
Change-Id: I5180c70ef3cc4c1a091f1247ef0c4c4ba3800ed7
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
2019-01-22 16:59:11 +08:00
Joseph Chen b0df67a8f7 include: rk3188: move fdt to 131M and ramdisk to 162M
It avoids fdt overlap with large boot.img/recovery.img, moving
fdt ahead of boot.img/recovery.img and moving ramdisk backward
is safer.

Change-Id: I362ff778dbdae42e667dcfc054dc1a0f5e06aa6c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-21 16:05:09 +08:00
Joseph Chen e8f1e17334 include: rk3128: move fdt to 131M and ramdisk to 162M
It avoids fdt overlap with large boot.img/recovery.img, moving
fdt ahead of boot.img/recovery.img and moving ramdisk backward
is safer.

Change-Id: I229d5a996c445c1f956e51f0b35e43aa48cbcd1c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-21 16:05:09 +08:00
Joseph Chen 1b0a5f9d2c include: rk3036: move fdt to 131M and ramdisk to 162M
It avoids fdt overlap with large boot.img/recovery.img, moving
fdt ahead of boot.img/recovery.img and moving ramdisk backward
is safer.

Change-Id: I6445227d6e36c4625a0c6badaf00c0cad0c9211c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-21 16:05:09 +08:00
Joseph Chen 8dc327b1d8 include: rk3066: move fdt to 131M and ramdisk to 162M
It avoids fdt overlap with large boot.img/recovery.img, moving
fdt ahead of boot.img/recovery.img and moving ramdisk backward
is safer.

Change-Id: Ida5470874e8373026112236db59d30ebd9c58f37
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-21 16:05:09 +08:00