diff options
author | Simon Glass <sjg@chromium.org> | 2021-03-15 07:25:37 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-03-26 07:03:09 +0300 |
commit | 6f644efdd803e0718d39266f75c0535a534cc601 (patch) | |
tree | 2c5c623bf4c9860885b10736638dcec1da9594e0 /drivers/core | |
parent | ab933d802643ca51d276f0f449921a047126f8a1 (diff) | |
download | u-boot-6f644efdd803e0718d39266f75c0535a534cc601.tar.xz |
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>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/device.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 1990b6f69f..06d2467825 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -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 */ |