linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elyas Razzaghi <elyas.r-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Add I2C with PCA9665
Date: Fri, 28 Jun 2013 13:26:29 +0300	[thread overview]
Message-ID: <51CD64D5.60907@gmail.com> (raw)

Hi,

I am using the PCA9665 controller in my custom board because the 
internal I2C controller of my processor (AT91RM9200) is not robust. The 
following are my configs:

Hardware:

D0 - D7 --> D0 - D7
Write strobe --> NWR0/NWE/CFWE
Read strobe --> NRD/NOE/CFOE
Chip Enable --> NCS2
A0 --> A0/NBS0
A1 --> A1
Interrupt request --> PB29/IRQ0
Reset --> PB27

Software:

static struct resource i2c_resources[] = {
     [0] = {
         .start    = AT91_CHIPSELECT_2,    /* 0x30000000 */
         .end    = AT91_CHIPSELECT_2 + SZ_16K - 1,
         .flags    = IORESOURCE_MEM,
     },
     [1] = {
         .start    = AT91RM9200_ID_IRQ0,
         .end    = AT91RM9200_ID_IRQ0,
         .flags    = IORESOURCE_IRQ,
     },
};

static struct i2c_pca9564_pf_platform_data pca9665_platform_data = {
     .gpio        = AT91_PIN_PB27,
     .i2c_clock_speed= 0,
     .timeout    = HZ,        /* timeout in jiffies */
};

static struct platform_device pca9665_twi_device = {
     .name        = "i2c-pca-platform",
     .id        = -1,
     .dev        = {
                 .platform_data = &pca9665_platform_data,
             },
     .num_resources    = ARRAY_SIZE(i2c_resources),
     .resource    = i2c_resources,
};

void __init at91_add_device_i2c(struct i2c_board_info *devices, int 
nr_devices)
{
     at91_set_A_periph(AT91_PIN_PB29, 1);        /* IRQ0 interrupt pin */
     i2c_register_board_info(0, devices, nr_devices);
     platform_device_register(&pca9665_twi_device);
}

But the board detects the wrong external I2C controller (PCA9564):

# dmesg | grep PCA
PCA9564/PCA9665 at 0x30000000: PCA9564 detected.
PCA9564/PCA9665 at 0x30000000: Choosing the clock frequency based on 
index is deprecated. Use the nominal frequency.
PCA9564/PCA9665 at 0x30000000: Clock frequency is 330kHz
PCA9564/PCA9665 at 0x30000000 registered.

And, the i2c controller is not functional at all. The i2cdetect command 
of i2c-tools package from lm-sensors, does not detect any devices on my 
i2c bus, while there must be two i2c devices (a RTC and a temperature 
sensor) on my board. There is no i2c clock or data signal either on the 
bus using the oscilloscope probe.

How can I fix this so the board detects the functional and correct 
controller (PCA9665)?

Best regards,
Elyas Razzaghi

             reply	other threads:[~2013-06-28 10:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 10:26 Elyas Razzaghi [this message]
     [not found] ` <51CD64D5.60907-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-28 10:45   ` Add I2C with PCA9665 Wolfram Sang
2013-06-28 19:47     ` Elyas Razzaghi

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=51CD64D5.60907@gmail.com \
    --to=elyas.r-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@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 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).