diff options
author | Heiko Stuebner <heiko@sntech.de> | 2019-03-07 08:07:11 +0100 |
---|---|---|
committer | Heiko Stuebner <heiko@sntech.de> | 2019-03-14 22:45:15 +0100 |
commit | 7029e806833b94f729d9117bd35d488476b0e27e (patch) | |
tree | d7ad7ccdf74d1b3b159fef570425be9a6b11eded /plat/rockchip/common/params_setup.c | |
parent | 4476838ae8c03087c4172de393a9c7c8b13dc393 (diff) | |
download | trusted-firmware-a-7029e806833b94f729d9117bd35d488476b0e27e.tar.gz |
rockchip: add an fdt parsing stub for platform param
The Rockchip ATF platform can be entered from both Coreboot and U-Boot.
While Coreboot does submit the list of linked parameter structs as
platform param, upstream u-boot actually always provides a pointer
to a devicetree as parameter.
This results in current ATF not running at all when started from U-Boot.
To fix this, add a stub that checks if the parameter is a fdt so we
can at least boot and not get stuck. Later on we can extend this with
actual parsing of information from the devicetree.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Diffstat (limited to 'plat/rockchip/common/params_setup.c')
-rw-r--r-- | plat/rockchip/common/params_setup.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plat/rockchip/common/params_setup.c b/plat/rockchip/common/params_setup.c index 3d1b40b3ff..dda98d962b 100644 --- a/plat/rockchip/common/params_setup.c +++ b/plat/rockchip/common/params_setup.c @@ -11,6 +11,7 @@ #include <common/debug.h> #include <drivers/console.h> #include <drivers/gpio.h> +#include <libfdt.h> #include <lib/coreboot.h> #include <lib/mmio.h> #include <plat/common/platform.h> @@ -27,6 +28,13 @@ static struct gpio_info suspend_gpio[10]; uint32_t suspend_gpio_cnt; static struct apio_info *suspend_apio; +static uint8_t fdt_buffer[0x10000]; + +void *plat_get_fdt(void) +{ + return &fdt_buffer[0]; +} + struct gpio_info *plat_get_rockchip_gpio_reset(void) { return rst_gpio; @@ -49,11 +57,30 @@ struct apio_info *plat_get_rockchip_suspend_apio(void) return suspend_apio; } +static int dt_process_fdt(void *blob) +{ + void *fdt = plat_get_fdt(); + int ret; + + ret = fdt_open_into(blob, fdt, 0x10000); + if (ret < 0) + return ret; + + return 0; +} + void params_early_setup(void *plat_param_from_bl2) { struct bl31_plat_param *bl2_param; struct bl31_gpio_param *gpio_param; + /* + * Test if this is a FDT passed as a platform-specific parameter + * block. + */ + if (!dt_process_fdt(plat_param_from_bl2)) + return; + /* keep plat parameters for later processing if need */ bl2_param = (struct bl31_plat_param *)plat_param_from_bl2; while (bl2_param) { |