summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainboard/google/zork/mainboard.c1
-rw-r--r--src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb1
-rw-r--r--src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb2
-rw-r--r--src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h2
-rw-r--r--src/mainboard/google/zork/variants/baseboard/ramstage_common.c88
5 files changed, 94 insertions, 0 deletions
diff --git a/src/mainboard/google/zork/mainboard.c b/src/mainboard/google/zork/mainboard.c
index 1ce87a5611..1e4ea06542 100644
--- a/src/mainboard/google/zork/mainboard.c
+++ b/src/mainboard/google/zork/mainboard.c
@@ -135,6 +135,7 @@ static void mainboard_configure_gpios(void)
static void mainboard_devtree_update(void)
{
variant_audio_update();
+ variant_bluetooth_update();
variant_devtree_update();
}
diff --git a/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb b/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb
index 0b3c1f19b9..e2d9183311 100644
--- a/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb
+++ b/src/mainboard/google/zork/variants/baseboard/devicetree_dalboz.cb
@@ -235,6 +235,7 @@ chip soc/amd/picasso
chip drivers/usb/acpi
register "desc" = ""Bluetooth""
register "type" = "UPC_TYPE_INTERNAL"
+ register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_143)"
device usb 2.5 on end
end
chip drivers/usb/acpi
diff --git a/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb b/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb
index 787f00b013..bbef7027d5 100644
--- a/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb
+++ b/src/mainboard/google/zork/variants/baseboard/devicetree_trembyle.cb
@@ -263,6 +263,7 @@ chip soc/amd/picasso
chip drivers/usb/acpi
register "desc" = ""Bluetooth""
register "type" = "UPC_TYPE_INTERNAL"
+ register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_14)"
device usb 2.5 on end
end
end
@@ -282,6 +283,7 @@ chip soc/amd/picasso
chip drivers/usb/acpi
register "desc" = ""Bluetooth""
register "type" = "UPC_TYPE_INTERNAL"
+ register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_14)"
device usb 2.1 on end
end
chip drivers/usb/acpi
diff --git a/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h
index aa1a3c8cf4..6b9bbfd3bc 100644
--- a/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/zork/variants/baseboard/include/baseboard/variants.h
@@ -35,6 +35,8 @@ const struct soc_amd_gpio *variant_sleep_gpio_table(size_t *size, int slp_typ);
void variant_devtree_update(void);
/* Update audio configuration in devicetree during ramstage. */
void variant_audio_update(void);
+/* Update bluetooth configuration in devicetree during ramstage. */
+void variant_bluetooth_update(void);
/* Configure PCIe GPIOs as per variant sequencing requirements. */
void variant_pcie_gpio_configure(void);
diff --git a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c
index 511d60d0b8..b2c5830d10 100644
--- a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c
+++ b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c
@@ -2,7 +2,10 @@
#include <acpi/acpi_device.h>
#include <baseboard/variants.h>
+#include <console/console.h>
+#include <device/device.h>
#include <drivers/amd/i2s_machine_dev/chip.h>
+#include <drivers/usb/acpi/chip.h>
#include <ec/google/chromeec/ec.h>
#include <soc/gpio.h>
#include <soc/pci_devs.h>
@@ -47,3 +50,88 @@ void variant_audio_update(void)
break;
}
}
+
+static const struct device_path xhci0_bt_path[] = {
+ {
+ .type = DEVICE_PATH_PCI,
+ .pci.devfn = PCIE_GPP_A_DEVFN
+ },
+ {
+ .type = DEVICE_PATH_PCI,
+ .pci.devfn = XHCI0_DEVFN
+ },
+ {
+ .type = DEVICE_PATH_USB,
+ .usb.port_type = 0,
+ .usb.port_id = 0
+ },
+ {
+ .type = DEVICE_PATH_USB,
+ .usb.port_type = 2,
+ .usb.port_id = 5
+ }
+};
+
+static const struct device_path xhci1_bt_path[] = {
+ {
+ .type = DEVICE_PATH_PCI,
+ .pci.devfn = PCIE_GPP_A_DEVFN
+ },
+ {
+ .type = DEVICE_PATH_PCI,
+ .pci.devfn = XHCI1_DEVFN
+ },
+ {
+ .type = DEVICE_PATH_USB,
+ .usb.port_type = 0,
+ .usb.port_id = 0
+ },
+ {
+ .type = DEVICE_PATH_USB,
+ .usb.port_type = 2,
+ .usb.port_id = 1
+ }
+};
+
+/*
+ * Removes reset_gpio from bluetooth device in device tree.
+ *
+ * The bluetooth device may be on XHCI0 or XHCI1 depending on SOC.
+ * 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)
+{
+ if (CONFIG(BOARD_GOOGLE_BASEBOARD_DALBOZ) || variant_uses_v3_schematics())
+ return;
+
+ baseboard_remove_bluetooth_reset_gpio();
+}