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>
This commit is contained in:
Nick Vaccaro 2018-11-12 19:43:35 -08:00 committed by Patrick Georgi
parent f13a6f9e05
commit 0a495eb658
2 changed files with 28 additions and 0 deletions

View File

@ -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__ */

View File

@ -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,