All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Angelos Manousarides <amanous@inaccessnetworks.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: I2C bus implementation
Date: Tue, 10 Jan 2006 10:12:14 +1100	[thread overview]
Message-ID: <1136848334.19965.21.camel@localhost.localdomain> (raw)
In-Reply-To: <43C2914A.8080409@inaccessnetworks.com>

> The problem is that since all I2C device drivers are written in the way 
> above, I am having trouble writting the code for this I2C bus. The 
> master_xfer function accepts a list of i2c_msg. So for a I2c read my 
> driver would get 2 messages one with the first byte (address write) and 
> one with the read buffer, although this is a single I2C transaction!
> 
> How can I glue the I2C code to this interface?
> Is there a bus similar to the MPC82xx implemented already?
> 
> Can I assume that the i2c_msg list passed to the master_xfer function 
> will always contain a single I2C transaction? This way I could setup the 
> buffers using the i2c_mgs elements and when the list finishes, I cound 
> issue the "I2C start" command.

You can parse the msg list for validity and if it contains anything you
don't grok, reject it. That's a bit of a pain though. That's why for
PowerMac (see the patches that just went in rewriting the PowerMac i2c
code), I have my own low level layer that uses different semantics
closer to what Apple HW provides and one stub driver that hooks to linux
i2c layer. In that stub, I chose to mostly implement the "smbus"
transactions. In fact, smbus transactions map to pretty much 90% of the
needs of most i2c devices around here. Of course, that mean you can't
use existing i2c drivers that use the master_xfer() entry and not the
smbus API, but then, do you really want to use an existing i2c driver ?
I find them generally of no use as they don't know anything about the
specifics of the platform anyway.

Ben.



  reply	other threads:[~2006-01-09 23:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-09 16:37 I2C bus implementation Angelos Manousarides
2006-01-09 23:12 ` Benjamin Herrenschmidt [this message]
2006-01-19 15:01   ` I2C bus implementation (for MPC82xx) Angelos Manousarides

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=1136848334.19965.21.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=amanous@inaccessnetworks.com \
    --cc=linux-kernel@vger.kernel.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.