summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-07-05 17:10:10 -0600
committerSimon Glass <sjg@chromium.org>2016-07-27 14:15:54 -0600
commit911954859d6dece49c3e4835faea004cfe392506 (patch)
tree79431b5419e1366009f331a3d1a604b64f14ccff /drivers
parent2e3f1ff63f50f36e74d46f939823241856ebf1bd (diff)
downloadu-boot-imx-911954859d6dece49c3e4835faea004cfe392506.zip
u-boot-imx-911954859d6dece49c3e4835faea004cfe392506.tar.gz
u-boot-imx-911954859d6dece49c3e4835faea004cfe392506.tar.bz2
dm: Use dm_scan_fdt_dev() directly where possible
Quite a few places have a bind() method which just calls dm_scan_fdt_dev(). We may as well call dm_scan_fdt_dev() directly. Update the code to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-uclass.c14
-rw-r--r--drivers/misc/cros_ec.c8
-rw-r--r--drivers/pch/pch-uclass.c13
-rw-r--r--drivers/pci/pci-uclass.c15
-rw-r--r--drivers/pci/pci_sandbox.c10
-rw-r--r--drivers/pinctrl/pinctrl_pic32.c8
-rw-r--r--drivers/pinctrl/rockchip/pinctrl_rk3036.c8
-rw-r--r--drivers/pinctrl/rockchip/pinctrl_rk3288.c13
-rw-r--r--drivers/power/pmic/pm8916.c8
-rw-r--r--drivers/spi/spi-uclass.c8
-rw-r--r--drivers/spmi/spmi-uclass.c7
-rw-r--r--drivers/usb/emul/usb-emul-uclass.c8
-rw-r--r--drivers/usb/host/usb-uclass.c7
13 files changed, 19 insertions, 108 deletions
diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index 16447b8..dbd3789 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -498,16 +498,6 @@ static int i2c_post_probe(struct udevice *dev)
#endif
}
-static int i2c_post_bind(struct udevice *dev)
-{
-#if CONFIG_IS_ENABLED(OF_CONTROL)
- /* Scan the bus for devices */
- return dm_scan_fdt_dev(dev);
-#else
- return 0;
-#endif
-}
-
static int i2c_child_post_bind(struct udevice *dev)
{
#if CONFIG_IS_ENABLED(OF_CONTROL)
@@ -526,7 +516,9 @@ UCLASS_DRIVER(i2c) = {
.id = UCLASS_I2C,
.name = "i2c",
.flags = DM_UC_FLAG_SEQ_ALIAS,
- .post_bind = i2c_post_bind,
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+ .post_bind = dm_scan_fdt_dev,
+#endif
.post_probe = i2c_post_probe,
.per_device_auto_alloc_size = sizeof(struct dm_i2c_bus),
.per_child_platdata_auto_alloc_size = sizeof(struct dm_i2c_chip),
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index f50e73f..aea8d61 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -1449,12 +1449,6 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return ret;
}
-int cros_ec_post_bind(struct udevice *dev)
-{
- /* Scan for available EC devices (e.g. I2C tunnel) */
- return dm_scan_fdt_dev(dev);
-}
-
U_BOOT_CMD(
crosec, 6, 1, do_cros_ec,
"CROS-EC utility command",
@@ -1481,5 +1475,5 @@ UCLASS_DRIVER(cros_ec) = {
.id = UCLASS_CROS_EC,
.name = "cros_ec",
.per_device_auto_alloc_size = sizeof(struct cros_ec_dev),
- .post_bind = cros_ec_post_bind,
+ .post_bind = dm_scan_fdt_dev,
};
diff --git a/drivers/pch/pch-uclass.c b/drivers/pch/pch-uclass.c
index 5b2fa1f..af794eb 100644
--- a/drivers/pch/pch-uclass.c
+++ b/drivers/pch/pch-uclass.c
@@ -54,19 +54,8 @@ int pch_get_io_base(struct udevice *dev, u32 *iobasep)
return ops->get_io_base(dev, iobasep);
}
-static int pch_uclass_post_bind(struct udevice *bus)
-{
- /*
- * Scan the device tree for devices
- *
- * Before relocation, only bind devices marked for pre-relocation
- * use.
- */
- return dm_scan_fdt_dev(bus);
-}
-
UCLASS_DRIVER(pch) = {
.id = UCLASS_PCH,
.name = "pch",
- .post_bind = pch_uclass_post_bind,
+ .post_bind = dm_scan_fdt_dev,
};
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 230d181..342b78c 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -752,19 +752,6 @@ error:
return ret;
}
-static int pci_uclass_post_bind(struct udevice *bus)
-{
- /*
- * Scan the device tree for devices. This does not probe the PCI bus,
- * as this is not permitted while binding. It just finds devices
- * mentioned in the device tree.
- *
- * Before relocation, only bind devices marked for pre-relocation
- * use.
- */
- return dm_scan_fdt_dev(bus);
-}
-
static int decode_regions(struct pci_controller *hose, const void *blob,
int parent_node, int node)
{
@@ -1245,7 +1232,7 @@ UCLASS_DRIVER(pci) = {
.id = UCLASS_PCI,
.name = "pci",
.flags = DM_UC_FLAG_SEQ_ALIAS,
- .post_bind = pci_uclass_post_bind,
+ .post_bind = dm_scan_fdt_dev,
.pre_probe = pci_uclass_pre_probe,
.post_probe = pci_uclass_post_probe,
.child_post_bind = pci_uclass_child_post_bind,
diff --git a/drivers/pci/pci_sandbox.c b/drivers/pci/pci_sandbox.c
index b562813..6a84ee3 100644
--- a/drivers/pci/pci_sandbox.c
+++ b/drivers/pci/pci_sandbox.c
@@ -51,12 +51,6 @@ static int sandbox_pci_read_config(struct udevice *bus, pci_dev_t devfn,
return ops->read_config(emul, offset, valuep, size);
}
-static int sandbox_pci_child_post_bind(struct udevice *dev)
-{
- /* Attach an emulator if we can */
- return dm_scan_fdt_dev(dev);
-}
-
static const struct dm_pci_ops sandbox_pci_ops = {
.read_config = sandbox_pci_read_config,
.write_config = sandbox_pci_write_config,
@@ -72,7 +66,9 @@ U_BOOT_DRIVER(pci_sandbox) = {
.id = UCLASS_PCI,
.of_match = sandbox_pci_ids,
.ops = &sandbox_pci_ops,
- .child_post_bind = sandbox_pci_child_post_bind,
+
+ /* Attach an emulator if we can */
+ .child_post_bind = dm_scan_fdt_dev,
.per_child_platdata_auto_alloc_size =
sizeof(struct pci_child_platdata),
};
diff --git a/drivers/pinctrl/pinctrl_pic32.c b/drivers/pinctrl/pinctrl_pic32.c
index 5636f8f..9acac29 100644
--- a/drivers/pinctrl/pinctrl_pic32.c
+++ b/drivers/pinctrl/pinctrl_pic32.c
@@ -340,12 +340,6 @@ static int pic32_pinctrl_probe(struct udevice *dev)
return 0;
}
-static int pic32_pinctrl_bind(struct udevice *dev)
-{
- /* scan child GPIO banks */
- return dm_scan_fdt_dev(dev);
-}
-
static const struct udevice_id pic32_pinctrl_ids[] = {
{ .compatible = "microchip,pic32mzda-pinctrl" },
{ }
@@ -357,6 +351,6 @@ U_BOOT_DRIVER(pinctrl_pic32) = {
.of_match = pic32_pinctrl_ids,
.ops = &pic32_pinctrl_ops,
.probe = pic32_pinctrl_probe,
- .bind = pic32_pinctrl_bind,
+ .bind = dm_scan_fdt_dev,
.priv_auto_alloc_size = sizeof(struct pic32_pinctrl_priv),
};
diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3036.c b/drivers/pinctrl/rockchip/pinctrl_rk3036.c
index 3648678..6aea856 100644
--- a/drivers/pinctrl/rockchip/pinctrl_rk3036.c
+++ b/drivers/pinctrl/rockchip/pinctrl_rk3036.c
@@ -252,12 +252,6 @@ static struct pinctrl_ops rk3036_pinctrl_ops = {
.get_periph_id = rk3036_pinctrl_get_periph_id,
};
-static int rk3036_pinctrl_bind(struct udevice *dev)
-{
- /* scan child GPIO banks */
- return dm_scan_fdt_dev(dev);
-}
-
static int rk3036_pinctrl_probe(struct udevice *dev)
{
struct rk3036_pinctrl_priv *priv = dev_get_priv(dev);
@@ -278,6 +272,6 @@ U_BOOT_DRIVER(pinctrl_rk3036) = {
.of_match = rk3036_pinctrl_ids,
.priv_auto_alloc_size = sizeof(struct rk3036_pinctrl_priv),
.ops = &rk3036_pinctrl_ops,
- .bind = rk3036_pinctrl_bind,
+ .bind = dm_scan_fdt_dev,
.probe = rk3036_pinctrl_probe,
};
diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3288.c b/drivers/pinctrl/rockchip/pinctrl_rk3288.c
index 4650066..ae8a4f1 100644
--- a/drivers/pinctrl/rockchip/pinctrl_rk3288.c
+++ b/drivers/pinctrl/rockchip/pinctrl_rk3288.c
@@ -663,15 +663,6 @@ static struct pinctrl_ops rk3288_pinctrl_ops = {
.get_periph_id = rk3288_pinctrl_get_periph_id,
};
-static int rk3288_pinctrl_bind(struct udevice *dev)
-{
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
- return 0;
-#else
- return dm_scan_fdt_dev(dev);
-#endif
-}
-
#ifndef CONFIG_SPL_BUILD
static int rk3288_pinctrl_parse_tables(struct rk3288_pinctrl_priv *priv,
struct rockchip_pin_bank *banks,
@@ -728,6 +719,8 @@ U_BOOT_DRIVER(pinctrl_rk3288) = {
.of_match = rk3288_pinctrl_ids,
.priv_auto_alloc_size = sizeof(struct rk3288_pinctrl_priv),
.ops = &rk3288_pinctrl_ops,
- .bind = rk3288_pinctrl_bind,
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+ .bind = dm_scan_fdt_dev,
+#endif
.probe = rk3288_pinctrl_probe,
};
diff --git a/drivers/power/pmic/pm8916.c b/drivers/power/pmic/pm8916.c
index 6f5608e..2b65c69 100644
--- a/drivers/power/pmic/pm8916.c
+++ b/drivers/power/pmic/pm8916.c
@@ -78,17 +78,11 @@ static int pm8916_probe(struct udevice *dev)
return 0;
}
-
-static int pm8916_bind(struct udevice *dev)
-{
- return dm_scan_fdt_dev(dev);
-}
-
U_BOOT_DRIVER(pmic_pm8916) = {
.name = "pmic_pm8916",
.id = UCLASS_PMIC,
.of_match = pm8916_ids,
- .bind = pm8916_bind,
+ .bind = dm_scan_fdt_dev,
.probe = pm8916_probe,
.ops = &pm8916_ops,
.priv_auto_alloc_size = sizeof(struct pm8916_priv),
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 3d3005c..247abfa 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -108,12 +108,6 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
return dm_spi_xfer(slave->dev, bitlen, dout, din, flags);
}
-static int spi_post_bind(struct udevice *dev)
-{
- /* Scan the bus for devices */
- return dm_scan_fdt_dev(dev);
-}
-
static int spi_child_post_bind(struct udevice *dev)
{
struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
@@ -445,7 +439,7 @@ UCLASS_DRIVER(spi) = {
.id = UCLASS_SPI,
.name = "spi",
.flags = DM_UC_FLAG_SEQ_ALIAS,
- .post_bind = spi_post_bind,
+ .post_bind = dm_scan_fdt_dev,
.post_probe = spi_post_probe,
.child_pre_probe = spi_child_pre_probe,
.per_device_auto_alloc_size = sizeof(struct dm_spi_bus),
diff --git a/drivers/spmi/spmi-uclass.c b/drivers/spmi/spmi-uclass.c
index 9fa330b..6edece2 100644
--- a/drivers/spmi/spmi-uclass.c
+++ b/drivers/spmi/spmi-uclass.c
@@ -35,13 +35,8 @@ int spmi_reg_write(struct udevice *dev, int usid, int pid, int reg,
return ops->write(dev, usid, pid, reg, value);
}
-static int spmi_post_bind(struct udevice *dev)
-{
- return dm_scan_fdt_dev(dev);
-}
-
UCLASS_DRIVER(spmi) = {
.id = UCLASS_SPMI,
.name = "spmi",
- .post_bind = spmi_post_bind,
+ .post_bind = dm_scan_fdt_dev,
};
diff --git a/drivers/usb/emul/usb-emul-uclass.c b/drivers/usb/emul/usb-emul-uclass.c
index da91d04..6e03c1e 100644
--- a/drivers/usb/emul/usb-emul-uclass.c
+++ b/drivers/usb/emul/usb-emul-uclass.c
@@ -264,12 +264,6 @@ int usb_emul_setup_device(struct udevice *dev, int maxpacketsize,
return 0;
}
-int usb_emul_post_bind(struct udevice *dev)
-{
- /* Scan the bus for devices */
- return dm_scan_fdt_dev(dev);
-}
-
void usb_emul_reset(struct udevice *dev)
{
struct usb_dev_platdata *plat = dev_get_parent_platdata(dev);
@@ -281,7 +275,7 @@ void usb_emul_reset(struct udevice *dev)
UCLASS_DRIVER(usb_emul) = {
.id = UCLASS_USB_EMUL,
.name = "usb_emul",
- .post_bind = usb_emul_post_bind,
+ .post_bind = dm_scan_fdt_dev,
.per_child_auto_alloc_size = sizeof(struct usb_device),
.per_child_platdata_auto_alloc_size = sizeof(struct usb_dev_platdata),
};
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 070e271..be114fc 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -348,11 +348,6 @@ struct usb_device *usb_get_dev_index(struct udevice *bus, int index)
}
#endif
-int usb_post_bind(struct udevice *dev)
-{
- return dm_scan_fdt_dev(dev);
-}
-
int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp)
{
struct usb_platdata *plat;
@@ -766,7 +761,7 @@ UCLASS_DRIVER(usb) = {
.id = UCLASS_USB,
.name = "usb",
.flags = DM_UC_FLAG_SEQ_ALIAS,
- .post_bind = usb_post_bind,
+ .post_bind = dm_scan_fdt_dev,
.priv_auto_alloc_size = sizeof(struct usb_uclass_priv),
.per_child_auto_alloc_size = sizeof(struct usb_device),
.per_device_auto_alloc_size = sizeof(struct usb_bus_priv),