drivers/net/r8168: Add SSDT Power Resource Methods

Turns out when going into S0ix we want the kernel to toggle de-assert to 0 for
the ISOLATE# pin on the NIC for S0ix not to be woken by PCIe traffic on PCH.
Upon resume the ISOLATE# pin on the NIC is then re-asserted for it to become
lively again.

V.2: Ensure reset_gpio && enable_gpio are optional.

BUG=b:147026979
BRANCH=none
TEST=Boot puff and do 100 cycles of S0ix.

Change-Id: I3ae8dc30f45f55eec23f45e7b5fbc67a4542f87d
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38494
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Edward O'Callaghan 2020-01-21 21:01:32 +11:00 committed by Patrick Georgi
parent 7e2625587d
commit b765fa6e47
2 changed files with 22 additions and 0 deletions

View File

@ -15,10 +15,22 @@
#define __DRIVERS_R8168_CHIP_H__ #define __DRIVERS_R8168_CHIP_H__
#include <stdint.h> #include <stdint.h>
#include <arch/acpi_device.h>
struct drivers_net_config { struct drivers_net_config {
uint16_t customized_leds; uint16_t customized_leds;
unsigned int wake; /* Wake pin for ACPI _PRW */ unsigned int wake; /* Wake pin for ACPI _PRW */
/* Does the device have a power resource? */
bool has_power_resource;
/* GPIO used to stop operation of device. */
struct acpi_gpio stop_gpio;
/* Delay to be inserted after disabling stop. */
unsigned int stop_delay_ms;
/* Delay to be inserted after enabling stop. */
unsigned int stop_off_delay_ms;
/* /*
* There maybe many NIC cards in a system. * There maybe many NIC cards in a system.
* This parameter is for driver to identify what * This parameter is for driver to identify what

View File

@ -317,6 +317,16 @@ static void r8168_net_fill_ssdt(struct device *dev)
if (dev->chip_ops) if (dev->chip_ops)
acpigen_write_name_string("_DDN", dev->chip_ops->name); acpigen_write_name_string("_DDN", dev->chip_ops->name);
/* Power Resource */
if (config->has_power_resource) {
const struct acpi_power_res_params power_res_params = {
.stop_gpio = &config->stop_gpio,
.stop_delay_ms = config->stop_delay_ms,
.stop_off_delay_ms = config->stop_off_delay_ms
};
acpi_device_add_power_res(&power_res_params);
}
/* Address */ /* Address */
address = PCI_SLOT(dev->path.pci.devfn) & 0xffff; address = PCI_SLOT(dev->path.pci.devfn) & 0xffff;
address <<= 16; address <<= 16;