All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] PPC4XX Custom Board - Failing to read I2C
Date: Fri, 05 Apr 2013 08:04:54 +0200	[thread overview]
Message-ID: <515E6986.4050905@denx.de> (raw)
In-Reply-To: <1365120299377-151609.post@n7.nabble.com>

On 05.04.2013 02:04, txcotrader wrote:
> After looking deeper I've found a difference in register values when
> performing drivers/i2c/ppc4xx_i2c.c->i2c_transfer function.
> 
> v1.7.02 code yields:
> 
> /* Transfer is in progress
>          * we have to wait for upto 5 bytes of data
>          * 1 byte chip address+r/w bit then bc bytes
>          * of data.
>          * udelay(10) is 1 bit time at 100khz
>          * Doubled for slop. 20 is too small.
>          */
>         i = 2*5*8;
>         do {
>             /* Get status */
>             status = in_8((u8 *)IIC_STS);
>             printf("gd_ do status->i = %d, status = %d\n", i, status);
>             udelay(20);
>             i--;
>         } while ((status & IIC_STS_PT) && !(status & IIC_STS_ERR) && (i >
> 0));
> 
> gd_ do status->i = 80, status = 40
> 
> 
> v2013.01.01 Yields:
>         i = 2 * 5 * 8;
>         do {
>             /* Get status */
>             status = in_8(&i2c->sts);
>             printf("gd_ do status->i = %d, status = %d\n", i, status);
>             udelay(10);
>             i--;
>         } while ((status & IIC_STS_PT) && !(status & IIC_STS_ERR) &&
>              (i > 0));
> 
> gd_ do status->i = 80, status = 40
> 
> v1.7.02 - include/4xx_i2c.h:#define IIC_STS	
> (I2C_REGISTERS_BASE_ADDRESS+IICSTS)
> v2013.01.01 - struct ppc4xx_i2c *i2c = (struct ppc4xx_i2c *)I2C_BASE_ADDR;
> 
> Newb question, but I should be able to add an offset to correct this issue
> right?

The resulting addresses should be the same. The old version uses the
offset via a define and the new one the (recommended) struct access to
the register. I suggest you print the resulting address to verify that
it really is the same.

Thanks,
Stefan

  reply	other threads:[~2013-04-05  6:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 21:48 [U-Boot] PPC4XX Custom Board - Failing to read I2C txcotrader
2013-04-03  0:51 ` Stefan Roese
2013-04-03 16:15   ` txcotrader
2013-04-03 17:08     ` Stefan Roese
2013-04-03 17:29       ` txcotrader
2013-04-03 17:54         ` Anatolij Gustschin
2013-04-03 19:09           ` txcotrader
2013-04-04 17:43             ` txcotrader
2013-04-04 22:18             ` Rommel Custodio
2013-04-04 22:26               ` txcotrader
2013-04-05  0:04 ` txcotrader
2013-04-05  6:04   ` Stefan Roese [this message]
2013-04-08 12:26     ` txcotrader
2013-04-08 13:33       ` Stefan Roese
2013-04-08 14:16     ` txcotrader
2013-04-08 14:34       ` Stefan Roese
2013-04-08 19:54         ` txcotrader
2013-04-09 15:49           ` Stefan Roese
2013-07-24 22:58             ` txcotrader
2013-07-25  4:33               ` Stefan Roese

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=515E6986.4050905@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.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 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.