return NULL;
}
- return dev->plat_;
+ return dm_priv_to_rw(dev->plat_);
}
void *dev_get_parent_plat(const struct udevice *dev)
return NULL;
}
- return dev->parent_plat_;
+ return dm_priv_to_rw(dev->parent_plat_);
}
void *dev_get_uclass_plat(const struct udevice *dev)
return NULL;
}
- return dev->uclass_plat_;
+ return dm_priv_to_rw(dev->uclass_plat_);
}
void *dev_get_priv(const struct udevice *dev)
return NULL;
}
- return dev->priv_;
+ return dm_priv_to_rw(dev->priv_);
}
void *dev_get_uclass_priv(const struct udevice *dev)
return NULL;
}
- return dev->uclass_priv_;
+ return dm_priv_to_rw(dev->uclass_priv_);
}
void *dev_get_parent_priv(const struct udevice *dev)
return NULL;
}
- return dev->parent_priv_;
+ return dm_priv_to_rw(dev->parent_priv_);
}
static int device_get_device_tail(struct udevice *dev, int ret,
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
*
void dm_dump_static_driver_info(void);
#endif
+
+#if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY)
+void *dm_priv_to_rw(void *priv);
+#else
+static inline void *dm_priv_to_rw(void *priv)
+{
+ return priv;
+}
+#endif