Skip to contentSkip to conversation

i3c: master: dw-i3c: Fix missing of_node for virtual I2C adapter

PATCH Superseded Peter Yin 2 participants 2 messages Feb 25

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Peter Yin

author
#0 lore raw

PATCH v2 1/1 i3c: master: dw-i3c: Fix missing of_node for virtual I2C adapter

The DesignWare I3C master driver creates a virtual I2C adapter to provide backward compatibility with I2C devices. However, the current implementation does not associate this virtual adapter with any Device Tree node.

Propagate the of_node from the I3C master platform device to the virtual I2C adapter's device structure. This ensures that standard I2C aliases are correctly resolved and bus numbering remains consistent.

---

Changes in v2:
- Move the fix from the ast2600-specific driver to the dw-i3c common

 drivers/i3c/master/dw-i3c-master.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i3c/master/dw-i3c-master.c +2 -0
index d87bde3f7700..adf618d131dc 100644
@@ -1659,6 +1659,8 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 		pm_runtime_get_noresume(&pdev->dev);
 
 	INIT_WORK(&master->hj_work, dw_i3c_hj_work);
+
+	master->base.i2c.dev.of_node = pdev->dev.of_node;
 	ret = i3c_master_register(&master->base, &pdev->dev,
 				  &dw_mipi_i3c_ops, false);
 	if (ret)

--
2.43.0

reviewer
#1 lore raw
Quoted 23 lines · Peter Yin

The DesignWare I3C master driver creates a virtual I2C adapter to provide backward compatibility with I2C devices. However, the current implementation does not associate this virtual adapter with any Device Tree node.

Propagate the of_node from the I3C master platform device to the virtual I2C adapter's device structure. This ensures that standard I2C aliases are correctly resolved and bus numbering remains consistent.

---

Changes in v2:
- Move the fix from the ast2600-specific driver to the dw-i3c common

 drivers/i3c/master/dw-i3c-master.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i3c/master/dw-i3c-master.c +0 -0
index d87bde3f7700..adf618d131dc 100644

drivers/i3c/master/dw-i3c-master.c int dw_i3c_common_probe(struct dw_i3c_master *master, · line 1663

Quoted 5 lines
drivers/i3c/master/dw-i3c-master.c +2 -0
@@ -1659,6 +1659,8 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 		pm_runtime_get_noresume(&pdev->dev);
 
 	INIT_WORK(&master->hj_work, dw_i3c_hj_work);
+
+	master->base.i2c.dev.of_node = pdev->dev.of_node;

It should use device_set_of_node_from_dev();

Frank

Quoted 6 lines
drivers/i3c/master/dw-i3c-master.c +0 -1
 	ret = i3c_master_register(&master->base, &pdev->dev,
 				  &dw_mipi_i3c_ops, false);
 	if (ret)
--

2.43.0