All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Ben Gardner <gardner.ben@gmail.com>
Cc: linux-acpi@vger.kernel.org
Subject: Re: ACPI: Can I use I2cSerialBus with a PCI I2C controller?
Date: Thu, 22 Oct 2015 11:01:57 +0300	[thread overview]
Message-ID: <20151022080157.GI1526@lahna.fi.intel.com> (raw)
In-Reply-To: <CAE7DoPak939WjCWaGQw7W6aR0dZOcJCjcQK8gMa9iu+WRmnDDw@mail.gmail.com>

On Wed, Oct 21, 2015 at 06:14:27PM -0500, Ben Gardner wrote:
> Thanks for the help!
> 
> >> So my questions are:
> >>   Can I use I2cSerialBus with a PCI I2C controller?
> >
> > Yes you can.
> >
> > That's what we do all the time for Intel hardware.
> 
> That is good to hear.
> ...
> 
> > So you can just drop the whole _CRS and make your I2C host controller
> > device to look like:
> >
> > Device (I2C3)
> > {
> >         Name (_ADR, 0x00180003)
> >
> >         /* Standard Mode: HCNT, LCNT, SDA Hold Time */
> >         Name (SSCN, Package () { 0x200, 0x200, 0x6 })
> >
> >         /* Fast Mode: HCNT, LCNT, SDA Hold Time */
> >         Name (FMCN, Package () { 0x55, 0x99, 0x6 })
> >
> >         Device (EEP0)
> >         {
> >                 Name (_CID, Package() { "24c02" })
> >                 Name (_CRS, ResourceTemplate () {
> >                         I2cSerialBus (0x0057, ControllerInitiated, 400000,
> >                                       AddressingMode7Bit, "\\_SB.I2C3", 0x00,
> >                                       ResourceConsumer,,)
> >                 })
> >         }
> > }
> 
> OK. I tried that.
> It looks like the device is nested properly in the ACPI tree:
> 
> I see this symlink:
> /sys/bus/acpi/devices/24C02:00 ->
> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/device:16/24C02:00
> 
> # for x in /sys/bus/acpi/devices/* ; do if [ -e $x/path ] ; then
> printf "%-30.30s  %s\n" "$(cat $x/path)" "$x" ; fi ; done | sort |
> grep I2C3
> \_SB_.I2C3                      device:16
> \_SB_.I2C3.EEP0                 24C02:00
> 
> But no I2C device are created under /sys/bus/i2c/devices/.
> # ll /sys/bus/i2c/devices/
> lrwxrwxrwx    1 root     root             0 Oct 21 11:30 i2c-1 ->
> ../../../devices/pci0000:00/0000:00:18.1/i2c-1
> lrwxrwxrwx    1 root     root             0 Oct 21 11:30 i2c-2 ->
> ../../../devices/pci0000:00/0000:00:18.2/i2c-2
> lrwxrwxrwx    1 root     root             0 Oct 21 11:30 i2c-3 ->
> ../../../devices/pci0000:00/0000:00:18.3/i2c-3
> 
> I'll have to dig further to find where it is failing in i2c_core.c. I
> assume it will be in the same spot.
> Is there a way to see PCI to ACPI associations?

Yes, the PCI device has a symlink "firmware_node" which points to the
ACPI device.

Here an example from Skylake system (which uses PCI mode for LPSS
devices):

# ls -l /sys/bus/pci/devices/0000\:00\:15.1/firmware_node
lrwxrwxrwx    1 root     root             0 Oct 22 08:00 /sys/bus/pci/devices/0000:00:15.1/firmware_node -> ../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:6f

# cat /sys/bus/pci/devices/0000\:00\:15.1/firmware_node/path 
\_SB_.PCI0.I2C1

  reply	other threads:[~2015-10-22  8:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20 19:47 ACPI: Can I use I2cSerialBus with a PCI I2C controller? Ben Gardner
2015-10-21  8:50 ` Mika Westerberg
2015-10-21 23:14   ` Ben Gardner
2015-10-22  8:01     ` Mika Westerberg [this message]
2015-10-22 16:19       ` Ben Gardner
2015-10-22 17:17         ` Ben Gardner
2015-10-23  8:20           ` Mika Westerberg
2015-10-23  9:43             ` Mika Westerberg
2015-10-23 17:24             ` Ben Gardner
2015-10-26 19:56               ` Ben Gardner
2015-10-27 10:49                 ` Mika Westerberg
2015-10-27 21:11             ` Dustin Byford
2015-10-28  9:01               ` Mika Westerberg
2015-10-30 16:51                 ` Ben Gardner
2015-11-02 10:25                   ` Mika Westerberg

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=20151022080157.GI1526@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=gardner.ben@gmail.com \
    --cc=linux-acpi@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.