From cfb9c9b77c29f48ae2c71ff30ca294bdaf369d87 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 15 Mar 2021 17:25:40 +1300 Subject: dm: core: Use separate priv/plat data region Make use of the new priv/plat data region if enabled. This is implemented as a simple offset from the position set up by dtoc to the new position. So long as all access goes through dm_priv_to_rw() this is safe. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/core/root.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/core/root.c') diff --git a/drivers/core/root.c b/drivers/core/root.c index 82b3c7de715..d9a19c5e6b6 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -347,6 +347,15 @@ __weak int dm_scan_other(bool pre_reloc_only) return 0; } +#if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY) +void *dm_priv_to_rw(void *priv) +{ + long offset = priv - (void *)__priv_data_start; + + return gd_dm_priv_base() + offset; +} +#endif + /** * dm_scan() - Scan tables to bind devices * -- cgit v1.2.3