diff options
author | Simon Glass <sjg@chromium.org> | 2020-12-16 21:20:15 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-12-18 20:32:21 -0700 |
commit | 16df99324663fd3f88cb5e1ce241ee3f9f9ddacd (patch) | |
tree | 7f07261d469a4e588ef182be3b12a9817d010e5c /drivers/i2c/i2c-uclass.c | |
parent | 5c5800225501dc18eff71ecf4e5e45d0309f40ca (diff) |
i2c: Update for new sequence numbers
Use the new sequence number in all cases. Drop the logic to check for a
valid number in designware_i2c, since it will always be valid.
Also drop the numbering in the uclass, since we can rely on driver
model giving us the right sequence numbers.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/i2c/i2c-uclass.c')
-rw-r--r-- | drivers/i2c/i2c-uclass.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c index 490437bd42..456cf3b85f 100644 --- a/drivers/i2c/i2c-uclass.c +++ b/drivers/i2c/i2c-uclass.c @@ -686,27 +686,11 @@ static int i2c_child_post_bind(struct udevice *dev) #endif } -struct i2c_priv { - int max_id; -}; - static int i2c_post_bind(struct udevice *dev) { - struct uclass *class = dev->uclass; - struct i2c_priv *priv = class->priv; int ret = 0; - /* Just for sure */ - if (!priv) - return -ENOMEM; - - debug("%s: %s, req_seq=%d\n", __func__, dev->name, dev->req_seq); - - /* if there is no alias ID, use the first free */ - if (dev->req_seq == -1) - dev->req_seq = ++priv->max_id; - - debug("%s: %s, new req_seq=%d\n", __func__, dev->name, dev->req_seq); + debug("%s: %s, seq=%d\n", __func__, dev->name, dev_seq(dev)); #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) ret = dm_scan_fdt_dev(dev); @@ -714,32 +698,11 @@ static int i2c_post_bind(struct udevice *dev) return ret; } -int i2c_uclass_init(struct uclass *class) -{ - struct i2c_priv *priv = class->priv; - - /* Just for sure */ - if (!priv) - return -ENOMEM; - - /* Get the last allocated alias. */ - if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) - priv->max_id = dev_read_alias_highest_id("i2c"); - else - priv->max_id = -1; - - debug("%s: highest alias id is %d\n", __func__, priv->max_id); - - return 0; -} - UCLASS_DRIVER(i2c) = { .id = UCLASS_I2C, .name = "i2c", .flags = DM_UC_FLAG_SEQ_ALIAS, .post_bind = i2c_post_bind, - .init = i2c_uclass_init, - .priv_auto = sizeof(struct i2c_priv), .pre_probe = i2c_pre_probe, .post_probe = i2c_post_probe, .per_device_auto = sizeof(struct dm_i2c_bus), |