]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dm: Convert users from dm_scan_fdt_node() to dm_scan_fdt_dev()
authorSimon Glass <sjg@chromium.org>
Tue, 5 Jul 2016 23:10:09 +0000 (17:10 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 27 Jul 2016 20:15:07 +0000 (14:15 -0600)
This new function is more convenient for callers, and handles pre-relocation
situations automatically.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 files changed:
arch/x86/lib/lpc-uclass.c
common/usb_hub.c
drivers/core/simple-bus.c
drivers/i2c/i2c-uclass.c
drivers/i2c/sandbox_i2c.c
drivers/misc/cros_ec.c
drivers/pch/pch-uclass.c
drivers/pci/pci-uclass.c
drivers/pci/pci_sandbox.c
drivers/pinctrl/pinctrl_pic32.c
drivers/pinctrl/rockchip/pinctrl_rk3036.c
drivers/pinctrl/rockchip/pinctrl_rk3288.c
drivers/power/pmic/pm8916.c
drivers/power/regulator/Kconfig
drivers/spi/spi-uclass.c
drivers/spmi/spmi-uclass.c
drivers/usb/emul/usb-emul-uclass.c
drivers/usb/host/usb-uclass.c
include/power/regulator.h
test/dm/bus.c

index c6e8f73d2254934497e9938bb8938188fd750d81..b8254ff48ce449848f132894202d8e4358b18146 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <common.h>
 #include <dm.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -19,8 +18,7 @@ static int lpc_uclass_post_bind(struct udevice *bus)
         * Before relocation, only bind devices marked for pre-relocation
         * use.
         */
-       return dm_scan_fdt_node(bus, gd->fdt_blob, bus->of_offset,
-                               gd->flags & GD_FLG_RELOC ? false : true);
+       return dm_scan_fdt_dev(bus);
 }
 
 UCLASS_DRIVER(lpc) = {
index 0f39c9faf7ea4248cd8e60da5fc1b6446208ebf7..26ee13e1499f89133d8417c0bcb0dedea46e7bba 100644 (file)
@@ -36,7 +36,6 @@
 #include <asm/state.h>
 #endif
 #include <asm/unaligned.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -758,7 +757,7 @@ int usb_hub_scan(struct udevice *hub)
 static int usb_hub_post_bind(struct udevice *dev)
 {
        /* Scan the bus for devices */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 static int usb_hub_post_probe(struct udevice *dev)
index 1a9c864ef377e65334f0cf50a1e83e49be8675a2..5c955da3346b2c1ff665060100b2f875a87cbe50 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <common.h>
 #include <dm.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -41,7 +40,7 @@ static int simple_bus_post_bind(struct udevice *dev)
                plat->size = cell[2];
        }
 
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 UCLASS_DRIVER(simple_bus) = {
index 20b30ffbeb5197217c382a84fa37f5b87c6b96e9..16447b896b0347f886b17fad75729296b08d6c57 100644 (file)
@@ -12,7 +12,6 @@
 #include <malloc.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -503,7 +502,7 @@ static int i2c_post_bind(struct udevice *dev)
 {
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        /* Scan the bus for devices */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+        return dm_scan_fdt_dev(dev);
 #else
        return 0;
 #endif
index 2c84c41643c8b442dea3634ac36367b97903b917..4696a1ae62a96650192e3234e7e4453513583101 100644 (file)
@@ -14,7 +14,6 @@
 #include <asm/test.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -33,8 +32,7 @@ static int get_emul(struct udevice *dev, struct udevice **devp,
        *opsp = NULL;
        plat = dev_get_parent_platdata(dev);
        if (!plat->emul) {
-               ret = dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset,
-                                      false);
+               ret = dm_scan_fdt_dev(dev);
                if (ret)
                        return ret;
 
index e3229efed0bb44529653b662765705949e852b13..f50e73fea6584bf1db14ab5690e74717a5782da6 100644 (file)
@@ -26,7 +26,6 @@
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
 #include <dm/device-internal.h>
-#include <dm/root.h>
 #include <dm/uclass-internal.h>
 
 #ifdef DEBUG_TRACE
@@ -1453,7 +1452,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 int cros_ec_post_bind(struct udevice *dev)
 {
        /* Scan for available EC devices (e.g. I2C tunnel) */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 U_BOOT_CMD(
index 7216660a24c773e5910e2c3658a9d540d74135fc..5b2fa1f0a50f70078a97c08b2877b6699b0df31c 100644 (file)
@@ -8,7 +8,6 @@
 #include <common.h>
 #include <dm.h>
 #include <pch.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -63,8 +62,7 @@ static int pch_uclass_post_bind(struct udevice *bus)
         * Before relocation, only bind devices marked for pre-relocation
         * use.
         */
-       return dm_scan_fdt_node(bus, gd->fdt_blob, bus->of_offset,
-                               gd->flags & GD_FLG_RELOC ? false : true);
+       return dm_scan_fdt_dev(bus);
 }
 
 UCLASS_DRIVER(pch) = {
index 32590ce498a7505971faaefe4324d0205d581f16..230d18142df164ee5a6cc6b9a523531865ca8988 100644 (file)
@@ -13,7 +13,6 @@
 #include <pci.h>
 #include <asm/io.h>
 #include <dm/lists.h>
-#include <dm/root.h>
 #include <dm/device-internal.h>
 #if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
 #include <asm/fsp/fsp_support.h>
@@ -755,13 +754,6 @@ error:
 
 static int pci_uclass_post_bind(struct udevice *bus)
 {
-       /*
-        * If there is no pci device listed in the device tree,
-        * don't bother scanning the device tree.
-        */
-       if (bus->of_offset == -1)
-               return 0;
-
        /*
         * Scan the device tree for devices. This does not probe the PCI bus,
         * as this is not permitted while binding. It just finds devices
@@ -770,8 +762,7 @@ static int pci_uclass_post_bind(struct udevice *bus)
         * Before relocation, only bind devices marked for pre-relocation
         * use.
         */
-       return dm_scan_fdt_node(bus, gd->fdt_blob, bus->of_offset,
-                               gd->flags & GD_FLG_RELOC ? false : true);
+       return dm_scan_fdt_dev(bus);
 }
 
 static int decode_regions(struct pci_controller *hose, const void *blob,
index 6de5130c2a89748a87a683c1e35614ed1b9d0aed..b5628139b30c1a0287f6d5c1a3e727969a9b24fb 100644 (file)
@@ -10,7 +10,6 @@
 #include <fdtdec.h>
 #include <inttypes.h>
 #include <pci.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -55,7 +54,7 @@ static int sandbox_pci_read_config(struct udevice *bus, pci_dev_t devfn,
 static int sandbox_pci_child_post_bind(struct udevice *dev)
 {
        /* Attach an emulator if we can */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 static const struct dm_pci_ops sandbox_pci_ops = {
index 5cf97ecec86fce1d3d4808a527d359ca1badaec5..5636f8f47f6a29fcf866eef42827d0833a13fa96 100644 (file)
@@ -10,7 +10,6 @@
 #include <errno.h>
 #include <asm/io.h>
 #include <dm/pinctrl.h>
-#include <dm/root.h>
 #include <mach/pic32.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -344,7 +343,7 @@ static int pic32_pinctrl_probe(struct udevice *dev)
 static int pic32_pinctrl_bind(struct udevice *dev)
 {
        /* scan child GPIO banks */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 static const struct udevice_id pic32_pinctrl_ids[] = {
index 1f78bf862dbc6f0255c07d347dc12e72fb6a0d92..3648678e15fafa0f2ffb591cbc086f0c9f233658 100644 (file)
@@ -15,7 +15,6 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/periph.h>
 #include <dm/pinctrl.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -256,7 +255,7 @@ static struct pinctrl_ops rk3036_pinctrl_ops = {
 static int rk3036_pinctrl_bind(struct udevice *dev)
 {
        /* scan child GPIO banks */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 static int rk3036_pinctrl_probe(struct udevice *dev)
index 8cb3b8228ed3aa4f61e68d8684e045448505a2d3..4650066a3c85e54f668292a8a273139c44764aeb 100644 (file)
@@ -17,7 +17,6 @@
 #include <asm/arch/periph.h>
 #include <asm/arch/pmu_rk3288.h>
 #include <dm/pinctrl.h>
-#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -669,8 +668,7 @@ static int rk3288_pinctrl_bind(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
        return 0;
 #else
-       /* scan child GPIO banks */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 #endif
 }
 
index d4c7d4adff1fd53fb1db33ec495ac175a84f4a81..6f5608e4568ca12acc3c66cfb3529cad29beac81 100644 (file)
@@ -7,7 +7,6 @@
  */
 #include <common.h>
 #include <dm.h>
-#include <dm/root.h>
 #include <power/pmic.h>
 #include <spmi/spmi.h>
 
@@ -82,7 +81,7 @@ static int pm8916_probe(struct udevice *dev)
 
 static int pm8916_bind(struct udevice *dev)
 {
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 U_BOOT_DRIVER(pmic_pm8916) = {
index 465ff3fda616055daf964ca15bf2797b058c4695..17f22dda2bdd21158853b1724cfb96e9d801bcc8 100644 (file)
@@ -13,7 +13,7 @@ config DM_REGULATOR
        - 'drivers/power/pmic/regulator-uclass.c'
        It's important to call the device_bind() with the proper node offset,
        when binding the regulator devices. The pmic_bind_childs() can be used
-       for this purpose if PMIC I/O driver is implemented or dm_scan_fdt_node()
+       for this purpose if PMIC I/O driver is implemented or dm_scan_fdt_dev()
        otherwise. Detailed information can be found in the header file.
 
 config SPL_DM_REGULATOR
index 8003f9bfc8635cb32d0f7808f7c5a3e11bf2c2ed..3d3005c22679e74fa3d116a5787acc03936fe3f4 100644 (file)
@@ -12,7 +12,6 @@
 #include <spi.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
-#include <dm/root.h>
 #include <dm/lists.h>
 #include <dm/util.h>
 
@@ -112,7 +111,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 static int spi_post_bind(struct udevice *dev)
 {
        /* Scan the bus for devices */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 static int spi_child_post_bind(struct udevice *dev)
index 4ddd51b556ec1e3092ffe82dcd23ca1c2ea0db87..9fa330b8e9031c68b655d7249c4c244d297fbd97 100644 (file)
@@ -9,7 +9,6 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
-#include <dm/root.h>
 #include <spmi/spmi.h>
 #include <linux/ctype.h>
 
@@ -38,7 +37,7 @@ int spmi_reg_write(struct udevice *dev, int usid, int pid, int reg,
 
 static int spmi_post_bind(struct udevice *dev)
 {
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 UCLASS_DRIVER(spmi) = {
index ee7ea5ad91cf2b9238c470a823cdf547e915bded..da91d04a087b1816b28a3320ab3a8cf96281f531 100644 (file)
@@ -8,7 +8,6 @@
 #include <common.h>
 #include <dm.h>
 #include <usb.h>
-#include <dm/root.h>
 #include <dm/device-internal.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -268,7 +267,7 @@ int usb_emul_setup_device(struct udevice *dev, int maxpacketsize,
 int usb_emul_post_bind(struct udevice *dev)
 {
        /* Scan the bus for devices */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 void usb_emul_reset(struct udevice *dev)
index 69c9a504ebb8ad8489523868b8991d871115c3d4..070e271db88dc72c9dfd25dc07b58098e89d70a2 100644 (file)
@@ -14,7 +14,6 @@
 #include <usb.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
-#include <dm/root.h>
 #include <dm/uclass-internal.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -351,8 +350,7 @@ struct usb_device *usb_get_dev_index(struct udevice *bus, int index)
 
 int usb_post_bind(struct udevice *dev)
 {
-       /* Scan the bus for devices */
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp)
index 63c0814fe83cea2be9bb800940971c7f420395de..9bcd728120aa9a53b2f4d1a4ebe157539a7d1675 100644 (file)
@@ -54,7 +54,7 @@
  * which does the scan on the device node, for the 'regulator-name' constraint.
  * If the parent is not a PMIC device, and the child is not bind by function:
  * 'pmic_bind_childs()', then it's recommended to bind the device by call to
- * dm_scan_fdt_node() - this is usually done automatically for bus devices,
+ * dm_scan_fdt_dev() - this is usually done automatically for bus devices,
  * as a post bind method.
  *
  * Regulator get:
index 3b5a23b934e3678b7527cbf8c6b3919e259a5e4b..d94dcf7a60d87988d9c50dae5f959c056a3777be 100644 (file)
@@ -7,7 +7,6 @@
 #include <common.h>
 #include <dm.h>
 #include <dm/device-internal.h>
-#include <dm/root.h>
 #include <dm/test.h>
 #include <dm/uclass-internal.h>
 #include <dm/util.h>
@@ -30,7 +29,7 @@ static struct dm_test_state *test_state;
 
 static int testbus_drv_probe(struct udevice *dev)
 {
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_dev(dev);
 }
 
 static int testbus_child_post_bind(struct udevice *dev)