Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35076 )
Change subject: drivers/spi/acpi: Support power resource as parent in device tree ......................................................................
drivers/spi/acpi: Support power resource as parent in device tree
This allows supporting an independent power resource for SPI ACPI devices, so that the power resource configuration can be refactored out of individual drivers and coalesced into a separate one.
Change-Id: Ib1e52a0f31d430637c9d819e231f9c4af6c68672 Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/drivers/spi/acpi/acpi.c 1 file changed, 16 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/35076/1
diff --git a/src/drivers/spi/acpi/acpi.c b/src/drivers/spi/acpi/acpi.c index 5ae010f..07f1a4b 100644 --- a/src/drivers/spi/acpi/acpi.c +++ b/src/drivers/spi/acpi/acpi.c @@ -23,6 +23,7 @@ #include <stdint.h> #include <string.h> #include "chip.h" +#include "drivers/generic/power_resource/chip.h"
static int spi_acpi_get_bus(const struct device *dev) { @@ -73,8 +74,19 @@
static void spi_acpi_fill_ssdt_generator(struct device *dev) { + const int parent_is_power_resource = + CONFIG(DRIVERS_GENERIC_POWER_RESOURCE) && + (dev->bus && dev->bus->children == dev && + dev->bus->dev->chip_ops == &drivers_generic_power_resource_ops); + /* + * Because the power resource is a "pseudo-device", we don't want it + * to be included in the ACPI path + */ + const char *pr_scope = parent_is_power_resource ? + acpi_device_scope(dev->bus->dev) : + NULL; struct drivers_spi_acpi_config *config = dev->chip_info; - const char *scope = acpi_device_scope(dev); + const char *scope = (pr_scope == NULL) ? acpi_device_scope(dev) : pr_scope; const char *path = acpi_device_path(dev); struct acpi_spi spi = { .device_select = dev->path.spi.cs, @@ -184,6 +196,9 @@ acpi_device_path(dev));
acpi_add_device_power_resource("PRIC"); + } else if (parent_is_power_resource) { + /* Parent device is a power resource, so set up _PR0/_PR3 */ + acpi_add_device_power_resource(acpi_device_path(dev->bus->dev)); }
acpigen_pop_len(); /* Device */