Skip to contentSkip to conversation

i2c-i801: Add device tree support

PATCH In review Thierry Reding 3 participants 9 messages Aug 8, 2012 – Oct 15, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-i801: Add device tree support

This commit adds support for probing slave devices parsed from the device tree.

---
 drivers/i2c/busses/i2c-i801.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-i801.c +2 -0
index 6f00785..b5311cf 100644
@@ -80,6 +80,7 @@
 #include <linux/slab.h>
 #include <linux/wait.h>
 #include <linux/err.h>
+#include <linux/of_i2c.h>
 
 #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
 #include <linux/gpio.h>
@@ -1238,6 +1239,7 @@ static int __devinit i801_probe(struct pci_dev *dev,
 		goto exit_free_irq;
 	}
 
+	of_i2c_register_devices(&priv->adapter);
 	i801_probe_optional_slaves(priv);
 	/* We ignore errors - multiplexing is optional */
 	i801_add_mux(priv);
Signature · 1 line
1.7.11.4
#1 lore raw
Quoted 4 lines · Thierry Reding

This commit adds support for probing slave devices parsed from the device tree.

How are the devicetree nodes of the slaves connected to this PCI device which should not have a node itself?

Quoted 31 lines
---
 drivers/i2c/busses/i2c-i801.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-i801.c +2 -0
index 6f00785..b5311cf 100644
@@ -80,6 +80,7 @@
 #include <linux/slab.h>
 #include <linux/wait.h>
 #include <linux/err.h>
+#include <linux/of_i2c.h>
 
 #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
 #include <linux/gpio.h>
@@ -1238,6 +1239,7 @@ static int __devinit i801_probe(struct pci_dev *dev,
 		goto exit_free_irq;
 	}
 
+	of_i2c_register_devices(&priv->adapter);
 	i801_probe_optional_slaves(priv);
 	/* We ignore errors - multiplexing is optional */
 	i801_add_mux(priv);
Signature · 6 lines
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw
Quoted 8 lines · Wolfram Sang
Quoted 4 lines · Thierry Reding

This commit adds support for probing slave devices parsed from the device tree.

How are the devicetree nodes of the slaves connected to this PCI device which should not have a node itself?

The matching is done by pci_set_of_node() and pci_set_bus_of_node(). The latter will eventually call pcibios_get_phb_of_node(). What makes you say that PCI devices shouldn't have nodes themselves?

Thierry

#3 lore raw
Quoted 5 lines · Thierry Reding
Quoted 4 lines · Wolfram Sang
Quoted 3 lines · Thierry Reding

This commit adds support for probing slave devices parsed from the device tree.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

How are the devicetree nodes of the slaves connected to this PCI device which should not have a node itself?

The matching is done by pci_set_of_node() and pci_set_bus_of_node(). The latter will eventually call pcibios_get_phb_of_node(). What makes you say that PCI devices shouldn't have nodes themselves?

I thought to recall that busses which can be probed at runtime should not have nodes but should be probed. Maybe that was wrong. Can you point me to a dts-file with an example?

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw
Quoted 11 lines · Wolfram Sang
Quoted 10 lines · Thierry Reding
Quoted 8 lines · Wolfram Sang
Quoted 4 lines · Thierry Reding

This commit adds support for probing slave devices parsed from the device tree.

How are the devicetree nodes of the slaves connected to this PCI device which should not have a node itself?

Quoted 7 lines
Quoted 3 lines

The matching is done by pci_set_of_node() and pci_set_bus_of_node(). The latter will eventually call pcibios_get_phb_of_node(). What makes you say that PCI devices shouldn't have nodes themselves?

I thought to recall that busses which can be probed at runtime should not have nodes but should be probed. Maybe that was wrong. Can you point me to a dts-file with an example?

That approach doesn't work for I2C controllers, though because you couldn't attach an slaves to them. The same goes for SPI controllers or any other dumb busses that can't be probed.

arch/x86/platform/ce4100/falconfalls.dts is an example for an X86 platform where PCI devices have associated device tree nodes.

Thierry

#5 lore raw
Quoted 8 lines
Quoted 4 lines

I thought to recall that busses which can be probed at runtime should not have nodes but should be probed. Maybe that was wrong. Can you point me to a dts-file with an example?

That approach doesn't work for I2C controllers, though because you couldn't attach an slaves to them. The same goes for SPI controllers or any other dumb busses that can't be probed.

I understand the problem. I was wondering how it has been solved. Thanks for the pointer, I got the idea now.

Quoted 2 lines

arch/x86/platform/ce4100/falconfalls.dts is an example for an X86 platform where PCI devices have associated device tree nodes.

Do you intend to send a dts file mainline which needs the patch you sent?

Regards,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#6 lore raw
Quoted 9 lines · Wolfram Sang
Quoted 8 lines
Quoted 4 lines

I thought to recall that busses which can be probed at runtime should not have nodes but should be probed. Maybe that was wrong. Can you point me to a dts-file with an example?

That approach doesn't work for I2C controllers, though because you couldn't attach an slaves to them. The same goes for SPI controllers or any other dumb busses that can't be probed.

Quoted 7 lines

I understand the problem. I was wondering how it has been solved. Thanks for the pointer, I got the idea now.

Quoted 2 lines

arch/x86/platform/ce4100/falconfalls.dts is an example for an X86 platform where PCI devices have associated device tree nodes.

Do you intend to send a dts file mainline which needs the patch you sent?

Yes. I have an x86 platform which has an lm63 temperature sensor connected to the i801. There are a couple of loose ends that I need to take care of before I can send the DTS. I can send it for reference, but it won't be of much use because other things are still missing from the kernel and I don't know in what timeframe they can be applied.

Thierry

Acked-by on v1 1/1
#7 lore raw
In reply to Thierry Reding
Quoted 4 lines · Thierry Reding

This commit adds support for probing slave devices parsed from the device tree.

Jean, this one is for you, I guess?

Quoted 31 lines
---
 drivers/i2c/busses/i2c-i801.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-i801.c +2 -0
index 6f00785..b5311cf 100644
@@ -80,6 +80,7 @@
 #include <linux/slab.h>
 #include <linux/wait.h>
 #include <linux/err.h>
+#include <linux/of_i2c.h>
 
 #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
 #include <linux/gpio.h>
@@ -1238,6 +1239,7 @@ static int __devinit i801_probe(struct pci_dev *dev,
 		goto exit_free_irq;
 	}
 
+	of_i2c_register_devices(&priv->adapter);
 	i801_probe_optional_slaves(priv);
 	/* We ignore errors - multiplexing is optional */
 	i801_add_mux(priv);
Signature · 6 lines
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |