All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 3/5] i2c: i2c-mpc: make I2C bus speed configurable
Date: Wed, 7 Nov 2012 10:40:47 -0600	[thread overview]
Message-ID: <509A8F0F.4070806@freescale.com> (raw)
In-Reply-To: <20090407082231.500525932-ynQEQJNshbs@public.gmane.org>

Wolfgang,

I know it's been 3 1/2 years since you wrote this code, but I think I
found a bug.

On Tue, Apr 7, 2009 at 3:20 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 comptibility.
>
> The generic I2C clock properties, especially the CPU-specific source
> clock pre-scaler are defined via the OF match table:
>
>   static const struct of_device_id mpc_i2c_of_match[] = {
>         ...
>         {.compatible = "fsl,mpc8543-i2c",
>          .data = &(struct fsl_i2c_match_data) {
>                         .setclock = mpc_i2c_setclock_8xxx,
>                         .prescaler = 2,
>                 },
>         },
>
> The "data" field defines the relevant I2C setclock function and the
> relevant pre-scaler for the I2C source clock frequency.
>
> It uses arch-specific tables and functions to determine resonable
> Freqency Divider Register (fdr) values for MPC83xx, MPC85xx, MPC86xx,
> MPC5200 and MPC5200B.
>
> The i2c->flags field and the corresponding FSL_I2C_DEV_* definitions
> have been removed as they are obsolete.
>
> Signed-off-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

...

> +u32 mpc_i2c_get_sec_cfg_8xxx(void)
> +{
> +       struct device_node *node = NULL;
> +       u32 __iomem *reg;
> +       u32 val = 0;
> +
> +       node = of_find_node_by_name(NULL, "global-utilities");
> +       if (node) {
> +               const u32 *prop = of_get_property(node, "reg", NULL);
> +               if (prop) {
> +                       /*
> +                        * Map and check POR Device Status Register 2
> +                        * (PORDEVSR2) at 0xE0014
> +                        */
> +                       reg = ioremap(get_immrbase() + *prop + 0x14, 0x4);
> +                       if (!reg)
> +                               printk(KERN_ERR
> +                                      "Error: couldn't map PORDEVSR2\n");
> +                       else
> +                               val = in_be32(reg) & 0x00000080; /* sec-cfg */

I'm looking at the MPC8544 reference manual, and PORDEVSR2[SEC_CFG] is
in position 26, which means that this line should be "& 0x20", not "&
0x80".

Can you check this for me and let me know if I'm right?

> +                       iounmap(reg);
> +               }
> +       }
> +       if (node)
> +               of_node_put(node);
> +
> +       return val;
> +}

-- 
Timur Tabi
Linux kernel developer at Freescale

  parent reply	other threads:[~2012-11-07 16:40 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07  8:20 [PATCH v3 0/5] i2c: i2c-mpc: make I2C bus speed configurable Wolfgang Grandegger
2009-04-07  8:20 ` [PATCH v3 1/5] i2c: i2c-mpc: various coding style fixes Wolfgang Grandegger
2009-04-07  8:20   ` Wolfgang Grandegger
     [not found]   ` <20090407082231.177941706-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:36     ` Grant Likely
2009-04-07 15:36       ` Grant Likely
2009-04-07  8:20 ` [PATCH v3 2/5] i2c: i2c-mpc: use dev based printout function Wolfgang Grandegger
2009-04-07  8:20   ` Wolfgang Grandegger
     [not found]   ` <20090407082231.335327816-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:37     ` Grant Likely
2009-04-07 15:37       ` Grant Likely
2009-04-07  8:20 ` [PATCH v3 3/5] i2c: i2c-mpc: make I2C bus speed configurable Wolfgang Grandegger
2009-04-07  8:20   ` Wolfgang Grandegger
     [not found]   ` <20090407082231.500525932-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:36     ` Grant Likely
2009-04-07 15:36       ` Grant Likely
2012-11-01 19:19     ` Tabi Timur-B04825
2012-11-07 16:40     ` Timur Tabi [this message]
     [not found]       ` <509A8F0F.4070806-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-11-16 13:29         ` Wolfram Sang
     [not found]           ` <20121116132939.GB7313-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-16 16:09             ` Timur Tabi
2009-04-07  8:20 ` [PATCH v3 4/5] powerpc: i2c-mpc: document new FSL I2C bindings and cleanup Wolfgang Grandegger
2009-04-07  8:20   ` Wolfgang Grandegger
     [not found]   ` <20090407082231.646648985-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:43     ` Grant Likely
2009-04-07 15:43       ` Grant Likely
2009-04-08  5:13     ` Kumar Gala
2009-04-08  5:13       ` Kumar Gala
2009-04-07  8:20 ` [PATCH v3 5/5] powerpc/85xx: i2c-mpc: use new I2C bindings for the Socates board Wolfgang Grandegger
2009-04-07  8:20   ` Wolfgang Grandegger
     [not found]   ` <20090407082231.803193635-ynQEQJNshbs@public.gmane.org>
2009-04-07 15:43     ` Grant Likely
2009-04-07 15:43       ` Grant Likely
2009-04-08  7:16       ` Wolfgang Grandegger
2009-04-08 14:53         ` Grant Likely
2009-04-08 14:53           ` Grant Likely
     [not found]           ` <fa686aa40904080753p2b282338r9ba463c47f897fb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-08 18:27             ` Wolfgang Grandegger
2009-04-08 18:27               ` Wolfgang Grandegger
     [not found]               ` <49DCEC80.2050507-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-08 18:43                 ` Kumar Gala
2009-04-08 18:43                   ` Kumar Gala
     [not found]                   ` <C3323B74-40FE-41BC-A49C-C94D7DB3FF5A-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08 18:53                     ` Wolfgang Grandegger
2009-04-08 18:53                       ` Wolfgang Grandegger
     [not found] ` <20090407082052.477328750-ynQEQJNshbs@public.gmane.org>
2009-04-08  5:11   ` [PATCH v3 0/5] i2c: i2c-mpc: make I2C bus speed configurable Kumar Gala
2009-04-08  5:11     ` Kumar Gala
     [not found]     ` <53B42D49-C040-442E-8448-7BC3190220A5-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08  5:16       ` Grant Likely
2009-04-08  5:16         ` Grant Likely
2009-04-08  5:22         ` Kumar Gala
2009-04-08  5:32           ` Grant Likely
2009-04-08  5:32             ` Grant Likely
     [not found]           ` <5FDB097C-7D71-41DF-A4F4-2DE34FD710C5-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08  7:21             ` Wolfgang Grandegger
2009-04-08  7:21               ` Wolfgang Grandegger
2009-04-08 17:03           ` Scott Wood
2009-04-08 17:49             ` Kumar Gala
2009-04-08  5:28     ` Kumar Gala
     [not found]       ` <F4E3E1FF-C544-460A-AC27-DB9501C13ED3-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08  7:25         ` Wolfgang Grandegger
2009-04-08  7:25           ` Wolfgang Grandegger
     [not found]           ` <49DC515F.3040100-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-08 15:21             ` Kumar Gala
2009-04-08 15:21               ` Kumar Gala
     [not found]               ` <E9E24C93-F147-49F0-9FBE-FCE4883D11BF-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-04-08 19:55                 ` Wolfgang Grandegger
2009-04-08 19:55                   ` Wolfgang Grandegger
2009-04-09  9:59                   ` Wolfgang Grandegger
2009-04-20  9:01                     ` Wolfgang Grandegger
2009-04-20 13:26                       ` Grant Likely
2009-04-20 13:26                         ` 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=509A8F0F.4070806@freescale.com \
    --to=timur-kzfg59tc24xl57midrcfdg@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wg-5Yr1BZd7O62+XT7JhA+gdA@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.