summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2021-03-15 17:25:36 +1300
committerSimon Glass <[email protected]>2021-03-26 17:03:09 +1300
commitab933d802643ca51d276f0f449921a047126f8a1 (patch)
treed984baab5d4daa7057bdfc281cb693db6468500d /include
parent95a5825f3134ff47f1e0cf37b4014b5c2e2027b5 (diff)
dm: core: Create a struct for device runtime info
At present when driver model needs to change a device it simply updates the struct udevice structure. But with of-platdata-inst most of the fields are not modified at runtime. In fact, typically only the flags need to change. For systems running SPL from read-only memory it is convenient to separate out the runtime information, so that the devices don't need to be copied before being used. Create a new udevice_rt table, similar to the existing driver_rt. For now it just holds the flags, although they are not used in this patch. Add a new Kconfig for the driver_rt data, since this is not needed when of-platdata-inst is used. Signed-off-by: Simon Glass <[email protected]> Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/global_data.h16
-rw-r--r--include/dm/device.h15
2 files changed, 29 insertions, 2 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index c24f5e0e973..f6189eff4eb 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -215,10 +215,14 @@ struct global_data {
* @uclass_root_s.
*/
struct list_head *uclass_root;
-# if CONFIG_IS_ENABLED(OF_PLATDATA)
+# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
/** @dm_driver_rt: Dynamic info about the driver */
struct driver_rt *dm_driver_rt;
# endif
+#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
+ /** @dm_udevice_rt: Dynamic info about the udevice */
+ struct udevice_rt *dm_udevice_rt;
+# endif
#endif
#ifdef CONFIG_TIMER
/**
@@ -483,7 +487,7 @@ struct global_data {
#define gd_set_of_root(_root)
#endif
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
#define gd_dm_driver_rt() gd->dm_driver_rt
#else
@@ -491,6 +495,14 @@ struct global_data {
#define gd_dm_driver_rt() NULL
#endif
+#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
+#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
+#define gd_dm_udevice_rt() gd->dm_udevice_rt
+#else
+#define gd_set_dm_udevice_rt(dyn)
+#define gd_dm_udevice_rt() NULL
+#endif
+
#ifdef CONFIG_GENERATE_ACPI_TABLE
#define gd_acpi_ctx() gd->acpi_ctx
#else
diff --git a/include/dm/device.h b/include/dm/device.h
index 9183356468f..8e16f2ea497 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -190,6 +190,21 @@ struct udevice {
#endif
};
+/**
+ * udevice_rt - runtime information set up by U-Boot
+ *
+ * This is only used with OF_PLATDATA_RT
+ *
+ * There is one of these for every udevice in the linker list, indexed by
+ * the udevice_info idx value.
+ *
+ * @flags_: Flags for this device DM_FLAG_... (do not access outside driver
+ * model)
+ */
+struct udevice_rt {
+ u32 flags_;
+};
+
/* Maximum sequence number supported */
#define DM_MAX_SEQ 999