All of lore.kernel.org
 help / color / mirror / Atom feed
* How to add the "gpio-line-names" property in a PCI gpio expander
@ 2020-11-05  9:46 Flavio Suligoi
  2020-11-05 11:51 ` Rafael J. Wysocki
  0 siblings, 1 reply; 17+ messages in thread
From: Flavio Suligoi @ 2020-11-05  9:46 UTC (permalink / raw)
  To: linux-acpi

Hi all,

I'm working to introduce the "gpio-line-names" property in the ACPI
configuration of the BIOS of our x86 boards (we can customize the BIOS of our
boards).

All is ok for the gpiochips related to the Intel chipset and some I2C gpio
expanders. I have inserted the _DSD as described in the Linux documentation.

In one of our boards we have an add-on PCI board, with a PCI serial device
Exar XR17V352. This device also contains 16 gpios.
The exar device drivers work good, both the "8250_exar" and the "gpio_exar", and
I can manage the exar's gpios correctly.
The problem is how to assign the gpio-line-names property to a PCI gpio
expanders like this.

I tried adding a new device in my ACPI configuration, as:

Device (EXAR)
{
    Name (_HID, "13A80352")
    Name (_STR, Unicode ("STR - Exar GPIOs"))  // _STR: Description String

    Name (_DSD, Package () {
	ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
	Package () {
	    Package () {
		"gpio-line-names",
		    Package () {
			"exar_0",
			"exar_1",
			"exar_2",
			"exar_3",
			...
		    }
		}
	    }
    })
}

but I have no result.
Does anyone have a suggestion?

Thanks,

Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05  9:46 How to add the "gpio-line-names" property in a PCI gpio expander Flavio Suligoi
@ 2020-11-05 11:51 ` Rafael J. Wysocki
  2020-11-05 11:59   ` Mika Westerberg
  2020-11-05 15:56   ` Andy Shevchenko
  0 siblings, 2 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2020-11-05 11:51 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: linux-acpi, Mika Westerberg, Andy Shevchenko

CC Mika and Andy who should be more familiar with that problem space than I am.

On Thu, Nov 5, 2020 at 10:46 AM Flavio Suligoi <f.suligoi@asem.it> wrote:
>
> Hi all,
>
> I'm working to introduce the "gpio-line-names" property in the ACPI
> configuration of the BIOS of our x86 boards (we can customize the BIOS of our
> boards).
>
> All is ok for the gpiochips related to the Intel chipset and some I2C gpio
> expanders. I have inserted the _DSD as described in the Linux documentation.
>
> In one of our boards we have an add-on PCI board, with a PCI serial device
> Exar XR17V352. This device also contains 16 gpios.
> The exar device drivers work good, both the "8250_exar" and the "gpio_exar", and
> I can manage the exar's gpios correctly.
> The problem is how to assign the gpio-line-names property to a PCI gpio
> expanders like this.
>
> I tried adding a new device in my ACPI configuration, as:
>
> Device (EXAR)
> {
>     Name (_HID, "13A80352")
>     Name (_STR, Unicode ("STR - Exar GPIOs"))  // _STR: Description String
>
>     Name (_DSD, Package () {
>         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
>         Package () {
>             Package () {
>                 "gpio-line-names",
>                     Package () {
>                         "exar_0",
>                         "exar_1",
>                         "exar_2",
>                         "exar_3",
>                         ...
>                     }
>                 }
>             }
>     })
> }
>
> but I have no result.
> Does anyone have a suggestion?
>
> Thanks,
>
> Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 11:51 ` Rafael J. Wysocki
@ 2020-11-05 11:59   ` Mika Westerberg
  2020-11-05 14:01     ` Flavio Suligoi
  2020-11-05 15:56   ` Andy Shevchenko
  1 sibling, 1 reply; 17+ messages in thread
From: Mika Westerberg @ 2020-11-05 11:59 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Flavio Suligoi, linux-acpi, Andy Shevchenko

Hi,

