[U-Boot] How to re-use the driver data for pre-reloc in post-reloc driver

Kever Yang kever.yang at rock-chips.com
Wed Dec 13 04:35:41 UTC 2017


Hi Simon,

     This is not the topic about disable the relocate feature in U-Boot 
proper.

My target is re-use kernel dtb in U-Boot and U-Boot can work properly 
even if
some of dts node in kernel is broken.
- U-Boot mark a set of driver as u-boot,dm-pre-reloc, suppose to able to get
    into U-Boot shell with them. dram, syscon, serial, clock, pinctrl, 
emmc, and etc.
     In this case we can always make U-Boot works and get into shell.
- When relocate, I would like to read dtb from kernel and use it for 
U-Boot driver.
     In this case, we can get periph driver setting for different board 
from kernel dtb,
     what we need most are: power/pmic, display, charger, input key and etc.

The problem is, the dm architecture now always init all the driver from 
dtb after relocate,
If anything missin in kernel dtb, the U-Boot hang there. What I met now 
in rockchip
kernel(same in different SoCs) is:
- no stdout in chosen, we use cmdline instead;
- debug uart node not enabled; we may use ttyFIQ driver instead of uart 
driver for it.
- no alias for emmc/sd, which is much in U-Boot;
- compaptible for syscon may different, kernel may use "syscon", 
"simple-mfd" only,
     but U-Boot need "rockchip,rk3228-grf" for GRF and 
"rockchip,rk3228-PMU" for PMU and etc.
Of cause I can update kernel source, but as you can see we are not able 
to cover all the case
because kernel may have different use with U-Boot.

If we do not need to re-init all the driver after relocate, or re-use 
the driver data,
then we can have a *robust U-Boot only depends on U-Boot dtb with 
dm-pre-reloc*,
and we can have a *good compatibility U-Boot with kernel dtb support* 
for different board/periph.
Then U-Boot focus on SoC support, kernel focus on all kinds of 
board/periph support,
U-Boot need to sync periph driver from kernel, so that if kernel works 
then U-Boot also works, developers
do not need to develop one for kernel and one for U-Boot.

Could you help to make a demo patch about how to re-use the driver-data 
of pre-reloc to post-reloc?


Thanks,

- Kever



More information about the U-Boot mailing list