mb/google/zork: Clean up bt reset_gpio removal
Clean up of bt reset_gpio removal function. TEST=Boot and observe log showing bt reset_gpio was removed BUG=b:157580724 - Add reset_gpio for Bluetooth Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I1d40ad16dd3c624d4be89d9eea1835cc4e72c03d Reviewed-on: https://review.coreboot.org/c/coreboot/+/44273 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
87093758c5
commit
bb56ad449c
|
@ -127,6 +127,35 @@ void variant_audio_update(void)
|
||||||
update_hp_int_odl();
|
update_hp_int_odl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Removes reset_gpio from usb device in device tree.
|
||||||
|
*
|
||||||
|
* debug_device_name is used for debug messaging only.
|
||||||
|
*/
|
||||||
|
static void remove_usb_device_reset_gpio(const struct device_path usb_path[],
|
||||||
|
size_t path_length, const char *debug_device_name)
|
||||||
|
{
|
||||||
|
|
||||||
|
const struct device *usb_dev;
|
||||||
|
struct drivers_usb_acpi_config *usb_cfg;
|
||||||
|
|
||||||
|
usb_dev = find_dev_nested_path(pci_root_bus(), usb_path, path_length);
|
||||||
|
if (!usb_dev) {
|
||||||
|
printk(BIOS_ERR, "%s: Failed to find %s!", __func__, debug_device_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* config_of dies on failure, so a NULL check is not required */
|
||||||
|
usb_cfg = config_of(usb_dev);
|
||||||
|
usb_cfg->reset_gpio.pin_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The bluetooth device may be on XHCI0 or XHCI1 depending on SOC.
|
||||||
|
* There's no harm in removing reset_gpio from both here.
|
||||||
|
*/
|
||||||
|
static void baseboard_trembyle_remove_bluetooth_reset_gpio(void)
|
||||||
|
{
|
||||||
static const struct device_path xhci0_bt_path[] = {
|
static const struct device_path xhci0_bt_path[] = {
|
||||||
{
|
{
|
||||||
.type = DEVICE_PATH_PCI,
|
.type = DEVICE_PATH_PCI,
|
||||||
|
@ -147,7 +176,6 @@ static const struct device_path xhci0_bt_path[] = {
|
||||||
.usb.port_id = 5
|
.usb.port_id = 5
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct device_path xhci1_bt_path[] = {
|
static const struct device_path xhci1_bt_path[] = {
|
||||||
{
|
{
|
||||||
.type = DEVICE_PATH_PCI,
|
.type = DEVICE_PATH_PCI,
|
||||||
|
@ -169,39 +197,10 @@ static const struct device_path xhci1_bt_path[] = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
remove_usb_device_reset_gpio(xhci0_bt_path, ARRAY_SIZE(xhci0_bt_path),
|
||||||
* Removes reset_gpio from bluetooth device in device tree.
|
"XHCI0 Bluetoth USB Device");
|
||||||
*
|
remove_usb_device_reset_gpio(xhci1_bt_path, ARRAY_SIZE(xhci1_bt_path),
|
||||||
* The bluetooth device may be on XHCI0 or XHCI1 depending on SOC.
|
"XHCI1 Bluetoth USB Device");
|
||||||
* There's no harm in removing from both here.
|
|
||||||
*/
|
|
||||||
static void baseboard_remove_bluetooth_reset_gpio(void)
|
|
||||||
{
|
|
||||||
const struct device *xhci0_bt_dev, *xhci1_bt_dev;
|
|
||||||
struct drivers_usb_acpi_config *xhci0_bt_cfg, *xhci1_bt_cfg;
|
|
||||||
|
|
||||||
xhci0_bt_dev = find_dev_nested_path(
|
|
||||||
pci_root_bus(), xhci0_bt_path, ARRAY_SIZE(xhci0_bt_path));
|
|
||||||
if (!xhci0_bt_dev) {
|
|
||||||
printk(BIOS_ERR, "%s: Failed to find bluetooth device on XHCI0!", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* config_of dies on failure, so a NULL check is not required */
|
|
||||||
xhci0_bt_cfg = config_of(xhci0_bt_dev);
|
|
||||||
xhci0_bt_cfg->reset_gpio.pin_count = 0;
|
|
||||||
|
|
||||||
/* There's no bluetooth device on XHCI1 on Dalboz */
|
|
||||||
if (CONFIG(BOARD_GOOGLE_BASEBOARD_DALBOZ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
xhci1_bt_dev = find_dev_nested_path(
|
|
||||||
pci_root_bus(), xhci1_bt_path, ARRAY_SIZE(xhci1_bt_path));
|
|
||||||
if (!xhci1_bt_dev) {
|
|
||||||
printk(BIOS_ERR, "%s: Failed to find bluetooth device on XHCI1!", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
xhci1_bt_cfg = config_of(xhci1_bt_dev);
|
|
||||||
xhci1_bt_cfg->reset_gpio.pin_count = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void variant_bluetooth_update(void)
|
void variant_bluetooth_update(void)
|
||||||
|
@ -209,7 +208,7 @@ void variant_bluetooth_update(void)
|
||||||
if (CONFIG(BOARD_GOOGLE_BASEBOARD_DALBOZ) || variant_uses_v3_schematics())
|
if (CONFIG(BOARD_GOOGLE_BASEBOARD_DALBOZ) || variant_uses_v3_schematics())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
baseboard_remove_bluetooth_reset_gpio();
|
baseboard_trembyle_remove_bluetooth_reset_gpio();
|
||||||
}
|
}
|
||||||
|
|
||||||
void variant_touchscreen_update(void)
|
void variant_touchscreen_update(void)
|
||||||
|
|
Loading…
Reference in New Issue