On Thu, Nov 05, 2020 at 12:51:18PM +0100, Rafael J. Wysocki wrote:
> CC Mika and Andy who should be more familiar with that problem space than I am.
> 
> On Thu, Nov 5, 2020 at 10:46 AM Flavio Suligoi <f.suligoi@asem.it> wrote:
> >
> > Hi all,
> >
> > I'm working to introduce the "gpio-line-names" property in the ACPI
> > configuration of the BIOS of our x86 boards (we can customize the BIOS of our
> > boards).
> >
> > All is ok for the gpiochips related to the Intel chipset and some I2C gpio
> > expanders. I have inserted the _DSD as described in the Linux documentation.
> >
> > In one of our boards we have an add-on PCI board, with a PCI serial device
> > Exar XR17V352. This device also contains 16 gpios.
> > The exar device drivers work good, both the "8250_exar" and the "gpio_exar", and
> > I can manage the exar's gpios correctly.
> > The problem is how to assign the gpio-line-names property to a PCI gpio
> > expanders like this.
> >
> > I tried adding a new device in my ACPI configuration, as:
> >
> > Device (EXAR)
> > {
> >     Name (_HID, "13A80352")

If this is PCI device then you need to have _ADR here instead of _HID.

> >     Name (_STR, Unicode ("STR - Exar GPIOs"))  // _STR: Description String
> >
> >     Name (_DSD, Package () {
> >         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> >         Package () {
> >             Package () {
> >                 "gpio-line-names",
> >                     Package () {
> >                         "exar_0",
> >                         "exar_1",
> >                         "exar_2",
> >                         "exar_3",
> >                         ...
> >                     }
> >                 }
> >             }
> >     })
> > }
> >
> > but I have no result.
> > Does anyone have a suggestion?
> >
> > Thanks,
> >
> > Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 11:59   ` Mika Westerberg
@ 2020-11-05 14:01     ` Flavio Suligoi
  2020-11-05 15:20       ` Mika Westerberg
  0 siblings, 1 reply; 17+ messages in thread
From: Flavio Suligoi @ 2020-11-05 14:01 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: linux-acpi, Andy Shevchenko, Rafael J. Wysocki

Hi Mika,

> > > In one of our boards we have an add-on PCI board, with a PCI serial
> device
> > > Exar XR17V352. This device also contains 16 gpios.
> > > The exar device drivers work good, both the "8250_exar" and the
> "gpio_exar", and
> > > I can manage the exar's gpios correctly.
> > > The problem is how to assign the gpio-line-names property to a PCI
> gpio
> > > expanders like this.
> > >
> > > I tried adding a new device in my ACPI configuration, as:
> > >
> > > Device (EXAR)
> > > {
> > >     Name (_HID, "13A80352")
> 
> If this is PCI device then you need to have _ADR here instead of _HID.

the problem is that the parent bus of this device is not declared in any ACPI table.
The exar chip is on the bus 7 :

07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03)

and in the _ADR object you can specify device and function only. 
How can I specify the parent bus? It is not simple …
The lspci output is the following:

root@debian:/etc# lspci
00:00.0 Host bridge: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Host Bridge (rev 0d)
00:02.0 VGA compatible controller: Intel Corporation Device 5a85 (rev 0d)
00:0e.0 Audio device: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Audio Cluster (rev 0d)
00:0f.0 Communication controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Trusted Execution Engine (rev 0d)
00:12.0 SATA controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SATA AHCI Controller (rev 0d)
00:13.0 PCI bridge: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port A #1 (rev fd)
00:13.1 PCI bridge: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port A #2 (rev fd)
00:13.2 PCI bridge: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port A #3 (rev fd)
00:14.0 PCI bridge: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port B #1 (rev fd)
00:14.1 PCI bridge: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port B #2 (rev fd)
00:15.0 USB controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series USB xHCI (rev 0d)
00:16.0 Signal processing controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #1 (rev 0d)
00:16.1 Signal processing controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #2 (rev 0d)
00:19.0 Signal processing controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SPI Controller #1 (rev 0d)
00:19.1 Signal processing controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SPI Controller #2 (rev 0d)
00:19.2 Signal processing controller: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SPI Controller #3 (rev 0d)
00:1f.0 ISA bridge: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Low Pin Count Interface (rev 0d)
00:1f.1 SMBus: Intel Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SMBus Controller (rev 0d)
01:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
02:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
04:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
05:00.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05)
06:01.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05)
06:02.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05)
06:03.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05)
07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03)  --- Exar serial port
08:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
root@debian:/etc#
Thanks,
Flavio


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 14:01     ` Flavio Suligoi
@ 2020-11-05 15:20       ` Mika Westerberg
  2020-11-05 15:54         ` Flavio Suligoi
  0 siblings, 1 reply; 17+ messages in thread
From: Mika Westerberg @ 2020-11-05 15:20 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: linux-acpi, Andy Shevchenko, Rafael J. Wysocki

