From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-i2c@vger.kernel.org, SH-Linux <linux-sh@vger.kernel.org>,
Wolfram Sang <wsa@the-dreams.de>,
devicetree@vger.kernel.org,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <rob.herring@calxeda.com>
Subject: Re: [PATCH 5/5] i2c: rcar: use per-device clock
Date: Wed, 11 Sep 2013 09:20:21 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.1309110908570.26942@axis700.grange> (raw)
In-Reply-To: <CANqRtoSKOOLs1KiOx1gYU9LAH=K9hzZP8xTkgCF8s1=R0Vm3Yg@mail.gmail.com>
Hi Magnus,
On Wed, 11 Sep 2013, Magnus Damm wrote:
> Hi Guennadi,
>
> On Tue, Sep 10, 2013 at 12:55 AM, Guennadi Liakhovetski
> <g.liakhovetski@gmx.de> wrote:
> > Using the same clock for all device instances is non-portable and obtaining
> > clock references by an ID without using a device pointer is discouraged.
> > This is also not needed, because on platforms, where this driver is used,
> > suitable clocks are available for the I2C controllers, that are children of
> > the peripheral clock and just pass its rate 1-to-1 to controllers. This
> > patch switches the driver to obtain references to correct clocks.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> > ---
> > drivers/i2c/busses/i2c-rcar.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> > index 7e71cf4..7b986cb 100644
> > --- a/drivers/i2c/busses/i2c-rcar.c
> > +++ b/drivers/i2c/busses/i2c-rcar.c
> > @@ -227,7 +227,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
> > u32 bus_speed,
> > struct device *dev)
> > {
> > - struct clk *clkp = clk_get(NULL, "peripheral_clk");
> > + struct clk *clkp = clk_get(dev, NULL);
> > u32 scgd, cdf;
> > u32 round, ick;
> > u32 scl;
>
> I agree that passing struct device to clk_get() is a good idea. Thanks
> for spotting this.
>
> What are the run-time dependencies for this patch? Do all affected I2C
> controllers have MSTP bits with proper parents already, or will this
> patch cause breakage for some SoCs?
Currently (Simon's devel branch of 5 days ago as of commit 5cbe867) I only
see r8a7778 and r8a7779 using i2c-rcar. They both define clocks like
CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
and similarly for I2C1 - I2C3. So, it looks like it should work, but would
be nice to test.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
next prev parent reply other threads:[~2013-09-11 7:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-09 15:55 [PATCH 0/5] i2c: rcar: Device Tree support and clock improvements Guennadi Liakhovetski
2013-09-09 15:55 ` [PATCH 1/5] i2c: rcar: (cosmetic) remove superfluous parenthesis Guennadi Liakhovetski
[not found] ` <1378742120-11135-1-git-send-email-g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>
2013-09-09 15:55 ` [PATCH 2/5] i2c: rcar: get clock rate only once and simplify calculation Guennadi Liakhovetski
2013-09-10 22:37 ` Magnus Damm
[not found] ` <CANqRtoRF8CD4hO4m23dqAtNCKvAqHo-+JhZud43SYePB4w5Ong-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-11 7:03 ` Guennadi Liakhovetski
2013-09-09 15:55 ` [PATCH 5/5] i2c: rcar: use per-device clock Guennadi Liakhovetski
[not found] ` <1378742120-11135-6-git-send-email-g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>
2013-09-10 22:44 ` Magnus Damm
2013-09-11 7:20 ` Guennadi Liakhovetski [this message]
2013-09-09 15:55 ` [PATCH 3/5] i2c: rcar: add Device Tree support Guennadi Liakhovetski
2013-09-10 22:40 ` Magnus Damm
[not found] ` <CANqRtoTrCwd=+m6SPO2TqvvSjEO-m4uMrChxSYs_ZxniA-7dwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-10 22:46 ` Laurent Pinchart
2013-09-10 22:49 ` Magnus Damm
2013-09-11 7:37 ` Guennadi Liakhovetski
2013-09-09 15:55 ` [PATCH 4/5] i2c: rcar: fix clk_get() error handling Guennadi Liakhovetski
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=Pine.LNX.4.64.1309110908570.26942@axis700.grange \
--to=g.liakhovetski@gmx.de \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=rob.herring@calxeda.com \
--cc=wsa@the-dreams.de \
/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).