From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: kradtke-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
riyer-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org
Subject: Re: [PATCH] i2c: Tegra: Add DeviceTree support
Date: Tue, 28 Jun 2011 16:16:31 -0600 [thread overview]
Message-ID: <BANLkTim3_3SA3-F2qLhMdGns2sPijh07Yw@mail.gmail.com> (raw)
In-Reply-To: <20110622161656.30052.33366.stgit@riker>
On Wed, Jun 22, 2011 at 10:16 AM, 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>
I just noticed something. This patch is incomplete because it does
not have the of_match_table addition (that bit showed up in the 'fill
in' patch that you sent me privately.) Please respin and include the
of_match_table hunk.
Thanks,
g.
> ---
>
> 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.
next prev parent reply other threads:[~2011-06-28 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 16:16 [PATCH] i2c: Tegra: Add DeviceTree support John Bonesio
2011-06-28 22:16 ` Grant Likely [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-06-28 23:22 John Bonesio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTim3_3SA3-F2qLhMdGns2sPijh07Yw@mail.gmail.com \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=kradtke-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lucas.demarchi-Y3ZbgMPKUGA34EUeqzHoZw@public.gmane.org \
--cc=riyer-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).