On Thu, Nov 05, 2020 at 02:01:24PM +0000, Flavio Suligoi wrote:
> Hi Mika,
> 
> > > > In one of our boards we have an add-on PCI board, with a PCI serial
> > device
> > > > Exar XR17V352. This device also contains 16 gpios.
> > > > The exar device drivers work good, both the "8250_exar" and the
> > "gpio_exar", and
> > > > I can manage the exar's gpios correctly.
> > > > The problem is how to assign the gpio-line-names property to a PCI
> > gpio
> > > > expanders like this.
> > > >
> > > > I tried adding a new device in my ACPI configuration, as:
> > > >
> > > > Device (EXAR)
> > > > {
> > > >     Name (_HID, "13A80352")
> > 
> > If this is PCI device then you need to have _ADR here instead of _HID.
> 
> the problem is that the parent bus of this device is not declared in any ACPI table.
> The exar chip is on the bus 7 :
> 
> 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03)
> 
> and in the _ADR object you can specify device and function only. 
> How can I specify the parent bus? It is not simple …
> The lspci output is the following:

The parent is the root port the device is connected to and I'm pretty
sure it exists in the namespace as this seems to be Intel hardware. If
you run 'lspci -t' it shows you the root port.

The _ADR should be 0 for this one.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 15:20       ` Mika Westerberg
@ 2020-11-05 15:54         ` Flavio Suligoi
  2020-11-05 16:09           ` Andy Shevchenko
  2020-11-06  7:04           ` Mika Westerberg
  0 siblings, 2 replies; 17+ messages in thread
From: Flavio Suligoi @ 2020-11-05 15:54 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: linux-acpi, Andy Shevchenko, Rafael J. Wysocki

Hi Mika,

> > > > > In one of our boards we have an add-on PCI board, with a PCI
> serial
> > > device
> > > > > Exar XR17V352. This device also contains 16 gpios.
> > > > > The exar device drivers work good, both the "8250_exar" and the
> > > "gpio_exar", and
> > > > > I can manage the exar's gpios correctly.
> > > > > The problem is how to assign the gpio-line-names property to a PCI
> > > gpio
> > > > > expanders like this.
> > > > >
> > > > > I tried adding a new device in my ACPI configuration, as:
> > > > >
> > > > > Device (EXAR)
> > > > > {
> > > > >     Name (_HID, "13A80352")
> > >
> > > If this is PCI device then you need to have _ADR here instead of _HID.
> >
> > the problem is that the parent bus of this device is not declared in any
> ACPI table.
> > The exar chip is on the bus 7 :
> >
> > 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03)
> >
> > and in the _ADR object you can specify device and function only.
> > How can I specify the parent bus? It is not simple …
> > The lspci output is the following:
> 
> The parent is the root port the device is connected to and I'm pretty
> sure it exists in the namespace as this seems to be Intel hardware. If
> you run 'lspci -t' it shows you the root port.
> 
> The _ADR should be 0 for this one.

Unfortunately there is bridge in the middle:

root@debian:~# lspci -t
-[0000:00]-+-00.0
           +-02.0
           +-0e.0
           +-0f.0
           +-12.0
           +-13.0-[01]----00.0
           +-13.1-[02]----00.0
           +-13.2-[03]--
           +-14.0-[04]----00.0
           +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <-- Exar (bus 7, dev 0, funct 0)
           |                               +-02.0-[08]----00.0
           |                               \-03.0-[09]--
           +-15.0
           +-16.0
           +-16.1
           +-19.0
           +-19.1
           +-19.2
           +-1f.0
           \-1f.1
root@debian:~#

My changes in the ACPI:

