提交 26b77aae 编写于 作者: P Phil Elwell 提交者: Zheng Zengkai

i2c-gpio: Also set bus numbers from reg property

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

I2C busses can be assigned specific bus numbers using aliases in
Device Tree - string properties where the name is the alias and the
value is the path to the node. The current DT parameter mechanism
does not allow property names to be derived from a parameter value
in any way, so it isn't possible to generate unique or matching
aliases for nodes from an overlay that can generate multiple
instances, e.g. i2c-gpio.

Work around this limitation (at least temporarily) by allowing
the i2c adapter number to be initialised from the "reg" property
if present.
Signed-off-by: NPhil Elwell <phil@raspberrypi.org>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ac6727d8
...@@ -445,7 +445,9 @@ static int i2c_gpio_probe(struct platform_device *pdev) ...@@ -445,7 +445,9 @@ static int i2c_gpio_probe(struct platform_device *pdev)
adap->dev.parent = dev; adap->dev.parent = dev;
adap->dev.of_node = np; adap->dev.of_node = np;
adap->nr = pdev->id; if (pdev->id != PLATFORM_DEVID_NONE || !pdev->dev.of_node ||
of_property_read_u32(pdev->dev.of_node, "reg", &adap->nr))
adap->nr = pdev->id;
ret = i2c_bit_add_numbered_bus(adap); ret = i2c_bit_add_numbered_bus(adap);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册