Linux I2C development
 help / color / mirror / Atom feed
* Re: [PATCH v2] powerpc: i2c-mpc: make I2C bus speed configurable
       [not found] ` <fa686aa40904010644t1c111c05ka7349869eb155429@mail.gmail.com>
@ 2009-04-01 13:47   ` Grant Likely
       [not found]     ` <fa686aa40904010647o57b59845p54a9c1e1535e4453-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Grant Likely @ 2009-04-01 13:47 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: linuxppc-dev, devicetree-discuss, linux-i2c, Ben Dooks

On Wed, Apr 1, 2009 at 7:44 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Wed, Apr 1, 2009 at 7:13 AM, Wolfgang Grandegger <wg@grandegger.com> wrote:
>> This patch makes the I2C bus speed configurable by using the I2C node
>> property "clock-frequency". If the property is not defined, the old
>> fixed clock settings will be used for backward compatibility.
>
> I mostly like this patch.  However, as I mentioned in my other reply,
> I'm going to NAK it because the divisor tables are not common code and
> do not belong in common code files.
>
> Other than that, I like this version of the patch and I think it is
> almost finished.  More comments below.

Oh, and you should look in MAINTAINERS and cc this patch to Ben Dooks
and the linux-i2c@vger.kernel.org mailing list.

g.

>
>> -static void mpc_i2c_setclock(struct mpc_i2c *i2c)
>> -{
>> -       /* Set clock and filters */
>> -       if (i2c->flags & FSL_I2C_DEV_SEPARATE_DFSRR) {
>> -               writeb(0x31, i2c->base + MPC_I2C_FDR);
>> -               writeb(0x10, i2c->base + MPC_I2C_DFSRR);
>> -       } else if (i2c->flags & FSL_I2C_DEV_CLOCK_5200)
>> -               writeb(0x3f, i2c->base + MPC_I2C_FDR);
>> -       else
>> -               writel(0x1031, i2c->base + MPC_I2C_FDR);
>> +static void mpc_i2c_setclock_52xx(struct device_node *node,
>> +                                 struct mpc_i2c *i2c,
>> +                                 u32 clock, u32 prescaler)
>> +{
>> +       int fdr = mpc52xx_i2c_get_fdr(node, clock, prescaler);
>> +
>> +       if (fdr < 0)
>> +               fdr = 0x3f; /* backward compatibility */
>> +       writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
>> +       dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr);
>> +}
>> +
>> +static void mpc_i2c_setclock_8xxx(struct device_node *node,
>> +                                 struct mpc_i2c *i2c,
>> +                                 u32 clock, u32 prescaler)
>> +{
>> +       int fdr = fsl_i2c_get_fdr(node, clock, prescaler);
>> +
>> +       if (fdr < 0)
>> +               fdr = 0x1031; /* backward compatibility */
>> +       writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
>> +       writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR);
>> +       dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n",
>> +                clock, fdr >> 8, fdr & 0xff);
>>  }
>
> Very neat and tidy indeed.  I like this.
>
>> Index: linux-2.6/arch/powerpc/sysdev/fsl_soc.c
>> ===================================================================
>> --- linux-2.6.orig/arch/powerpc/sysdev/fsl_soc.c        2009-03-31 21:27:52.000000000 +0200
>> +++ linux-2.6/arch/powerpc/sysdev/fsl_soc.c     2009-04-01 12:09:18.796719327 +0200
>> @@ -39,7 +39,7 @@
>>  #include <sysdev/fsl_soc.h>
>>  #include <mm/mmu_decl.h>
>>  #include <asm/cpm2.h>
>> -
>> +#define DEBUG
>  ^^^^^^^^^^^^^^^^^^^^^^^  oops?
>
> g.
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>



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

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

* Re: [PATCH v2] powerpc: i2c-mpc: make I2C bus speed configurable
       [not found]     ` <fa686aa40904010647o57b59845p54a9c1e1535e4453-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-04-01 15:51       ` Wolfgang Grandegger
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Grandegger @ 2009-04-01 15:51 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, Ben Dooks,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

Grant Likely wrote:
> On Wed, Apr 1, 2009 at 7:44 AM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>> On Wed, Apr 1, 2009 at 7:13 AM, Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> wrote:
>>> This patch makes the I2C bus speed configurable by using the I2C node
>>> property "clock-frequency". If the property is not defined, the old
>>> fixed clock settings will be used for backward compatibility.
>> I mostly like this patch.  However, as I mentioned in my other reply,
>> I'm going to NAK it because the divisor tables are not common code and
>> do not belong in common code files.
>>
>> Other than that, I like this version of the patch and I think it is
>> almost finished.  More comments below.

Looks good now, indeed.

> Oh, and you should look in MAINTAINERS and cc this patch to Ben Dooks
> and the linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org mailing list.

Right, and I need to separate I2C and PowerPC related patches. And it
will require another round but some acked-by lines will help.

>>> -static void mpc_i2c_setclock(struct mpc_i2c *i2c)
>>> -{
>>> -       /* Set clock and filters */
>>> -       if (i2c->flags & FSL_I2C_DEV_SEPARATE_DFSRR) {
>>> -               writeb(0x31, i2c->base + MPC_I2C_FDR);
>>> -               writeb(0x10, i2c->base + MPC_I2C_DFSRR);
>>> -       } else if (i2c->flags & FSL_I2C_DEV_CLOCK_5200)
>>> -               writeb(0x3f, i2c->base + MPC_I2C_FDR);
>>> -       else
>>> -               writel(0x1031, i2c->base + MPC_I2C_FDR);
>>> +static void mpc_i2c_setclock_52xx(struct device_node *node,
>>> +                                 struct mpc_i2c *i2c,
>>> +                                 u32 clock, u32 prescaler)
>>> +{
>>> +       int fdr = mpc52xx_i2c_get_fdr(node, clock, prescaler);
>>> +
>>> +       if (fdr < 0)
>>> +               fdr = 0x3f; /* backward compatibility */
>>> +       writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
>>> +       dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr);
>>> +}
>>> +
>>> +static void mpc_i2c_setclock_8xxx(struct device_node *node,
>>> +                                 struct mpc_i2c *i2c,
>>> +                                 u32 clock, u32 prescaler)
>>> +{
>>> +       int fdr = fsl_i2c_get_fdr(node, clock, prescaler);
>>> +
>>> +       if (fdr < 0)
>>> +               fdr = 0x1031; /* backward compatibility */
>>> +       writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
>>> +       writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR);
>>> +       dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n",
>>> +                clock, fdr >> 8, fdr & 0xff);
>>>  }
>> Very neat and tidy indeed.  I like this.

Yep.

>>> Index: linux-2.6/arch/powerpc/sysdev/fsl_soc.c
>>> ===================================================================
>>> --- linux-2.6.orig/arch/powerpc/sysdev/fsl_soc.c        2009-03-31 21:27:52.000000000 +0200
>>> +++ linux-2.6/arch/powerpc/sysdev/fsl_soc.c     2009-04-01 12:09:18.796719327 +0200
>>> @@ -39,7 +39,7 @@
>>>  #include <sysdev/fsl_soc.h>
>>>  #include <mm/mmu_decl.h>
>>>  #include <asm/cpm2.h>
>>> -
>>> +#define DEBUG
>>  ^^^^^^^^^^^^^^^^^^^^^^^  oops?

Will fix.

Wolfgang.

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

end of thread, other threads:[~2009-04-01 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <49D36885.9070806@grandegger.com>
     [not found] ` <fa686aa40904010644t1c111c05ka7349869eb155429@mail.gmail.com>
2009-04-01 13:47   ` [PATCH v2] powerpc: i2c-mpc: make I2C bus speed configurable Grant Likely
     [not found]     ` <fa686aa40904010647o57b59845p54a9c1e1535e4453-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-01 15:51       ` Wolfgang Grandegger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox