linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: Tegra: i2c driver
@ 2011-06-21  0:23 John Bonesio
  2011-06-21  4:59 ` Grant Likely
  2011-06-21 17:27 ` Stephen Warren
  0 siblings, 2 replies; 7+ messages in thread
From: John Bonesio @ 2011-06-21  0:23 UTC (permalink / raw)
  To: kradtke-DDmLM1+adcrQT0dZR+AlfA, swarren-DDmLM1+adcrQT0dZR+AlfA,
	lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ, riyer-DDmLM1+adcrQT0dZR+AlfA

This patch modifies the tegra i2c driver so that it can be initiailized
using the device tree along with the devices connected to the i2c bus.

Signed-off-by: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
---

 drivers/i2c/busses/i2c-tegra.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 4d93196..d2393e6 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -26,6 +26,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/i2c-tegra.h>
+#include <linux/of_i2c.h>
 
 #include <asm/unaligned.h>
 
@@ -540,6 +541,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	struct resource *iomem;
 	struct clk *clk;
 	struct clk *i2c_clk;
+	const unsigned int *prop;
 	void *base;
 	int irq;
 	int ret = 0;
@@ -597,7 +599,17 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	i2c_dev->irq = irq;
 	i2c_dev->cont_id = pdev->id;
 	i2c_dev->dev = &pdev->dev;
-	i2c_dev->bus_clk_rate = pdata ? pdata->bus_clk_rate : 100000;
+
+	i2c_dev->bus_clk_rate = 100000; /* default clock rate */
+	if (pdata) {
+		i2c_dev->bus_clk_rate = pdata->bus_clk_rate;
+
+	} else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
+		prop = of_get_property(i2c_dev->dev->of_node,
+				"clock-frequency", NULL);
+		if (prop)
+			i2c_dev->bus_clk_rate = be32_to_cpup(prop);
+	}
 
 	if (pdev->id == 3)
 		i2c_dev->is_dvc = 1;
@@ -627,6 +639,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	i2c_dev->adapter.algo = &tegra_i2c_algo;
 	i2c_dev->adapter.dev.parent = &pdev->dev;
 	i2c_dev->adapter.nr = pdev->id;
