2012-08-08 07:07:12

by Thierry Reding

[permalink] [raw]
Subject: [PATCH] i2c-i801: Add device tree support

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

Signed-off-by: Thierry Reding <[email protected]>
---
drivers/i2c/busses/i2c-i801.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 6f00785..b5311cf 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -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);
--
1.7.11.4


2012-08-18 09:49:18

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support

On Wed, Aug 08, 2012 at 09:06:47AM +0200, Thierry Reding wrote:
> This commit adds support for probing slave devices parsed from the
> device tree.
>
> Signed-off-by: Thierry Reding <[email protected]>

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

> ---
> drivers/i2c/busses/i2c-i801.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 6f00785..b5311cf 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -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);
> --
> 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

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |


Attachments:
(No filename) (1.44 kB)
signature.asc (198.00 B)
Digital signature
Download all attachments

2012-08-18 11:18:08

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support

On Sat, Aug 18, 2012 at 11:48:46AM +0200, Wolfram Sang wrote:
> On Wed, Aug 08, 2012 at 09:06:47AM +0200, Thierry Reding wrote:
> > This commit adds support for probing slave devices parsed from the
> > device tree.
> >
> > Signed-off-by: Thierry Reding <[email protected]>
>
> 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


Attachments:
(No filename) (613.00 B)
(No filename) (836.00 B)
Download all attachments

2012-08-18 12:16:39

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support

On Sat, Aug 18, 2012 at 01:17:45PM +0200, Thierry Reding wrote:
> On Sat, Aug 18, 2012 at 11:48:46AM +0200, Wolfram Sang wrote:
> > On Wed, Aug 08, 2012 at 09:06:47AM +0200, Thierry Reding wrote:
> > > This commit adds support for probing slave devices parsed from the
> > > device tree.
> > >
> > > Signed-off-by: Thierry Reding <[email protected]>
> >
> > 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?

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |


Attachments:
(No filename) (1.00 kB)
signature.asc (198.00 B)
Digital signature
Download all attachments

2012-08-18 12:35:54

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support

On Sat, Aug 18, 2012 at 02:16:28PM +0200, Wolfram Sang wrote:
> On Sat, Aug 18, 2012 at 01:17:45PM +0200, Thierry Reding wrote:
> > On Sat, Aug 18, 2012 at 11:48:46AM +0200, Wolfram Sang wrote:
> > > On Wed, Aug 08, 2012 at 09:06:47AM +0200, Thierry Reding wrote:
> > > > This commit adds support for probing slave devices parsed from the
> > > > device tree.
> > > >
> > > > Signed-off-by: Thierry Reding <[email protected]>
> > >
> > > 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?

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


Attachments:
(No filename) (1.26 kB)
(No filename) (836.00 B)
Download all attachments

2012-08-18 19:02:08

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support


> > 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.

> 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

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |


Attachments:
(No filename) (878.00 B)
signature.asc (198.00 B)
Digital signature
Download all attachments

2012-08-20 07:13:32

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support

On Sat, Aug 18, 2012 at 09:01:52PM +0200, Wolfram Sang wrote:
>
> > > 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.
>
> > 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


Attachments:
(No filename) (1.12 kB)
(No filename) (836.00 B)
Download all attachments

2012-08-21 08:35:23

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support

On Wed, Aug 08, 2012 at 09:06:47AM +0200, Thierry Reding wrote:
> This commit adds support for probing slave devices parsed from the
> device tree.
>
> Signed-off-by: Thierry Reding <[email protected]>

Acked-by: Wolfram Sang <[email protected]>

Jean, this one is for you, I guess?

> ---
> drivers/i2c/busses/i2c-i801.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 6f00785..b5311cf 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -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);
> --
> 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

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |


Attachments:
(No filename) (1.41 kB)
signature.asc (198.00 B)
Digital signature
Download all attachments

2012-10-15 07:37:02

by Jean Delvare

[permalink] [raw]
Subject: Re: [PATCH] i2c-i801: Add device tree support

On Tue, 21 Aug 2012 10:29:06 +0200, Wolfram Sang wrote:
> On Wed, Aug 08, 2012 at 09:06:47AM +0200, Thierry Reding wrote:
> > This commit adds support for probing slave devices parsed from the
> > device tree.
> >
> > Signed-off-by: Thierry Reding <[email protected]>
>
> Acked-by: Wolfram Sang <[email protected]>
>
> Jean, this one is for you, I guess?

Yes, sorry for the delay, applied.

--
Jean Delvare