From: "Jon Smirl" <jonsmirl@gmail.com>
To: "Wolfgang Grandegger" <wg@grandegger.com>
Cc: Scott Wood <scottwood@freescale.com>,
Timur Tabi <timur@freescale.com>, Linux I2C <i2c@lm-sensors.org>,
Linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] powerpc: i2c-mpc: make speed registers configurable via FDT
Date: Thu, 31 Jul 2008 16:32:01 -0400 [thread overview]
Message-ID: <9e4733910807311332q611b43b3y26f64b5269ccb657@mail.gmail.com> (raw)
In-Reply-To: <48921DED.6010403@grandegger.com>
On 7/31/08, Wolfgang Grandegger <wg@grandegger.com> wrote:
> Timur Tabi wrote:
>
> > Wolfgang Grandegger wrote:
> >
> >
> > > But clock-frequency, aka bus-frequency, is already used by
> fsl_get_sys_freq():
> > >
> > >
> http://lxr.linux.no/linux+v2.6.26/arch/powerpc/sysdev/fsl_soc.c#L80
> > >
> >
> > So? clock-frequency is a per-node property. I use it in the codec node
> on the
> > 8610 (mpc8610_hpcd.dts). It does not mean "platform clock frequency".
> >
> >
> > > U-Boot could then fixup that value like bus-frequency() and the i2c-mpc
> driver simply calls fsl_get_i2c_freq().
> > >
> >
> > This is just more complicated than it needs to be. Why should the I2C
> driver
> > fetch the platform clock and the divider from the parent node, and then do
> > additional math, when it could just get the value it needs right from the
> node
> > it's probing?
> >
>
> I'm a bit confused. The frequency of the I2C source clock and the real I2C
> clock frequency are two different things. The first one is common for all
> I2C devices, the second can be different. What properties would you like to
> use for defining both?
For mpc5200 it is easy, mpc52xx_find_ipb_freq() already exists to get
the source clock for the i2c devices. Each i2c node in the device tree
can then specify "clock-frequency = 400000;" or let it default. You
have the input clock and the desired clock, do some math and you can
set FDR.
For the 8xxx chips there is no simple solution for obtain the input
clock for the i2c section. Maybe create something like i2c-frequency
and set it from uboot. The make another accessor function like
mpc8xxx_find_i2c_freq().
PowerPC,8xxx@0 {
timebase-frequency = <0>; /* From Bootloader */
bus-frequency = <0>; /* From Bootloader */
clock-frequency = <0>; /* From Bootloader */
i2c-frequency = <0>; /* From Bootloader */
};
Instead of creating i2c-frequency in the device tree, you could put
this piece of code in the the mpc8xxx platform driver and use it to
implement mpc8xxx_find_i2c_freq(). Read the PORDEVSR2_SEC_CFG bit back
from whatever uboot set it too.
#if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
defined(CONFIG_MPC8560) || defined(CONFIG_MPC8555)
gd->i2c1_clk = sys_info.freqSystemBus;
#elif defined(CONFIG_MPC8544)
/*
* On the 8544, the I2C clock is the same as the SEC clock. This can be
* either CCB/2 or CCB/3, depending on the value of cfg_sec_freq. See
* 4.4.3.3 of the 8544 RM. Note that this might actually work for all
* 85xx, but only the 8544 has cfg_sec_freq, so it's unknown if the
* PORDEVSR2_SEC_CFG bit is 0 on all 85xx boards that are not an 8544.
*/
if (gur->pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG)
gd->i2c1_clk = sys_info.freqSystemBus / 3;
else
gd->i2c1_clk = sys_info.freqSystemBus / 2;
#else
/* Most 85xx SOCs use CCB/2, so this is the default behavior. */
gd->i2c1_clk = sys_info.freqSystemBus / 2;
#endif
gd->i2c2_clk = gd->i2c1_clk;
--
Jon Smirl
jonsmirl@gmail.com
next prev parent reply other threads:[~2008-07-31 20:32 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 7:37 [PATCH] powerpc: i2c-mpc: make speed registers configurable via FDT Wolfgang Grandegger
2008-07-25 8:51 ` Jochen Friedrich
2008-07-25 9:04 ` Wolfgang Grandegger
2008-07-25 13:12 ` Grant Likely
2008-07-25 14:21 ` Timur Tabi
2008-07-25 15:04 ` Jon Smirl
2008-07-25 15:23 ` Wolfgang Grandegger
2008-07-25 16:19 ` Timur Tabi
2008-07-27 1:27 ` Grant Likely
2008-07-31 11:51 ` Wolfgang Grandegger
2008-07-31 15:49 ` Jon Smirl
2008-07-31 15:55 ` Timur Tabi
2008-07-31 23:32 ` [i2c] " Trent Piepho
2008-08-01 13:17 ` Timur Tabi
2008-08-01 15:47 ` Scott Wood
2008-08-01 19:47 ` Trent Piepho
2008-08-01 19:50 ` Timur Tabi
2008-07-31 17:22 ` Wolfgang Grandegger
2008-07-31 17:31 ` Grant Likely
2008-07-31 17:51 ` Wolfgang Grandegger
2008-07-31 17:54 ` Timur Tabi
2008-07-31 18:07 ` Wolfgang Grandegger
2008-07-31 18:06 ` Timur Tabi
2008-07-31 18:07 ` Grant Likely
2008-07-31 18:10 ` Timur Tabi
2008-07-31 18:21 ` Grant Likely
2008-07-31 18:09 ` Grant Likely
2008-07-31 18:13 ` Timur Tabi
2008-07-31 18:28 ` Grant Likely
2008-07-31 18:35 ` Timur Tabi
2008-07-31 18:57 ` Jon Smirl
2008-07-31 19:01 ` Timur Tabi
2008-07-31 19:25 ` Grant Likely
2008-08-01 0:22 ` [i2c] " Trent Piepho
2008-08-01 1:19 ` Jon Smirl
2008-08-01 1:36 ` Trent Piepho
2008-08-01 1:44 ` Jon Smirl
2008-08-01 15:02 ` Timur Tabi
2008-08-01 16:05 ` Jon Smirl
2008-08-01 7:29 ` Wolfgang Grandegger
2008-08-01 2:03 ` Grant Likely
2008-08-01 2:35 ` Jon Smirl
2008-08-01 13:25 ` Timur Tabi
2008-08-01 14:28 ` Jon Smirl
2008-08-01 14:32 ` Jon Smirl
2008-08-01 21:14 ` Trent Piepho
2008-08-01 7:25 ` Wolfgang Grandegger
2008-08-01 14:38 ` Grant Likely
2008-07-31 19:01 ` Scott Wood
2008-07-31 19:08 ` Timur Tabi
2008-07-31 19:15 ` Scott Wood
2008-07-31 19:19 ` Timur Tabi
2008-07-31 19:21 ` Scott Wood
2008-07-31 19:22 ` Timur Tabi
2008-07-31 19:11 ` Jon Smirl
2008-07-31 19:14 ` Grant Likely
2008-07-31 19:24 ` Wolfgang Grandegger
2008-07-31 19:24 ` Timur Tabi
2008-07-31 19:54 ` Wolfgang Grandegger
2008-07-31 19:58 ` Timur Tabi
2008-07-31 20:17 ` Wolfgang Grandegger
2008-07-31 20:19 ` Timur Tabi
2008-07-31 20:28 ` Wolfgang Grandegger
2008-07-31 20:28 ` Timur Tabi
2008-07-31 20:30 ` Grant Likely
2008-07-31 20:32 ` Jon Smirl [this message]
2008-07-31 20:35 ` Grant Likely
2008-07-31 20:37 ` Timur Tabi
2008-07-31 20:48 ` Grant Likely
2008-07-31 20:55 ` Jon Smirl
2008-07-31 20:56 ` Scott Wood
2008-07-31 20:56 ` Timur Tabi
2008-07-31 21:03 ` Jon Smirl
2008-07-31 21:10 ` Timur Tabi
2008-07-31 21:14 ` Wolfgang Grandegger
2008-07-31 21:17 ` Timur Tabi
2008-08-01 1:16 ` [i2c] " Trent Piepho
2008-08-01 0:57 ` Trent Piepho
2008-07-31 20:35 ` Timur Tabi
2008-07-31 20:43 ` Jon Smirl
2008-07-31 20:44 ` Timur Tabi
2008-07-31 19:59 ` Grant Likely
2008-07-31 20:00 ` Timur Tabi
2008-07-31 20:20 ` Wolfgang Grandegger
2008-07-31 20:19 ` Timur Tabi
2008-08-01 0:46 ` [i2c] " Trent Piepho
2008-08-01 14:34 ` Grant Likely
2008-08-01 14:48 ` Geert Uytterhoeven
2008-07-31 17:35 ` Jon Smirl
2008-07-31 16:51 ` Grant Likely
2008-07-31 17:06 ` Jon Smirl
2008-07-31 17:36 ` Grant Likely
2008-07-31 17:47 ` Jon Smirl
2008-07-31 17:24 ` Wolfgang Grandegger
2008-07-25 15:34 ` Wolfgang Grandegger
2008-07-27 1:25 ` Grant Likely
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=9e4733910807311332q611b43b3y26f64b5269ccb657@mail.gmail.com \
--to=jonsmirl@gmail.com \
--cc=Linuxppc-dev@ozlabs.org \
--cc=i2c@lm-sensors.org \
--cc=scottwood@freescale.com \
--cc=timur@freescale.com \
--cc=wg@grandegger.com \
/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).