+	i2c_dev->adapter.dev.of_node = pdev->dev.of_node;
 
 	ret = i2c_add_numbered_adapter(&i2c_dev->adapter);
 	if (ret) {
@@ -634,6 +647,8 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
+	of_i2c_register_devices(&i2c_dev->adapter);
+
 	return 0;
 err_free_irq:
 	free_irq(i2c_dev->irq, i2c_dev);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: Tegra: i2c driver
  2011-06-21  0:23 [PATCH] ARM: Tegra: i2c driver John Bonesio
@ 2011-06-21  4:59 ` Grant Likely
       [not found]   ` <BANLkTi=aaSnT-incv3FhOZ0Yp8CtYf31mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2011-06-21 17:27 ` Stephen Warren
  1 sibling, 1 reply; 7+ messages in thread
From: Grant Likely @ 2011-06-21  4:59 UTC (permalink / raw)
  To: John Bonesio
  Cc: kradtke-DDmLM1+adcrQT0dZR+AlfA, swarren-DDmLM1+adcrQT0dZR+AlfA,
	lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, riyer-DDmLM1+adcrQT0dZR+AlfA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
	Olof Johansson

On Mon, Jun 20, 2011 at 6:23 PM, John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> This patch modifies the tegra i2c driver so that it can be initiailized
> using the device tree along with the devices connected to the i2c bus.
>
> Signed-off-by: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>
>  drivers/i2c/busses/i2c-tegra.c |   17 ++++++++++++++++-
>  1 files changed, 16 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 4d93196..d2393e6 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -26,6 +26,7 @@
>  #include <linux/delay.h>
>  #include <linux/slab.h>
>  #include <linux/i2c-tegra.h>
> +#include <linux/of_i2c.h>
>
>  #include <asm/unaligned.h>
>
> @@ -540,6 +541,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
>        struct resource *iomem;
>        struct clk *clk;
>        struct clk *i2c_clk;
> +       const unsigned int *prop;
>        void *base;
>        int irq;
>        int ret = 0;
> @@ -597,7 +599,17 @@ static int tegra_i2c_probe(struct platform_device *pdev)
>        i2c_dev->irq = irq;
>        i2c_dev->cont_id = pdev->id;
>        i2c_dev->dev = &pdev->dev;
> -       i2c_dev->bus_clk_rate = pdata ? pdata->bus_clk_rate : 100000;
> +
> +       i2c_dev->bus_clk_rate = 100000; /* default clock rate */
> +       if (pdata) {
> +               i2c_dev->bus_clk_rate = pdata->bus_clk_rate;
> +
> +       } else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
> +               prop = of_get_property(i2c_dev->dev->of_node,
> +                               "clock-frequency", NULL);
> +               if (prop)
> +                       i2c_dev->bus_clk_rate = be32_to_cpup(prop);
> +       }
>
>        if (pdev->id == 3)
>                i2c_dev->is_dvc = 1;
> @@ -627,6 +639,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
>        i2c_dev->adapter.algo = &tegra_i2c_algo;
>        i2c_dev->adapter.dev.parent = &pdev->dev;
>        i2c_dev->adapter.nr = pdev->id;
> +       i2c_dev->adapter.dev.of_node = pdev->dev.of_node;
>
>        ret = i2c_add_numbered_adapter(&i2c_dev->adapter);
>        if (ret) {
> @@ -634,6 +647,8 @@ static int tegra_i2c_probe(struct platform_device *pdev)
>                goto err_free_irq;
>        }
>
> +       of_i2c_register_devices(&i2c_dev->adapter);
> +
>        return 0;
>  err_free_irq:
>        free_irq(i2c_dev->irq, i2c_dev);
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] ARM: Tegra: i2c driver
  2011-06-21  0:23 [PATCH] ARM: Tegra: i2c driver John Bonesio
  2011-06-21  4:59 ` Grant Likely
@ 2011-06-21 17:27 ` Stephen Warren
       [not found]   ` <74CDBE0F657A3D45AFBB94109FB122FF049D2EB8AD-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Stephen Warren @ 2011-06-21 17:27 UTC (permalink / raw)
  To: John Bonesio, Ken Radtke,
	lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw@public.gmane.org,
	"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org" <devicetree>

John Bonesio wrote at Monday, June 20, 2011 6:23 PM:
> This patch modifies the tegra i2c driver so that it can be initiailized
> using the device tree along with the devices connected to the i2c bus.

The patch title "ARM: Tegra: i2c driver" doesn't really describe what the
patch does and has the wrong tag; It sounds like adding a new driver.
Perhaps "i2c: Tegra: Add DeviceTree support"?

The code looks fine.

-- 
nvpublic


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: Tegra: i2c driver
       [not found]   ` <74CDBE0F657A3D45AFBB94109FB122FF049D2EB8AD-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
@ 2011-06-21 18:24     ` Grant Likely
  0 siblings, 0 replies; 7+ messages in thread
From: Grant Likely @ 2011-06-21 18:24 UTC (permalink / raw)
  To: Stephen Warren
  Cc: John Bonesio, Ken Radtke,
	lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rakesh Iyer,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
	khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org

On Tue, Jun 21, 2011 at 11:27 AM, Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> John Bonesio wrote at Monday, June 20, 2011 6:23 PM:
>> This patch modifies the tegra i2c driver so that it can be initiailized
>> using the device tree along with the devices connected to the i2c bus.
>
> The patch title "ARM: Tegra: i2c driver" doesn't really describe what the
> patch does and has the wrong tag; It sounds like adding a new driver.
> Perhaps "i2c: Tegra: Add DeviceTree support"?

Yes, sounds appropriate to me.

g.

>
> The code looks fine.
>
> --
> nvpublic
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: Tegra: i2c driver
       [not found]   ` <BANLkTi=aaSnT-incv3FhOZ0Yp8CtYf31mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-06-21 22:11     ` Olof Johansson
       [not found]       ` <BANLkTinJOf+L1kE9gQ99=uA_HK2_+Hts-AyAD8QuWNAa-rZ9+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Olof Johansson @ 2011-06-21 22:11 UTC (permalink / raw)
  To: Grant Likely
  Cc: John Bonesio, kradtke-DDmLM1+adcrQT0dZR+AlfA,
	swarren-DDmLM1+adcrQT0dZR+AlfA,
	lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, riyer-DDmLM1+adcrQT0dZR+AlfA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
	Olof Johansson

On Mon, Jun 20, 2011 at 9:59 PM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> On Mon, Jun 20, 2011 at 6:23 PM, John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>> This patch modifies the tegra i2c driver so that it can be initiailized
>> using the device tree along with the devices connected to the i2c bus.
>>
>> Signed-off-by: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>
> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

Acked-by: OIof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>


(with the same suggestion to change subject as Stephen/Grant discussed
later in the thread).


-Olof

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: Tegra: i2c driver
       [not found]       ` <BANLkTinJOf+L1kE9gQ99=uA_HK2_+Hts-AyAD8QuWNAa-rZ9+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-06-21 22:34         ` Grant Likely
       [not found]           ` <BANLkTi=S8ddKE_ahHXDhW75hhPohqS+gRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Grant Likely @ 2011-06-21 22:34 UTC (permalink / raw)
  To: Olof Johansson
  Cc: John Bonesio, kradtke-DDmLM1+adcrQT0dZR+AlfA,
	swarren-DDmLM1+adcrQT0dZR+AlfA,
	lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, riyer-DDmLM1+adcrQT0dZR+AlfA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
	Olof Johansson

On Tue, Jun 21, 2011 at 4:11 PM, Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org> wrote:
> On Mon, Jun 20, 2011 at 9:59 PM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>> On Mon, Jun 20, 2011 at 6:23 PM, John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>>> This patch modifies the tegra i2c driver so that it can be initiailized
>>> using the device tree along with the devices connected to the i2c bus.
>>>
>>> Signed-off-by: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>>
>> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>
> Acked-by: OIof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
>
>
> (with the same suggestion to change subject as Stephen/Grant discussed
> later in the thread).

Ben, would you like a new patch with the new subject line, or will you
fix it up when you merge it?

g.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: Tegra: i2c driver
       [not found]           ` <BANLkTi=S8ddKE_ahHXDhW75hhPohqS+gRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-06-22 10:44             ` Ben Dooks
  0 siblings, 0 replies; 7+ messages in thread
From: Ben Dooks @ 2011-06-22 10:44 UTC (permalink / raw)
  To: Grant Likely
  Cc: Olof Johansson, John Bonesio, kradtke-DDmLM1+adcrQT0dZR+AlfA,
	swarren-DDmLM1+adcrQT0dZR+AlfA,
	lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, riyer-DDmLM1+adcrQT0dZR+AlfA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
	Olof Johansson

On Tue, Jun 21, 2011 at 04:34:46PM -0600, Grant Likely wrote:
> On Tue, Jun 21, 2011 at 4:11 PM, Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org> wrote:
> > On Mon, Jun 20, 2011 at 9:59 PM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> >> On Mon, Jun 20, 2011 at 6:23 PM, John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> >>> This patch modifies the tegra i2c driver so that it can be initiailized
> >>> using the device tree along with the devices connected to the i2c bus.
> >>>
> >>> Signed-off-by: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> >>
> >> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> >
> > Acked-by: OIof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
> >
> >
> > (with the same suggestion to change subject as Stephen/Grant discussed
> > later in the thread).
> 
> Ben, would you like a new patch with the new subject line, or will you
> fix it up when you merge it?

Would prefer to see a new subject line.
 
-- 
Ben Dooks, ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-22 10:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21  0:23 [PATCH] ARM: Tegra: i2c driver John Bonesio
2011-06-21  4:59 ` Grant Likely
     [not found]   ` <BANLkTi=aaSnT-incv3FhOZ0Yp8CtYf31mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-21 22:11     ` Olof Johansson
     [not found]       ` <BANLkTinJOf+L1kE9gQ99=uA_HK2_+Hts-AyAD8QuWNAa-rZ9+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-21 22:34         ` Grant Likely
     [not found]           ` <BANLkTi=S8ddKE_ahHXDhW75hhPohqS+gRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-22 10:44             ` Ben Dooks
2011-06-21 17:27 ` Stephen Warren
     [not found]   ` <74CDBE0F657A3D45AFBB94109FB122FF049D2EB8AD-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-06-21 18:24     ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).