Merge branch 'master' of git://git.denx.de/u-boot
[platform/kernel/u-boot.git] / drivers / core / device.c
index 0bc04d4..a3dc2ca 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <fdt_support.h>
 #include <malloc.h>
 #include <dm/device.h>
 #include <dm/device-internal.h>
@@ -289,8 +290,12 @@ int device_probe_child(struct udevice *dev, void *parent_priv)
 
        dev->flags |= DM_FLAG_ACTIVATED;
 
-       /* continue regardless of the result of pinctrl */
-       pinctrl_select_state(dev, "default");
+       /*
+        * Process pinctrl for everything except the root device, and
+        * continue regardless of the result of pinctrl.
+        */
+       if (dev->parent)
+               pinctrl_select_state(dev, "default");
 
        ret = uclass_pre_probe_device(dev);
        if (ret)
@@ -581,6 +586,25 @@ fdt_addr_t dev_get_addr(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        fdt_addr_t addr;
 
+       if (CONFIG_IS_ENABLED(OF_TRANSLATE)) {
+               const fdt32_t *reg;
+
+               reg = fdt_getprop(gd->fdt_blob, dev->of_offset, "reg", NULL);
+               if (!reg)
+                       return FDT_ADDR_T_NONE;
+
+               /*
+                * Use the full-fledged translate function for complex
+                * bus setups.
+                */
+               return fdt_translate_address((void *)gd->fdt_blob,
+                                            dev->of_offset, reg);
+       }
+
+       /*
+        * Use the "simple" translate function for less complex
+        * bus setups.
+        */
        addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
                                                dev->parent->of_offset,
                                                dev->of_offset, "reg",