aboutsummaryrefslogtreecommitdiff
path: root/drivers/core/device.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-16 21:20:09 -0700
committerSimon Glass <sjg@chromium.org>2020-12-18 20:32:21 -0700
commitcd53e5bf4bba421d98eb42ec71af31b521a90c2a (patch)
tree128329e66c8f8b2e0ea84763be364a1b86871f58 /drivers/core/device.c
parentd03adb4a78d18b5506350b3ac72ab2f18f1ed160 (diff)
downloadu-boot-cd53e5bf4bba421d98eb42ec71af31b521a90c2a.zip
u-boot-cd53e5bf4bba421d98eb42ec71af31b521a90c2a.tar.gz
u-boot-cd53e5bf4bba421d98eb42ec71af31b521a90c2a.tar.bz2
dm: core: Add a new sequence number for devices
At present each device has two sequence numbers, with 'req_seq' being set up at bind time and 'seq' at probe time. The idea is that devices can 'request' a sequence number and then the conflicts are resolved when the device is probed. This makes things complicated in a few cases, since we don't really know what the sequence number will end up being. We want to honour the bind-time requests if at all possible, but in fact the only source of these at present is the devicetree aliases. Since we have the devicetree available at bind time, we may as well just use it, in the hope that the required processing will turn out to be useful later (i.e. the device actually gets used). Add a new 'sqq' member, the bind-time sequence number. It operates in parallel to the old values for now. All devices get a valid sqq value, i.e. it is never -1. Drop an #ifdef while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r--drivers/core/device.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 22d8069..8d1287f 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -41,6 +41,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
struct udevice *dev;
struct uclass *uc;
int size, ret = 0;
+ bool auto_seq = true;
if (devp)
*devp = NULL;
@@ -73,6 +74,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
dev->seq = -1;
dev->req_seq = -1;
+ dev->sqq = -1;
if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
(uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
/*
@@ -84,17 +86,25 @@ 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))
+ if (uc->uc_drv->name && ofnode_valid(node)) {
+ dev_read_alias_seq(dev, &dev->sqq);
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(uc);
-#endif
+ auto_seq = false;
+ }
+ if (CONFIG_IS_ENABLED(OF_PRIOR_STAGE)) {
+ if (dev->req_seq == -1) {
+ auto_seq = true;
+ dev->req_seq =
+ uclass_find_next_free_req_seq(
+ uc);
+ }
+ }
} else {
dev->req_seq = uclass_find_next_free_req_seq(uc);
}
}
+ if (auto_seq)
+ dev->sqq = uclass_find_next_free_req_seq(uc);
if (drv->plat_auto) {
bool alloc = !plat;