summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vaccaro <nvaccaro@google.com>2018-11-12 19:43:35 -0800
committerPatrick Georgi <pgeorgi@google.com>2018-11-22 14:47:52 +0000
commit0a495eb658d3c393e8645d703bfcf91444e7c3af (patch)
tree7dc1ff0a7e3870b3cba38e39bd0d574f67eeea0c
parentf13a6f9e0531e251087f752440411018bfd91e97 (diff)
downloadcoreboot-0a495eb658d3c393e8645d703bfcf91444e7c3af.tar.xz
drivers/usb/acpi: add reset gpio to usb acpi driver
Add ability to define a reset gpio in acpi for a USB device. BUG=b:119275094 Change-Id: Ife3ea43a1eadf2548aa52b8fbd792e691d7cc7f2 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://review.coreboot.org/c/29615 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Rajat Jain <rajatja@google.com>
-rw-r--r--src/drivers/usb/acpi/chip.h2
-rw-r--r--src/drivers/usb/acpi/usb_acpi.c26
2 files changed, 28 insertions, 0 deletions
diff --git a/src/drivers/usb/acpi/chip.h b/src/drivers/usb/acpi/chip.h
index f3f629abff..6429f13630 100644
--- a/src/drivers/usb/acpi/chip.h
+++ b/src/drivers/usb/acpi/chip.h
@@ -49,6 +49,8 @@ struct drivers_usb_acpi_config {
/* Define a custom physical location for the port */
bool use_custom_pld;
struct acpi_pld custom_pld;
+
+ struct acpi_gpio reset_gpio;
};
#endif /* __USB_ACPI_CHIP_H__ */
diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c
index 65f1f82acd..f049e68c22 100644
--- a/src/drivers/usb/acpi/usb_acpi.c
+++ b/src/drivers/usb/acpi/usb_acpi.c
@@ -23,6 +23,17 @@
#include <string.h>
#include "chip.h"
+static bool usb_acpi_add_gpios_to_crs(struct drivers_usb_acpi_config *cfg)
+{
+ /*
+ * Return false if reset GPIO is not provided.
+ */
+ if (cfg->reset_gpio.pin_count == 0)
+ return false;
+
+ return true;
+}
+
static void usb_acpi_fill_ssdt_generator(struct device *dev)
{
struct drivers_usb_acpi_config *config = dev->chip_info;
@@ -50,6 +61,21 @@ static void usb_acpi_fill_ssdt_generator(struct device *dev)
acpigen_write_pld(&pld);
}
+ /* Resources */
+ if (usb_acpi_add_gpios_to_crs(config) == true) {
+ struct acpi_dp *dsd;
+
+ acpigen_write_name("_CRS");
+ acpigen_write_resourcetemplate_header();
+ acpi_device_write_gpio(&config->reset_gpio);
+ acpigen_write_resourcetemplate_footer();
+
+ dsd = acpi_dp_new_table("_DSD");
+ acpi_dp_add_gpio(dsd, "reset-gpio", path, 0, 0,
+ config->reset_gpio.polarity);
+ acpi_dp_write(dsd);
+ }
+
acpigen_pop_len();
printk(BIOS_INFO, "%s: %s at %s\n", path,