It helps check whether uncompress kernel overlap with other region
or not.
Change-Id: Ia7e6c027f68c2e8af398824afd8b7580531cb77e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Because avb android image usually needs a large memory buffer,
always alloc avb android memblk right after U-Boot stack is a
better choice to avoid memblk overlap with others.
Since we have overflow protect magic for U-Boot stack, so we add
a pad(4KB) between them.
Change-Id: I72655d022f7e82f1ed9fbb381424d04bc86ccf6a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
We can not call some drivers if this driver is closed. But this time we use
the parameters passed by atags directly but not test the drivers whether
exist. Add it.
Change-Id: I857ccf3b3e23a9e92502868d1514849770390ebb
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Add sdupdate variable to receive card function info from preloader atags.
If the sd card is updated-card, set sdupdate to bootargs. otherwise test
whether the sd cart is ROCKCHIP_SD_UPDATE_CARD or not by rkimgtest cmd.
Change-Id: I6c09ade4a31a2e4c8349245e9e345f735afd11e9
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
We should parse node name to identify the gpio port before
reading base address, it avoids to use miss match address.
Move out gpio_parse_base_address() from sub string parse is
better.
Set gpio as input mode before reading.
Change-Id: Iffd4ef7f3ceb1bb56a65680265af74ca50b14712
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Add cd-gpios to test the mmc device whether exit.
Change-Id: I8ab96fd5300da25d82005ac638e6d2b728ed82ce
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
After switch to io_vsel3 after system power on, we should release
GPIO0_A4 for other usage.
Change-Id: I16bc33fd976fe957b57cd3a0f90ff44659ca93f2
Signed-off-by: Yu YongZhen <yuyz@rock-chips.com>
It is optional to use dtb from distro images to initialize
periph drivers when kernel dtb function is enabled.
Change-Id: I7119962ba61d84c5ccdf2e515e21bb347e50b91b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Use different name for the volume up key node, dm framework
can't support the same device node since kernel dtb is enabled.
Change-Id: Ia99c9b8fd46fea63949f9d06072c0ebec0e76a46
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Default boot from sdcard may fail in evb without sd.
Change-Id: Ifde49b6b28e7154a14f5e028d9863446f11cb59c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
RK3368 uart2 iomux config is not correct, fix it.
Change-Id: I992c4b0ae9d8c0a91c5ee1fb3e7850a1e94db206
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Enable the exception handler for async error so that we can get the
abort before kernel.
Change-Id: Ie0e7c89a0d03adf3b74b0d9ddf8c9117536dac6b
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
TPL need dmc to init ddr sdram, and emmc, boot-order.
Change-Id: Ia783e1a47a7710bf618c556eefaf354b7097eacd
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
We always try to init stimer in case it's not init in previous stage,
but don't re-init if it already work.
Change-Id: I2133804560c6e31e51e6b2cb0a6e51b9544970d3
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
The arch_cpu_init() should be done in SPL only.
Change-Id: If96bad9694dbcb0d9821433d1f2cbead4517633c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
arch_cpu_init() may use DM to get cru handler.
Change-Id: I5f2daa4718bcdcc5a4aa5601d26e9f4f31a01b69
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
- 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>
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>
The uart, dmc and grf device add "u-boot,dm-pre-reloc".
Before relocated, u-boot will analyse dram capacity which
is need the device of "u-boot,dm-pre-reloc" attribute.
Change-Id: I1d18b564b0c521b176a2293a03403139034ccc0b
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
Add cd-gpios to test the mmc device whether exit.
Change-Id: I171f4c0d895baf1a1b54c971fc88370a0b10ce3a
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Add cd-gpios to test the mmc device whether exit.
Change-Id: I6a07ff130e506678a20e5128ef4c8e608e0ec448
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Add cd-gpios to test the mmc device whether exit.
Change-Id: I3d4839180b36de22ce1e5f2b26c9090b0686a8a0
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Add cd-gpios to test the mmc device whether exit.
Change-Id: Ie1cfffe0f7826eae47fab705d3a3bb7d1a85f8ce
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Since atags is passed between so many pre-loader, it's better
add hash check for tag.
It compatibles with legacy code and tag data, because 'hash'
is reserved field in old tag data.
Change-Id: I18b4c46f75b2c5a50194c23576e6f1437c83ccf5
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
enter recovery mode when recovery key is pressed but usb is absent.
Change-Id: I4e29d657e6c42f04db1076a2eaed23974e375404
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
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>
- ctrl+b: enter bootrom download mode, ('b': bootrom);
- ctrl+d: enter rockusb download mode; ('d': default download, ie. rockusb);
This patch provides convenience for download when rockusb/recovery-key is
absent or not work, or U-Boot early panic.
Change-Id: I7709183c645400f60af3d480f84f6e6887ddc20e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
It fixes the dead loop issue of "bootrkp" command:
......
=Booting Rockchip format image=
boot: invalid image tag(0x0)
boot_rockchip_image ramdisk part boot read error
bad resource image magic:
DTB: rk-kernel.dtb
invalid entry tag
invalid entry tag
invalid entry tag
invalid entry tag
......
Change-Id: Ia15f315eee94dce06800139ff547ebeee3847cae
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Without this patch, the irq context get the irq_lr and irq_sp
which doesn't make any sense, what we need are svc_lr and svc_sp.
Change-Id: I4c07e3688e818cd4516824a78d57ff092fdbe2b9
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Currently, usb 2.0 otg node was found by the compatible
"snps,dwc2" and the property "dr_mode". However, the
"dr_mode" isn't a necessary condition, more seriously,
if the dr_mode is set to "host" or "peripheral", we
will fail to get the otg node.
This patch finds otg node by the compatible "snps,dwc2"
for most of Rockchip SoCs supported only one DWC2 controller.
For RK3288, it supports two DWC2 controllers with the
same compatible "snps,dwc2", so we add another condition
(reg addr = 0xff580000) to get the otg node.
Change-Id: I16acbf3e8da9bec19b8ec0a331b9114cb5462ac0
Signed-off-by: William Wu <william.wu@rock-chips.com>
Add the phy regulator supply for rv1108-evb, and fix the
configuration of clock_in_out.
But the phy will init failed because the phy-reset pin is
the same as the mipi data pin.
Change-Id: I14b0accd083742ca6eb4ae6bec1139ef5ba65db0
Signed-off-by: David Wu <david.wu@rock-chips.com>
Add the SCLK_EMMC_DRV and SCLK_EMMC_SAMPLE to clocks.
Change-Id: I3c633bd973bb1f5cafb98a295ded6cfae704382d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
sysmem avoids memory block overlap with each other.
Change-Id: I0013c3d05c69e19286cf1c76f936a17eaab1db49
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
clean up code and add comment for other interfaces.
Change-Id: Ibc64978d8db595c4fe76432faca77cdad9c949e6
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
sysmem provides a mechanism to avoid memory block overlap with
each other.
Change-Id: I84796f4fd5b06283ca23e0ec9da9d0421701a957
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
using param_parse_atf_mem() and param_parse_optee_mem().
Change-Id: I0d42f80ea4bac61efdc38a0be97c3f416ce90622
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
parse: atf/optee/bootdev and common reserved memory.
Change-Id: I829eb42370b217e567cdafe03de4dab6063aa251
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
RK3288 sram size can be used for TPL is 32768
Change-Id: I1b0ae5209d97f59b53349f6787439090539a5ac0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Currently RV1108 run in 1.2G GPLL.
NANDC need 1200 / 8 div = 150MHz.
SFC need 1200 / 12 div = 100MHz.
Change-Id: Ia3f401b0cf13587209d0d68d76a9891dd3bcf990
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
The usb vbus detection is depend on the usb2 phy driver.
This patch fix the usb vbus detection issue if there is
no valid kernel dtb, and make rockusb to enter download
mode successfully.
Change-Id: Icf86cfaf67e20f2368370eb2aedc4fa9d5777c50
Signed-off-by: William Wu <william.wu@rock-chips.com>
This patch increase the qos priority of perilp_nsp from
2 to 3 for USB 3.0 controllers.
Change-Id: I813f9190cc894ac15452686aa68d187200be3888
Signed-off-by: William Wu <william.wu@rock-chips.com>
rockchip_u2phy_vbus_detect() may return negative number when driver
not implemented, only positive number means vbus available.
Change-Id: I06e9b36c7bbcdbb097abe204f4ff0318541ea869
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Select rk3399-sdram-lpddr4-100.dtsi to initialize LPDDR4
at 50MHz, it will change clock frequency to 800MHz
after initialization is complete.
Change-Id: I803ed2c809f17bbea40f379194bce548adc338ea
Signed-off-by: YouMin Chen <cym@rock-chips.com>
Add support dram capacity detect.
Select dram timing file base on dram type and clock frequency,
don't need care dram capacity.Dram capacity will auto detect.
Change-Id: I0554a0ec0c753a159406330aa0baa2daafe7ab93
Signed-off-by: YouMin Chen <cym@rock-chips.com>
Add commond code about rockchip dram init,include print dram info,
capacity detect,config msch timing,config os_regs and so on.
Change-Id: Ie4223dac31bde290d19627c96088542fcdd5521d
Signed-off-by: YouMin Chen <cym@rock-chips.com>
Only ARM and in some configs MIPS really implement arch_fixup_fdt().
Others just use the same boilerplate which is not good by itself,
but what's worse if we try to build with disabled CONFIG_CMD_BOOTM
and enabled CONFIG_OF_LIBFDT we'll hit an unknown symbol which was
apparently implemented in arch/xxx/lib/bootm.c.
Now with weak arch_fixup_fdt() right in image-fdt.c where it is
used we get both items highlighted above fixed.
Change-Id: Iaac96fbb0bcc484906952ced132b10b2cead782e
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.
This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h
and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>
Change-Id: I6c0f7e50e8b571106627f25ddac008a62bd2994e
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
verbose "Bootdev(atags):" if bootdev is from preloader atags, otherwise "Bootdev:"
Change-Id: Ib02a1f6deea330bf33aca60f752a3006a48bc3ac
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
use hdmi_ddc instead of i2c5 for read edid.
Change-Id: Ie2efcf99a50bb7cdb68eaa4b8c3a783a743e758e
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
fix current leak due to wifi_26M clk enable by default
Change-Id: I53cb7fbfa49a0cda29834bb2e2871aedde6b7d15
Signed-off-by: Weixin Zhou <zwx@rock-chips.com>
some platform which is not determined to enable bl32,
we had better choose kernel load address dynamically in
order to make full use of memory for kernel.
Change-Id: If5c15a3755dabfff8d3cce8dec38c9215c464ed2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
According to kernel: Documentation/arm64/booting.txt introduce:
NOTE: versions prior to v4.6 cannot make use of memory below the
physical offset of the Image so it is recommended that the Image be
placed as close as possible to the start of system RAM.
We shall remain ARM64 relocation to avoid ram overlap between uboot
and kernel.
fixes: 9841897eb9
(arm: rockchip: select SKIP_RELOCATE_UBOOT)
Change-Id: I6b092e979c9f365ca9d9b9dbb8b4e7afbf864d6e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This dmc code is prepare for ddr test tool to scanning ddr freq,
normal firmware no need to enable it.
Current version only support PX30/RK3326 and RK3328/RK3228H,
CONFIG_ROCKCHIP_DMC=y to enable it
Change-Id: I25360846bb5af74eb82bdc6e64bdaa2d55ab0f64
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
there is no necessary reason to do uboot relocation, and actually
it brings trouble for our debug at some time, so skip it.
Change-Id: I56567a6ff13c8431e7e1773652826692ec0e6c9e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
If SDMMC0_DET pull low gpio1_d4/d5 mux as sdmmc functions, otherwise
they mux as JTAG or UART. But the jtag_force(grf_cpu_con1[7])
is enable after reset.
This clear force_jtag mode to enable uart4 when SDMMC0_DET is high.
Change-Id: I2a2dadaad7dc2df8de3b43ff47d27d266caca62f
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
It makes rockusb works normally even there is no valid kernel dtb.
Change-Id: Ie7a125450de1b9394ed5c17fc5a0df3239e203d6
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
It makes rockusb works normally even there is no valid kernel dtb.
Change-Id: Ic2996614b9cddc1835b079c2e7ac784daa99ad3e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This is a debug message to know if we use kernel dtb.
We have already got this info from "DTB: rk-kernel.dtb",
so remove it.
Change-Id: I28e29e43aa818ac61c9864b94bd80ceb85fc9c3a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
It makes rockusb works normally even there is no valid kernel dtb.
Change-Id: I7f17bda7fdd841135d0ab0392db58cfc65cc7f5e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
It makes rockusb works normally even there is no valid kernel dtb.
Change-Id: Icdb2f9611d25525bbe15d4aafb9120e31e749af2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
For cpu_vdd default voltage enough to support cpu frequency to 1.2GHz,
so set rk1808 default cpu frequency to 1.2GHz.
Change-Id: Ia8a888ee79ab3ae3868790bcc1851552acf90086
Signed-off-by: Lin Huang <hl@rock-chips.com>
Add api soc_is_xxx for soc variants distinguishing.
Most of them borrowed from linux kernel
include/linux/rockchip/cpu.h.
Change-Id: Ifb932c022ffdf001b64979fe2554452f0d480e88
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
The output directory is not the same for different build system,
let's get it from environment.
Change-Id: Ifa05c9bc09d5b609d16bcbed767bccd3c2bbaa38
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
The U-Boot and OP-TEE load&entry address may not the same for
different SoCs, so we need a script to adapt it.
Change-Id: Id5418aa8ac8b35045be9310f317a73e7c24d7518
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
rk3288 is going to enable trust(OPTEE), which pack in FIT image.
Change-Id: Ic8872b4b6cb68d321c6996fde1b3e4083ef3b6da
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
rk3288 is going to use TPL+SPL as preloader.
Change-Id: I2c712564b7c3b4d7c826bda09135f7188b0abc22
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Ramdisk is a compressed image and it expands after descompress, which accesses
768MB+ memory and brings "Unable to handle kernel paging request at virtual address ...".
We make a appointment that the highest memory is 512MB, it makes lmb alloc safer.
fixes: 2c6a058b7e
(rockchip: implement board_lmb_reserve())
Change-Id: I728a1fbff216194b940372713387cf171028b20b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
- preloader would pass bootdev info;
- avoid going through all the possible bootdev;
- rename devtype_num_envset() to boot_devtype_init();
Change-Id: Ia047c744dc7aca97db97664fc92473e46ba102a9
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Init gd to NULL in case someone using it.
For example, below patch using gd in debug_uart_init:
064eb49314 serial: ns16550: support using pre-loader serial
Change-Id: Iee71dc8bc9168a0364598a3b4027807cba522594
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
it makes users easy to override their kernel dts when
CONFIG_USING_KERNEL_DTB is disabled.
Change-Id: If794a5d3e8be334e81519d5bd69f97062db4b208
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
it makes users easy to override their kernel dts when
CONFIG_USING_KERNEL_DTB is disabled.
Change-Id: Id038494e1cbd1c63afa3397e64cb60f981aa0509
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Avoid "bad magic" report in case that new atags magic has been
added in preloader but U-Boot not.
Change-Id: Id144bd7ae3245323f792bd5fe5d4e0cdef15ea22
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Using last bi_dram[...] to initialize "bootm_low" and "bootm_mapsize".
This makes lmb_alloc_base() always alloc from tail of sdram.
If we don't assign it, bi_dram[0] is used by default and it may cause
lmb_alloc_base() fail when bi_dram[0] range is small.
Change-Id: I13c2c2d6135e26e647dcfde4c173d896c800fea5
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Rockchp platform suppose to use TPL(run in SRAM) as dram init and
SPL(run in DDR SDRAM) as pre-loader, so that the SPL would not be
limited by SRAM size.
Change-Id: Ib4115dbf6679fd4649e694d069a6489346112a97
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Add spl-boot-order to boot from both EMMC and SD.
Change-Id: I7975a6faa79ad5a536faccac33ed6b342f99dc3f
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
rockchip_setup_ddr_param use to write ddr param to
a known place for trustos.
Change-Id: Ied4636d5e709ed036a45434202d99e916a5f1dcb
Signed-off-by: YouMin Chen <cym@rock-chips.com>
follow other platforms name style, like: rkxx-u-boot.dtsi
Change-Id: Ic05c37bf49daad1c531c07f7d82abde4a485e432
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Correct sdmmc and emmc base addr for rk322x.
Change-Id: I1a05fa5a477924c2ae829e7094f81766db41e95c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>