[PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type

Roland Ruckerbauer roland at rucky.eu
Mon Aug 21 19:59:56 CEST 2023


Tested on visionfive2 board, it works. Thanks for taking a look into this.

On 18.08.23 07:11, Chanho Park wrote:
> This patch introduces EVT_DM_POST_INIT_R event type for handling hooks
> after relocation.
>
> Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation")
> Suggested-by: Simon Glass <sjg at chromium.org>
> Cc: Bin Meng <bmeng.cn at gmail.com>
> Signed-off-by: Chanho Park <chanho61.park at samsung.com>

Tested-by: Roland Ruckerbauer <mail at ruabmbua.dev>

> ---
>   drivers/core/root.c | 6 ++++--
>   include/event.h     | 1 +
>   2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index 6775fb0b6575..79d871ab291a 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only)
>   			return ret;
>   		}
>   	}
> -	if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) {
> -		ret = event_notify_null(EVT_DM_POST_INIT_F);
> +	if (CONFIG_IS_ENABLED(DM_EVENT)) {
> +		ret = event_notify_null(gd->flags & GD_FLG_RELOC ?
> +					EVT_DM_POST_INIT_R :
> +					EVT_DM_POST_INIT_F);
>   		if (ret)
>   			return log_msg_ret("ev", ret);
>   	}
> diff --git a/include/event.h b/include/event.h
> index daf44bf8a83b..bb38ba98e73b 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -24,6 +24,7 @@ enum event_t {
>   
>   	/* Events related to driver model */
>   	EVT_DM_POST_INIT_F,
> +	EVT_DM_POST_INIT_R,
>   	EVT_DM_PRE_PROBE,
>   	EVT_DM_POST_PROBE,
>   	EVT_DM_PRE_REMOVE,


More information about the U-Boot mailing list