dm: core: Move flags to device-runtime info

When of-platdata-inst is active, use the flags in the new udevice_rt
table, dropping them from the main struct udevice. This ensures that the
latter is not updated at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-03-15 17:25:37 +13:00
parent ab933d8026
commit 6f644efdd8
2 changed files with 41 additions and 0 deletions

View File

@@ -1136,3 +1136,36 @@ int dev_enable_by_path(const char *path)
return lists_bind_fdt(parent, node, NULL, false);
}
#endif
#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
static struct udevice_rt *dev_get_rt(const struct udevice *dev)
{
struct udevice *base = ll_entry_start(struct udevice, udevice);
int idx = dev - base;
struct udevice_rt *urt = gd_dm_udevice_rt() + idx;
return urt;
}
u32 dev_get_flags(const struct udevice *dev)
{
const struct udevice_rt *urt = dev_get_rt(dev);
return urt->flags_;
}
void dev_or_flags(const struct udevice *dev, u32 or)
{
struct udevice_rt *urt = dev_get_rt(dev);
urt->flags_ |= or;
}
void dev_bic_flags(const struct udevice *dev, u32 bic)
{
struct udevice_rt *urt = dev_get_rt(dev);
urt->flags_ &= ~bic;
}
#endif /* OF_PLATDATA_RT */