From: "Jon Smirl" <jonsmirl@gmail.com>
To: "David Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org, linuxppc-dev@ozlabs.org, paulus@samba.org
Subject: Re: [PATCH 0/3]: Sparc OF I2C support.
Date: Thu, 21 Aug 2008 17:53:02 -0400 [thread overview]
Message-ID: <9e4733910808211453t63f0a6f5h2139e027319263f1@mail.gmail.com> (raw)
In-Reply-To: <20080821.001012.265401427.davem@davemloft.net>
On 8/21/08, David Miller <davem@davemloft.net> wrote:
>
> I'm working on some drivers for I2C bus support on some of my sparc64
> workstations (for lm-sensor and eeprom type devices sitting behind
> them) so I went back to trying to get of_i2c.c usable on sparc.
>
> Mostly straightforward stuff _except_ for the I2C address encoding.
>
> What I2C IEEE1275 device binding was used to write that code in
> of_i2c.c? Is it some PowerPC specific thing? Was it "invented"
> by the embedded folks (I hope not)?
>
> On sparc, the encoding is either 1 cell or 2 cell.
>
> If it's one cell, it's just the device address.
>
> If it's two cells, it's a bus number (for I2C controllers that
> can manage multiple I2C bus segments, think PCI domains) in the
> first cell and the device address in the second cell.
>
> And, furthermore, the device address is shifted up 1 bit higher
> than the Linux I2C layer expects. It includes the low direction
> bit, bit 0, so we have to shift it down by 1 bit before we give
> it to the Linux I2C layer.
>
> Does PowerPC really encode these things differently? And if so what
> IEEE1275 I2C device binding specification covers that?
>
> If PowerPC really does encode the device address in the same format as
> the Linux I2C layer expects, that's OK and I used some property tests
> and ifdefs to make it all work out. What I did in these patches is:
>
> 1) Check the #address-cells property. If not present, assume the value
> is "1". Only accept values of "1" and "2".
>
> 2) When CONFIG_SPARC, shift the device address down by one bit before
> giving it to the Linux I2C layer.
How do you deal with a 10-bit address i2c device? Is it multiplied by two too?
Here's the i2c spec,
http://www.semiconductors.philips.com/acrobat_download/literature/9398/39340011.pdf
It says the basic addresses are 7 bit.
> I haven't added support to the I2C layer for the bus number yet, that
> will come later.
>
> The first patch in this series add the powerpc-compat IRQ probing
> interfaces, mostly straightforward stuff as we precompute these
> IRQs in of_device objects so we just search for the of_device corresponding
> to the device node and return the interrupt, if any. Dispost is a NOP.
>
> The second patch deals with the addressing issues described above and
> lets it be compiled on non-ppc systems.
>
> The third patch adds device modaliases for a couple of I2C chip devices
> I've seen on my SunBlade2500 workstation. More will come later as I
> flesh out my I2C sparc64 drivers which are not being posted here yet.
> I have a fully functional Sun pcf8584 I2C bus driver.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
--
Jon Smirl
jonsmirl@gmail.com
next prev parent reply other threads:[~2008-08-21 21:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 7:10 [PATCH 0/3]: Sparc OF I2C support David Miller
2008-08-21 16:32 ` Scott Wood
2008-08-21 21:21 ` David Miller
2008-08-21 21:35 ` Scott Wood
2008-08-21 21:45 ` David Miller
2008-08-21 22:05 ` Benjamin Herrenschmidt
2008-08-21 22:27 ` David Miller
2008-08-21 22:38 ` Benjamin Herrenschmidt
2008-08-21 22:05 ` Benjamin Herrenschmidt
2008-08-21 22:28 ` David Miller
2008-08-21 22:39 ` Benjamin Herrenschmidt
2008-08-21 23:14 ` Grant Likely
2008-08-21 23:32 ` David Miller
2008-08-22 1:15 ` Josh Boyer
2008-08-22 3:53 ` David Miller
2008-08-22 4:18 ` Grant Likely
2008-08-22 4:22 ` David Miller
2008-08-22 4:29 ` Mitch Bradley
2008-08-22 4:30 ` Grant Likely
2008-08-22 4:34 ` Grant Likely
2008-08-22 4:37 ` David Miller
2008-08-22 5:19 ` Mitch Bradley
2008-08-22 16:00 ` Yoder Stuart
2008-08-22 16:13 ` Josh Boyer
2008-08-22 10:50 ` Josh Boyer
2008-08-22 11:06 ` David Miller
2008-08-21 23:45 ` Jon Smirl
2008-08-22 2:33 ` Grant Likely
2008-08-22 2:39 ` Jon Smirl
2008-08-22 15:58 ` Scott Wood
2008-08-22 16:44 ` Grant Likely
2008-08-21 22:01 ` Benjamin Herrenschmidt
2008-08-21 21:53 ` Jon Smirl [this message]
2008-08-21 21:58 ` David Miller
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=9e4733910808211453t63f0a6f5h2139e027319263f1@mail.gmail.com \
--to=jonsmirl@gmail.com \
--cc=davem@davemloft.net \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=sparclinux@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 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).