aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/Kconfig14
-rw-r--r--drivers/core/lists.c4
-rw-r--r--drivers/core/uclass.c30
3 files changed, 35 insertions, 13 deletions
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 0dc442b..b79e99b 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -350,6 +350,20 @@ config SPL_OF_TRANSLATE
used for the address translation. This function is faster and
smaller in size than fdt_translate_address().
+config TPL_OF_TRANSLATE
+ bool "Translate addresses using fdt_translate_address in TPL"
+ depends on TPL_DM && TPL_OF_CONTROL
+ help
+ If this option is enabled, the reg property will be translated
+ using the fdt_translate_address() function. This is necessary
+ on some platforms (e.g. MVEBU) using complex "ranges"
+ properties in many nodes. As this translation is not handled
+ correctly in the default simple_bus_translate() function.
+
+ If this option is not enabled, simple_bus_translate() will be
+ used for the address translation. This function is faster and
+ smaller in size than fdt_translate_address()
+
config VPL_OF_TRANSLATE
bool "Translate addresses using fdt_translate_address in SPL"
depends on SPL_DM && VPL_OF_CONTROL
diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index c49695b..3878957 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -222,6 +222,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
log_debug(" - attempt to match compatible string '%s'\n",
compat);
+ id = NULL;
for (entry = driver; entry != driver + n_ents; entry++) {
if (drv) {
if (drv != entry)
@@ -250,7 +251,8 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
entry->name, entry->of_match->compatible,
id->compatible);
ret = device_bind_with_driver_data(parent, entry, name,
- id->data, node, &dev);
+ id ? id->data : 0, node,
+ &dev);
if (ret == -ENODEV) {
log_debug("Driver '%s' refuses to bind\n", entry->name);
continue;
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index b7d11bd..1762a07 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -574,28 +574,34 @@ int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
}
#endif
-int uclass_first_device(enum uclass_id id, struct udevice **devp)
+/*
+ * Starting from the given device @dev, return pointer to the first device in
+ * the uclass that probes successfully in @devp.
+ */
+static void _uclass_next_device(struct udevice *dev, struct udevice **devp)
+{
+ for (; dev; uclass_find_next_device(&dev)) {
+ if (!device_probe(dev))
+ break;
+ }
+ *devp = dev;
+}
+
+void uclass_first_device(enum uclass_id id, struct udevice **devp)
{
struct udevice *dev;
int ret;
- *devp = NULL;
ret = uclass_find_first_device(id, &dev);
- if (!dev)
- return 0;
- return uclass_get_device_tail(dev, ret, devp);
+ _uclass_next_device(dev, devp);
}
-int uclass_next_device(struct udevice **devp)
+void uclass_next_device(struct udevice **devp)
{
struct udevice *dev = *devp;
- int ret;
- *devp = NULL;
- ret = uclass_find_next_device(&dev);
- if (!dev)
- return 0;
- return uclass_get_device_tail(dev, ret, devp);
+ uclass_find_next_device(&dev);
+ _uclass_next_device(dev, devp);
}
int uclass_first_device_err(enum uclass_id id, struct udevice **devp)