Scope (_SB.PCI0) {
    Device (EXAR)
		{
			Name (_ADR, 0x0000)
....

but it doesn't work, because of the bridge.

Regards,

Flavio




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 11:51 ` Rafael J. Wysocki
  2020-11-05 11:59   ` Mika Westerberg
@ 2020-11-05 15:56   ` Andy Shevchenko
  1 sibling, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2020-11-05 15:56 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Flavio Suligoi, linux-acpi, Mika Westerberg

On Thu, Nov 05, 2020 at 12:51:18PM +0100, Rafael J. Wysocki wrote:
> CC Mika and Andy who should be more familiar with that problem space than I am.

I believe I have explained this in the [1]. Perhaps it's about how to find
proper device node / ACPI path of the devices in question?

[1]: https://lore.kernel.org/linux-gpio/9152bb8be33e4192a7766eb53c6ca9af@asem.it/

> On Thu, Nov 5, 2020 at 10:46 AM Flavio Suligoi <f.suligoi@asem.it> wrote:
> >
> > Hi all,
> >
> > I'm working to introduce the "gpio-line-names" property in the ACPI
> > configuration of the BIOS of our x86 boards (we can customize the BIOS of our
> > boards).
> >
> > All is ok for the gpiochips related to the Intel chipset and some I2C gpio
> > expanders. I have inserted the _DSD as described in the Linux documentation.
> >
> > In one of our boards we have an add-on PCI board, with a PCI serial device
> > Exar XR17V352. This device also contains 16 gpios.
> > The exar device drivers work good, both the "8250_exar" and the "gpio_exar", and
> > I can manage the exar's gpios correctly.
> > The problem is how to assign the gpio-line-names property to a PCI gpio
> > expanders like this.
> >
> > I tried adding a new device in my ACPI configuration, as:
> >
> > Device (EXAR)
> > {
> >     Name (_HID, "13A80352")
> >     Name (_STR, Unicode ("STR - Exar GPIOs"))  // _STR: Description String
> >
> >     Name (_DSD, Package () {
> >         ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> >         Package () {
> >             Package () {
> >                 "gpio-line-names",
> >                     Package () {
> >                         "exar_0",
> >                         "exar_1",
> >                         "exar_2",
> >                         "exar_3",
> >                         ...
> >                     }
> >                 }
> >             }
> >     })
> > }
> >
> > but I have no result.
> > Does anyone have a suggestion?
> >
> > Thanks,
> >
> > Flavio

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 15:54         ` Flavio Suligoi
@ 2020-11-05 16:09           ` Andy Shevchenko
  2020-11-05 16:19             ` Andy Shevchenko
  2020-11-06  7:04           ` Mika Westerberg
  1 sibling, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2020-11-05 16:09 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

On Thu, Nov 05, 2020 at 03:54:32PM +0000, Flavio Suligoi wrote:
> > > > > > In one of our boards we have an add-on PCI board, with a PCI
> > serial
> > > > device
> > > > > > Exar XR17V352. This device also contains 16 gpios.
> > > > > > The exar device drivers work good, both the "8250_exar" and the
> > > > "gpio_exar", and
> > > > > > I can manage the exar's gpios correctly.
> > > > > > The problem is how to assign the gpio-line-names property to a PCI
> > > > gpio
> > > > > > expanders like this.
> > > > > >
> > > > > > I tried adding a new device in my ACPI configuration, as:
> > > > > >
> > > > > > Device (EXAR)
> > > > > > {
> > > > > >     Name (_HID, "13A80352")
> > > >
> > > > If this is PCI device then you need to have _ADR here instead of _HID.
> > >
> > > the problem is that the parent bus of this device is not declared in any
> > ACPI table.
> > > The exar chip is on the bus 7 :
> > >
> > > 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03)
> > >
> > > and in the _ADR object you can specify device and function only.
> > > How can I specify the parent bus? It is not simple …
> > > The lspci output is the following:
> > 
> > The parent is the root port the device is connected to and I'm pretty
> > sure it exists in the namespace as this seems to be Intel hardware. If
> > you run 'lspci -t' it shows you the root port.
> > 
> > The _ADR should be 0 for this one.
> 
> Unfortunately there is bridge in the middle:
> 
> root@debian:~# lspci -t
> -[0000:00]-+-00.0
>            +-02.0
>            +-0e.0
>            +-0f.0
>            +-12.0
>            +-13.0-[01]----00.0
>            +-13.1-[02]----00.0
>            +-13.2-[03]--
>            +-14.0-[04]----00.0
>            +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <-- Exar (bus 7, dev 0, funct 0)
>            |                               +-02.0-[08]----00.0
>            |                               \-03.0-[09]--
>            +-15.0
>            +-16.0
>            +-16.1
>            +-19.0
>            +-19.1
>            +-19.2
>            +-1f.0
>            \-1f.1
> root@debian:~#
> 
> My changes in the ACPI:
> 
> Scope (_SB.PCI0) {
>     Device (EXAR)
> 		{
> 			Name (_ADR, 0x0000)

_ADR should represent BDF (Bus:Device.Function)

Something like 0x07000000

> ....
> 
> but it doesn't work, because of the bridge.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 16:09           ` Andy Shevchenko
@ 2020-11-05 16:19             ` Andy Shevchenko
  2020-11-05 16:24               ` Flavio Suligoi
  0 siblings, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2020-11-05 16:19 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

On Thu, Nov 05, 2020 at 06:09:25PM +0200, Andy Shevchenko wrote:
> On Thu, Nov 05, 2020 at 03:54:32PM +0000, Flavio Suligoi wrote:
> > > > > > > In one of our boards we have an add-on PCI board, with a PCI
> > > serial
> > > > > device
> > > > > > > Exar XR17V352. This device also contains 16 gpios.
> > > > > > > The exar device drivers work good, both the "8250_exar" and the
> > > > > "gpio_exar", and
> > > > > > > I can manage the exar's gpios correctly.
> > > > > > > The problem is how to assign the gpio-line-names property to a PCI
> > > > > gpio
> > > > > > > expanders like this.
> > > > > > >
> > > > > > > I tried adding a new device in my ACPI configuration, as:
> > > > > > >
> > > > > > > Device (EXAR)
> > > > > > > {
> > > > > > >     Name (_HID, "13A80352")
> > > > >
> > > > > If this is PCI device then you need to have _ADR here instead of _HID.
> > > >
> > > > the problem is that the parent bus of this device is not declared in any
> > > ACPI table.
> > > > The exar chip is on the bus 7 :
> > > >
> > > > 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03)
> > > >
> > > > and in the _ADR object you can specify device and function only.
> > > > How can I specify the parent bus? It is not simple …
> > > > The lspci output is the following:
> > > 
> > > The parent is the root port the device is connected to and I'm pretty
> > > sure it exists in the namespace as this seems to be Intel hardware. If
> > > you run 'lspci -t' it shows you the root port.
> > > 
> > > The _ADR should be 0 for this one.
> > 
> > Unfortunately there is bridge in the middle:
> > 
> > root@debian:~# lspci -t
> > -[0000:00]-+-00.0
> >            +-02.0
> >            +-0e.0
> >            +-0f.0
> >            +-12.0
> >            +-13.0-[01]----00.0
> >            +-13.1-[02]----00.0
> >            +-13.2-[03]--
> >            +-14.0-[04]----00.0
> >            +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <-- Exar (bus 7, dev 0, funct 0)
> >            |                               +-02.0-[08]----00.0
> >            |                               \-03.0-[09]--
> >            +-15.0
> >            +-16.0
> >            +-16.1
> >            +-19.0
> >            +-19.1
> >            +-19.2
> >            +-1f.0
> >            \-1f.1
> > root@debian:~#
> > 
> > My changes in the ACPI:
> > 
> > Scope (_SB.PCI0) {
> >     Device (EXAR)
> > 		{
> > 			Name (_ADR, 0x0000)
> 
> _ADR should represent BDF (Bus:Device.Function)
> 
> Something like 0x07000000

Per documentation:
"High word–Device #, Low word–Function #. (for example, device 3, function 2 is
0x00030002). To refer to all the functions on a device #, use a function number of FFFF)."

It seems it doesn't describe where bus is going.

Maybe Mika can help here.

> > ....
> > 
> > but it doesn't work, because of the bridge.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 16:19             ` Andy Shevchenko
@ 2020-11-05 16:24               ` Flavio Suligoi
  0 siblings, 0 replies; 17+ messages in thread
From: Flavio Suligoi @ 2020-11-05 16:24 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

Hi Andy,

> > >
> > > Unfortunately there is bridge in the middle:
> > >
> > > root@debian:~# lspci -t
> > > -[0000:00]-+-00.0
> > >            +-02.0
> > >            +-0e.0
> > >            +-0f.0
> > >            +-12.0
> > >            +-13.0-[01]----00.0
> > >            +-13.1-[02]----00.0
> > >            +-13.2-[03]--
> > >            +-14.0-[04]----00.0
> > >            +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <--
> Exar (bus 7, dev 0, funct 0)
> > >            |                               +-02.0-[08]----00.0
> > >            |                               \-03.0-[09]--
> > >            +-15.0
> > >            +-16.0
> > >            +-16.1
> > >            +-19.0
> > >            +-19.1
> > >            +-19.2
> > >            +-1f.0
> > >            \-1f.1
> > > root@debian:~#
> > >
> > > My changes in the ACPI:
> > >
> > > Scope (_SB.PCI0) {
> > >     Device (EXAR)
> > > 		{
> > > 			Name (_ADR, 0x0000)
> >
> > _ADR should represent BDF (Bus:Device.Function)
> >
> > Something like 0x07000000
> 
> Per documentation:
> "High word–Device #, Low word–Function #. (for example, device 3, function
> 2 is
> 0x00030002). To refer to all the functions on a device #, use a function
> number of FFFF)."
> 

exactly, with the _ADR object we can specify only device and function. 
The bus is implicit, that's way I used the:

Scope (_SB.PCI0) { ...

But it is the wrong bus, because of a bridge in the middle.

Best regards,

Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-05 15:54         ` Flavio Suligoi
  2020-11-05 16:09           ` Andy Shevchenko
@ 2020-11-06  7:04           ` Mika Westerberg
  2020-11-06 16:47             ` Flavio Suligoi
  1 sibling, 1 reply; 17+ messages in thread
From: Mika Westerberg @ 2020-11-06  7:04 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: linux-acpi, Andy Shevchenko, Rafael J. Wysocki

On Thu, Nov 05, 2020 at 03:54:32PM +0000, Flavio Suligoi wrote:
> Hi Mika,
> 
> > > > > > In one of our boards we have an add-on PCI board, with a PCI
> > serial
> > > > device
> > > > > > Exar XR17V352. This device also contains 16 gpios.
> > > > > > The exar device drivers work good, both the "8250_exar" and the
> > > > "gpio_exar", and
> > > > > > I can manage the exar's gpios correctly.
> > > > > > The problem is how to assign the gpio-line-names property to a PCI
> > > > gpio
> > > > > > expanders like this.
> > > > > >
> > > > > > I tried adding a new device in my ACPI configuration, as:
> > > > > >
> > > > > > Device (EXAR)
> > > > > > {
> > > > > >     Name (_HID, "13A80352")
> > > >
> > > > If this is PCI device then you need to have _ADR here instead of _HID.
> > >
> > > the problem is that the parent bus of this device is not declared in any
> > ACPI table.
> > > The exar chip is on the bus 7 :
> > >
> > > 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03)
> > >
> > > and in the _ADR object you can specify device and function only.
> > > How can I specify the parent bus? It is not simple …
> > > The lspci output is the following:
> > 
> > The parent is the root port the device is connected to and I'm pretty
> > sure it exists in the namespace as this seems to be Intel hardware. If
> > you run 'lspci -t' it shows you the root port.
> > 
> > The _ADR should be 0 for this one.
> 
> Unfortunately there is bridge in the middle:
> 
> root@debian:~# lspci -t
> -[0000:00]-+-00.0
>            +-02.0
>            +-0e.0
>            +-0f.0
>            +-12.0
>            +-13.0-[01]----00.0
>            +-13.1-[02]----00.0
>            +-13.2-[03]--
>            +-14.0-[04]----00.0
>            +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <-- Exar (bus 7, dev 0, funct 0)
>            |                               +-02.0-[08]----00.0
>            |                               \-03.0-[09]--
>            +-15.0
>            +-16.0
>            +-16.1
>            +-19.0
>            +-19.1
>            +-19.2
>            +-1f.0
>            \-1f.1
> root@debian:~#
> 
> My changes in the ACPI:
> 
> Scope (_SB.PCI0) {
>     Device (EXAR)
> 		{
> 			Name (_ADR, 0x0000)
> ....
> 
> but it doesn't work, because of the bridge.

OK, then add the bridge first:

Scope (_SB.PCI0.RPX) {
    Device (BRG) { // Bridge
       Name (_ADR, 0)

       Device (EXAR) { // Expander
           Name (_ADR, 0)
       }
    }

Or something like that. RPX is the root port 14.1 and if I read the
above right both the bridge and the EXAR device have device and function 0.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-06  7:04           ` Mika Westerberg
@ 2020-11-06 16:47             ` Flavio Suligoi
  2020-11-06 17:17               ` Andy Shevchenko
  0 siblings, 1 reply; 17+ messages in thread
From: Flavio Suligoi @ 2020-11-06 16:47 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: linux-acpi, Andy Shevchenko, Rafael J. Wysocki

Hi Mika and Andy,

> >
> > root@debian:~# lspci -t
> > -[0000:00]-+-00.0
> >            +-02.0
> >            +-0e.0
> >            +-0f.0
> >            +-12.0
> >            +-13.0-[01]----00.0
> >            +-13.1-[02]----00.0
> >            +-13.2-[03]--
> >            +-14.0-[04]----00.0
> >            +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <-- Exar
> (bus 7, dev 0, funct 0)
> >            |                               +-02.0-[08]----00.0
> >            |                               \-03.0-[09]--
> >            +-15.0
> >            +-16.0
> >            +-16.1
> >            +-19.0
> >            +-19.1
> >            +-19.2
> >            +-1f.0
> >            \-1f.1
> OK, then add the bridge first:
> 
> Scope (_SB.PCI0.RPX) {
>     Device (BRG) { // Bridge
>        Name (_ADR, 0)
> 
>        Device (EXAR) { // Expander
>            Name (_ADR, 0)
>        }
>     }
> 
> Or something like that. RPX is the root port 14.1 and if I read the
> above right both the bridge and the EXAR device have device and function
> 0.

All ok now, I've added the bridge (I had to use the BIOS sources) and
not it works:

Scope (_SB.PCI0.RP02) {

		Device (BRG1) //Bridge
		{
			Name (_ADR, 0x0000)
		
			Device (BRG2) //Bridge
			{
				Name (_ADR, 0x00010000)

				Device (EXAR)
				{
					Name (_ADR, 0x0000)

					Name (_DSD, Package ()
					{
						ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
						Package ()
						{
							Package ()
							{
								"gpio-line-names",
								Package ()
								{
									"exar_0",
									"exar_1",
									"exar_2",
									"exar_3",
									"exar_4",
									"exar_5",
									"exar_6",
									"exar_7"
								} ....
root@debian:~# gpioinfo gpiochip4
gpiochip4 - 16 lines:
	line   0:     "exar_0"       unused   input  active-high 
	line   1:     "exar_1"       unused   input  active-high 
	line   2:     "exar_2"       unused   input  active-high 
	line   3:     "exar_3"       unused   input  active-high 
	line   4:     "exar_4"       unused   input  active-high 
	line   5:     "exar_5"       unused   input  active-high 
	line   6:     "exar_6"       unused   input  active-high 
	line   7:     "exar_7"       unused   input  active-high 
	line   8:      unnamed       unused   input  active-high 
	line   9:      unnamed       unused   input  active-high 
	line  10:      unnamed       unused   input  active-high 
	line  11:      unnamed       unused   input  active-high 
	line  12:      unnamed       unused   input  active-high 
	line  13:      unnamed       unused   input  active-high 
	line  14:      unnamed       unused   input  active-high 
	line  15:      unnamed       unused   input  active-high 
root@debian:~# 

Thanks for your precious help and ideas !!!

Best regards,

Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-06 16:47             ` Flavio Suligoi
@ 2020-11-06 17:17               ` Andy Shevchenko
  2020-11-09  9:05                 ` Flavio Suligoi
  0 siblings, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2020-11-06 17:17 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

On Fri, Nov 06, 2020 at 04:47:35PM +0000, Flavio Suligoi wrote:

> > Or something like that. RPX is the root port 14.1 and if I read the
> > above right both the bridge and the EXAR device have device and function
> > 0.
> 
> All ok now, I've added the bridge (I had to use the BIOS sources) and
> not it works:

I suppose not -> now ;)

Glad to hear this! So, maybe you can add some bits to the documentation [1]
based on your experience?

Note, I have sent a series [2] to amend it a bit, and your input welcome!

[1]: Documentation/firmware-guide/acpi/gpio-properties.rst
[2]: https://lore.kernel.org/linux-acpi/20201029193243.61546-1-andriy.shevchenko@linux.intel.com/T/#u


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-06 17:17               ` Andy Shevchenko
@ 2020-11-09  9:05                 ` Flavio Suligoi
  2020-11-09 10:34                   ` Andy Shevchenko
  0 siblings, 1 reply; 17+ messages in thread
From: Flavio Suligoi @ 2020-11-09  9:05 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

Hi Andy,

> >
> > All ok now, I've added the bridge (I had to use the BIOS sources) and
> > not it works:
> 
> I suppose not -> now ;)

right! --> now it works !!! 😊

> 
> Glad to hear this! So, maybe you can add some bits to the documentation
> [1]
> based on your experience?
> 

Yes, I can! Thanks you for asking me!

> Note, I have sent a series [2] to amend it a bit, and your input welcome!
> 
> [1]: Documentation/firmware-guide/acpi/gpio-properties.rst
> [2]: https://lore.kernel.org/linux-acpi/20201029193243.61546-1-
> andriy.shevchenko@linux.intel.com/T/#u

Ok, I'll see how to integrate my PCI "investigation" about the
identification of the correct path from the CPU to the final PCI
device, through the various bridges of the board.
I think that a general discourse about it can be useful to
other people, too.

> 
> 
> --
> With Best Regards,
> Andy Shevchenko
> 

Best regards,

Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-09  9:05                 ` Flavio Suligoi
@ 2020-11-09 10:34                   ` Andy Shevchenko
  2020-11-09 10:35                     ` Flavio Suligoi
  2020-11-09 10:37                     ` Andy Shevchenko
  0 siblings, 2 replies; 17+ messages in thread
From: Andy Shevchenko @ 2020-11-09 10:34 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

On Mon, Nov 09, 2020 at 09:05:36AM +0000, Flavio Suligoi wrote:

> > Glad to hear this! So, maybe you can add some bits to the documentation
> > [1]
> > based on your experience?
> 
> Yes, I can! Thanks you for asking me!
> 
> > Note, I have sent a series [2] to amend it a bit, and your input welcome!
> > 
> > [1]: Documentation/firmware-guide/acpi/gpio-properties.rst
> > [2]: https://lore.kernel.org/linux-acpi/20201029193243.61546-1-
> > andriy.shevchenko@linux.intel.com/T/#u
> 
> Ok, I'll see how to integrate my PCI "investigation" about the
> identification of the correct path from the CPU to the final PCI
> device, through the various bridges of the board.
> I think that a general discourse about it can be useful to
> other people, too.

I realized that here we have two items to document:
1) the gpio-line-names property in [1];
2) PCI hierarchy in ACPI tables, which can be added into [3] under
   the "PCI hierarchy representation" title or so.

[3]: Documentation/firmware-guide/acpi/enumeration.rst

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-09 10:34                   ` Andy Shevchenko
@ 2020-11-09 10:35                     ` Flavio Suligoi
  2020-11-09 10:37                     ` Andy Shevchenko
  1 sibling, 0 replies; 17+ messages in thread
From: Flavio Suligoi @ 2020-11-09 10:35 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

Hi Andy,

> > Ok, I'll see how to integrate my PCI "investigation" about the
> > identification of the correct path from the CPU to the final PCI
> > device, through the various bridges of the board.
> > I think that a general discourse about it can be useful to
> > other people, too.
> 
> I realized that here we have two items to document:
> 1) the gpio-line-names property in [1];
> 2) PCI hierarchy in ACPI tables, which can be added into [3] under
>    the "PCI hierarchy representation" title or so.
> 
> [3]: Documentation/firmware-guide/acpi/enumeration.rst

OK, thanks for your guidelines!

> 
> --
> With Best Regards,
> Andy Shevchenko
> 

Regards,

Flavio

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: How to add the "gpio-line-names" property in a PCI gpio expander
  2020-11-09 10:34                   ` Andy Shevchenko
  2020-11-09 10:35                     ` Flavio Suligoi
@ 2020-11-09 10:37                     ` Andy Shevchenko
  1 sibling, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2020-11-09 10:37 UTC (permalink / raw)
  To: Flavio Suligoi; +Cc: Mika Westerberg, linux-acpi, Rafael J. Wysocki

On Mon, Nov 09, 2020 at 12:34:32PM +0200, Andy Shevchenko wrote:
> On Mon, Nov 09, 2020 at 09:05:36AM +0000, Flavio Suligoi wrote:
> 
> > > Glad to hear this! So, maybe you can add some bits to the documentation
> > > [1]
> > > based on your experience?
> > 
> > Yes, I can! Thanks you for asking me!
> > 
> > > Note, I have sent a series [2] to amend it a bit, and your input welcome!
> > > 
> > > [1]: Documentation/firmware-guide/acpi/gpio-properties.rst
> > > [2]: https://lore.kernel.org/linux-acpi/20201029193243.61546-1-
> > > andriy.shevchenko@linux.intel.com/T/#u
> > 
> > Ok, I'll see how to integrate my PCI "investigation" about the
> > identification of the correct path from the CPU to the final PCI
> > device, through the various bridges of the board.
> > I think that a general discourse about it can be useful to
> > other people, too.
> 
> I realized that here we have two items to document:
> 1) the gpio-line-names property in [1];

More precise here is to extend the existing documentation with the examples and
explanation how GPIO subsystem in Linux is expecting those names to be (as I
explained in one thread to you that the property covers only line names from
the beginning to the first hole, when no name is provided, i.o.w. holes are not
accepted).

> 2) PCI hierarchy in ACPI tables, which can be added into [3] under
>    the "PCI hierarchy representation" title or so.
> 
> [3]: Documentation/firmware-guide/acpi/enumeration.rst

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-11-09 10:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05  9:46 How to add the "gpio-line-names" property in a PCI gpio expander Flavio Suligoi
2020-11-05 11:51 ` Rafael J. Wysocki
2020-11-05 11:59   ` Mika Westerberg
2020-11-05 14:01     ` Flavio Suligoi
2020-11-05 15:20       ` Mika Westerberg
2020-11-05 15:54         ` Flavio Suligoi
2020-11-05 16:09           ` Andy Shevchenko
2020-11-05 16:19             ` Andy Shevchenko
2020-11-05 16:24               ` Flavio Suligoi
2020-11-06  7:04           ` Mika Westerberg
2020-11-06 16:47             ` Flavio Suligoi
2020-11-06 17:17               ` Andy Shevchenko
2020-11-09  9:05                 ` Flavio Suligoi
2020-11-09 10:34                   ` Andy Shevchenko
2020-11-09 10:35                     ` Flavio Suligoi
2020-11-09 10:37                     ` Andy Shevchenko
2020-11-05 15:56   ` Andy Shevchenko

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.