aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/usb/acpi/usb_acpi.c
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@google.com>2020-10-23 15:15:01 -0600
committerPatrick Georgi <pgeorgi@google.com>2020-11-09 07:36:50 +0000
commit5eac877b75f4c21970f4df777461879aeec2520e (patch)
tree0956f90dda44a1f8859f8d463c557e1a52a88b50 /src/drivers/usb/acpi/usb_acpi.c
parent835a2fa73727578e95fc7d0058f6ef89e93d56dc (diff)
driver/usb/acpi: Add power resources for devices on USB ports
Allow a USB device to define PowerResource in its SSDT AML code. PowerResouce ACPI generation expects SoC to define the callbacks for generating AML code for GPIO manipulation. Device requiring PowerResource needs to define following parameters: * Reset GPIO - Optional, GPIO to put device into reset or take it out of reset. * Reset delay - Delay after reset GPIO is asserted (default 0). * Reset off delay - Delay after reset GPIO is de-asserted (default 0). * Enable GPIO - Optional, GPIO to enable device. * Enable delay - Delay after enable GPIO is asserted (default 0). * Enable off delay - Delay after enable GPIO is de-asserted (default 0). BUG=b:163100335 TEST=Ensure that the Power Resource ACPI object is added under the concerned USB device. Change-Id: Icc1aebfb9e3e646a7f608f0cd391079fd30dd1c0 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46713 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Peichao Wang <pwang12@lenovo.corp-partner.google.com> Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/usb/acpi/usb_acpi.c')
-rw-r--r--src/drivers/usb/acpi/usb_acpi.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c
index 55ef1d361f..8a597e3e9e 100644
--- a/src/drivers/usb/acpi/usb_acpi.c
+++ b/src/drivers/usb/acpi/usb_acpi.c
@@ -11,9 +11,10 @@
static bool usb_acpi_add_gpios_to_crs(struct drivers_usb_acpi_config *cfg)
{
/*
- * Return false if reset GPIO is not provided.
+ * Return false if reset GPIO is not provided or is provided as part of power
+ * resource.
*/
- if (cfg->reset_gpio.pin_count == 0)
+ if (cfg->has_power_resource || cfg->reset_gpio.pin_count == 0)
return false;
return true;
@@ -61,6 +62,21 @@ static void usb_acpi_fill_ssdt_generator(const struct device *dev)
acpi_dp_write(dsd);
}
+ if (config->has_power_resource) {
+ const struct acpi_power_res_params power_res_params = {
+ &config->reset_gpio,
+ config->reset_delay_ms,
+ config->reset_off_delay_ms,
+ &config->enable_gpio,
+ config->enable_delay_ms,
+ config->enable_off_delay_ms,
+ NULL,
+ 0,
+ 0
+ };
+ acpi_device_add_power_res(&power_res_params);
+ }
+
acpigen_pop_len();
printk(BIOS_INFO, "%s: %s at %s\n", path,