dm: device: Request next sequence number
authorThomas Fitzsimmons <fitzsim@fitzsim.org>
Fri, 6 Sep 2019 11:51:18 +0000 (07:51 -0400)
committerSimon Glass <sjg@chromium.org>
Tue, 15 Oct 2019 14:40:02 +0000 (08:40 -0600)
For CONFIG_OF_PRIOR_STAGE, in the absence of a device tree alias for a
given device, use the next request number for that type of device.
This allows aliases to be used when they're available, while still
allowing unaliased devices to be probed.

Signed-off-by: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
drivers/core/device.c
drivers/core/uclass.c

index ce66c72e5ec9c194320ec783e340b8c00ceb52ff..24b940eac289bb43aa711c108798c121f40a3c2f 100644 (file)
@@ -82,6 +82,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
                if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                        if (uc->uc_drv->name && ofnode_valid(node))
                                dev_read_alias_seq(dev, &dev->req_seq);
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+                       if (dev->req_seq == -1)
+                               dev->req_seq =
+                                       uclass_find_next_free_req_seq(drv->id);
+#endif
                } else {
                        dev->req_seq = uclass_find_next_free_req_seq(drv->id);
                }
index f217876cd2c0ab70a7e81d38c705b39da1c4d040..36f4d1c289d0e9f3e37453b725ad05537f10b920 100644 (file)
@@ -269,7 +269,9 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
        return -ENODEV;
 }
 
-#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_CONTROL) || \
+    CONFIG_IS_ENABLED(OF_PLATDATA) || \
+    CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
 int uclass_find_next_free_req_seq(enum uclass_id id)
 {
        struct uclass *uc;