lynxpoint: Expose ACPI Device for LP GPIO controller

In order to probe the gpio-lynxpoint kernel driver the
LP GPIO controller needs to be exposed as a specific
ACPI device.

This also allows the resources to be exposed to the OS via
this device instead of the catch-all LPC device.

Ensure the driver loads at boot:
gpiochip_find_base: found new base at 162
gpiochip_add: registered GPIOs 162 to 255 on device: INT33C7:00

Also ensure the driver is visible in sysfs:
$ cat /sys/devices/platform/INT33C7:00/gpio/gpiochip162/label
INT33C7:00

Change-Id: I9f79c008f88da9b67ed1cdfdb9d3a581ce8f05ff
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50215
Reviewed-on: http://review.coreboot.org/4158
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Duncan Laurie 2013-05-06 14:02:27 -07:00 committed by Stefan Reinauer
parent f8b36501fd
commit 92e1f15175
2 changed files with 60 additions and 48 deletions

View File

@ -199,60 +199,22 @@ Device (LPCB)
0x1, 0xff) 0x1, 0xff)
// GPIO region may be 128 bytes or 4096 bytes // GPIO region may be 128 bytes or 4096 bytes
IO (Decode16, DEFAULT_GPIOBASE, DEFAULT_GPIOBASE, IO (Decode16, 0x0000, 0x0000, 0x1, 0x00, GPR1)
0x1, 0x00, GPR1)
IO (Decode16, 0x0000, 0x0000, 0x1, 0x00, GPR2)
IO (Decode16, 0x0000, 0x0000, 0x1, 0x00, GPR3)
IO (Decode16, 0x0000, 0x0000, 0x1, 0x00, GPR4)
}) })
Method (_CRS, 0, NotSerialized) Method (_CRS, 0, NotSerialized)
{ {
CreateByteField (^RBUF, ^GPR1._LEN, R1LN) // LynxPoint-LP GPIO resources are defined in the
CreateByteField (^RBUF, ^GPR2._LEN, R2LN) // SerialIO GPIO device and LynxPoint-H GPIO resources
CreateByteField (^RBUF, ^GPR3._LEN, R3LN) // are defined here.
CreateByteField (^RBUF, ^GPR4._LEN, R4LN) If (LNot (\ISLP ())) {
CreateByteField (^RBUF, ^GPR1._LEN, R1LN)
CreateWordField (^RBUF, ^GPR1._MIN, R1MN)
CreateWordField (^RBUF, ^GPR1._MAX, R1MX)
CreateWordField (^RBUF, ^GPR1._MIN, R1MN)
CreateWordField (^RBUF, ^GPR2._MIN, R2MN)
CreateWordField (^RBUF, ^GPR3._MIN, R3MN)
CreateWordField (^RBUF, ^GPR4._MIN, R4MN)
CreateWordField (^RBUF, ^GPR1._MAX, R1MX)
CreateWordField (^RBUF, ^GPR2._MAX, R2MX)
CreateWordField (^RBUF, ^GPR3._MAX, R3MX)
CreateWordField (^RBUF, ^GPR4._MAX, R4MX)
// Update GPIO region for LynxPoint-LP
If (\ISLP ()) {
// LynxPoint-LP
Store (R1MN, Local0)
// Update GPIO bank 1
Store (Local0, R1MN)
Store (Local0, R1MX)
Store (0xff, R1LN)
// Update GPIO bank 2
Add (Local0, 0x100, Local0)
Store (Local0, R2MN)
Store (Local0, R2MX)
Store (0xff, R2LN)
// Update GPIO bank 3
Add (Local0, 0x100, Local0)
Store (Local0, R3MN)
Store (Local0, R3MN)
Store (0xff, R3LN)
// Update GPIO bank 4
Add (Local0, 0x100, Local0)
Store (Local0, R4MN)
Store (Local0, R4MN)
Store (0xff, R4LN)
} Else {
// LynxPoint-H
// Update GPIO region length // Update GPIO region length
Store (DEFAULT_GPIOBASE, R1MN)
Store (DEFAULT_GPIOBASE, R1MX)
Store (DEFAULT_GPIOSIZE, R1LN) Store (DEFAULT_GPIOSIZE, R1LN)
} }
Return (RBUF) Return (RBUF)

View File

@ -468,3 +468,53 @@ Device (SDIO)
} }
} }
} }
Device (GPIO)
{
// GPIO Controller
Name (_HID, "INT33C7")
Name (_CID, "INT33C7")
Name (_UID, 1)
Name (RBUF, ResourceTemplate()
{
DWordIo (ResourceProducer,
MinFixed, // IsMinFixed
MaxFixed, // IsMaxFixed
PosDecode, // Decode
EntireRange, // ISARanges
0x00000000, // AddressGranularity
0x00000000, // AddressMinimum
0x00000000, // AddressMaximum
0x00000000, // AddressTranslation
0x00000000, // RangeLength
, // ResourceSourceIndex
, // ResourceSource
BAR0)
})
Method (_CRS, 0, NotSerialized)
{
If (\ISLP ()) {
CreateDwordField (^RBUF, ^BAR0._MIN, BMIN)
CreateDwordField (^RBUF, ^BAR0._MAX, BMAX)
CreateDwordField (^RBUF, ^BAR0._LEN, BLEN)
Store (DEFAULT_GPIOSIZE, BLEN)
Store (DEFAULT_GPIOBASE, BMIN)
Store (Subtract (Add (DEFAULT_GPIOBASE,
DEFAULT_GPIOSIZE), 1), BMAX)
}
Return (RBUF)
}
Method (_STA, 0, NotSerialized)
{
If (\ISLP ()) {
Return (0xF)
} Else {
Return (0x0)
}
}
}