Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/59558 )
Change subject: mb/google/zork/var/shuboz: Add fw_config probe for ALC5682-VD & VS
......................................................................
mb/google/zork/var/shuboz: Add fw_config probe for ALC5682-VD & VS
ALC5682-VD/ALC5682I-VS load different kernel driver by different hid
name. Update hid name and machine_dev depending on the AUDIO_CODEC_SOURCE
field of fw_config. Define FW_CONFIG bits 36 - 37 (SSFC bits 4 - 5)
for codec selection.
ALC5682-VD: _HID = "10EC5682"
ALC5682I-VS: _HID = "RTL5682"
BUG=b:198689479
BRANCH=zork
TEST=ALC5682-VD/ALC5682I-VS audio codec can work
Signed-off-by: Kane Chen <kane_chen(a)pegatron.corp-partner.google.com>
Change-Id: I0c78aa166010ffa4d0cacc8a11d418d5a6906749
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59558
Reviewed-by: Reka Norman <rekanorman(a)chromium.org>
Reviewed-by: Kangheui Won <khwon(a)chromium.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M src/mainboard/google/zork/variants/baseboard/helpers.c
M src/mainboard/google/zork/variants/shuboz/overridetree.cb
2 files changed, 89 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Kane Chen: Looks good to me, but someone else must approve
Kangheui Won: Looks good to me, approved
Reka Norman: Looks good to me, but someone else must approve
diff --git a/src/mainboard/google/zork/variants/baseboard/helpers.c b/src/mainboard/google/zork/variants/baseboard/helpers.c
index d6c5e48..7057a48 100644
--- a/src/mainboard/google/zork/variants/baseboard/helpers.c
+++ b/src/mainboard/google/zork/variants/baseboard/helpers.c
@@ -55,6 +55,9 @@
/* Audio AMP type */
FW_CONFIG_MASK_AUDIO_AMP = 0x1,
FW_CONFIG_SHIFT_AUDIO_AMP = 35,
+ /* Audio codec type */
+ FW_CONFIG_MASK_AUDIO_CODEC_SOURCE = 0x3,
+ FW_CONFIG_SHIFT_AUDIO_CODEC_SOURCE = 36,
};
static int get_fw_config(uint64_t *val)
diff --git a/src/mainboard/google/zork/variants/shuboz/overridetree.cb b/src/mainboard/google/zork/variants/shuboz/overridetree.cb
index c3cc9e6..32a5e76 100644
--- a/src/mainboard/google/zork/variants/shuboz/overridetree.cb
+++ b/src/mainboard/google/zork/variants/shuboz/overridetree.cb
@@ -1,4 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-or-later
+fw_config
+ field AUDIO_CODEC_SOURCE 36 37
+ option AUDIO_CODEC_ALC5682 0
+ option AUDIO_CODEC_ALC5682I_VS 1
+ end
+end
chip soc/amd/picasso
@@ -51,6 +57,86 @@
# See AMD 55570-B1 Table 13: PCI Device ID Assignments.
device domain 0 on
subsystemid 0x1022 0x1510 inherit
+ device ref internal_bridge_a on
+ device ref acp on
+ chip drivers/amd/i2s_machine_dev
+ register "hid" = ""AMDI5682""
+ # DMIC select GPIO for ACP machine device
+ # This GPIO is used to select DMIC0 or DMIC1 by the
+ # kernel driver. It does not really have a polarity
+ # since low and high control the selection of DMIC and
+ # hence does not have an active polarity.
+ # Kernel driver does not use the polarity field and
+ # instead treats the GPIO selection as follows:
+ # Set low (0) = Select DMIC0
+ # Set high (1) = Select DMIC1
+ register "dmic_select_gpio" = "ACPI_GPIO_OUTPUT(GPIO_67)"
+ device generic 0.0 on
+ probe AUDIO_CODEC_SOURCE AUDIO_CODEC_ALC5682
+ end
+ end
+ chip drivers/amd/i2s_machine_dev
+ register "hid" = ""10029835""
+ # DMIC select GPIO for ACP machine device
+ # This GPIO is used to select DMIC0 or DMIC1 by the
+ # kernel driver. It does not really have a polarity
+ # since low and high control the selection of DMIC and
+ # hence does not have an active polarity.
+ # Kernel driver does not use the polarity field and
+ # instead treats the GPIO selection as follows:
+ # Set low (0) = Select DMIC0
+ # Set high (1) = Select DMIC1
+ register "dmic_select_gpio" = "ACPI_GPIO_OUTPUT(GPIO_67)"
+ device generic 1.0 on
+ probe AUDIO_CODEC_SOURCE AUDIO_CODEC_ALC5682I_VS
+ end
+ end
+ end # Audio
+ end
+ device ref lpc_bridge on
+ chip ec/google/chromeec
+ device pnp 0c09.0 on
+ chip ec/google/chromeec/i2c_tunnel
+ device generic 0.0 on
+ chip drivers/i2c/generic
+ register "hid" = ""10EC5682""
+ register "name" = ""RT58""
+ register "uid" = "1"
+ register "desc" = ""Realtek RT5682""
+ register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPIO_84)"
+ register "property_count" = "2"
+ register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER"
+ register "property_list[0].name" = ""realtek,jd-src""
+ register "property_list[0].integer" = "1"
+ register "property_list[1].type" = "ACPI_DP_TYPE_STRING"
+ register "property_list[1].name" = ""realtek,mclk-name""
+ register "property_list[1].string" = ""oscout1""
+ device i2c 1a on end
+ end
+ probe AUDIO_CODEC_SOURCE AUDIO_CODEC_ALC5682
+ end
+ device generic 1.0 on
+ chip drivers/i2c/generic
+ register "hid" = ""RTL5682""
+ register "name" = ""RT58""
+ register "uid" = "1"
+ register "desc" = ""Realtek RT5682""
+ register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPIO_84)"
+ register "property_count" = "2"
+ register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER"
+ register "property_list[0].name" = ""realtek,jd-src""
+ register "property_list[0].integer" = "1"
+ register "property_list[1].type" = "ACPI_DP_TYPE_STRING"
+ register "property_list[1].name" = ""realtek,mclk-name""
+ register "property_list[1].string" = ""oscout1""
+ device i2c 1a on end
+ end
+ probe AUDIO_CODEC_SOURCE AUDIO_CODEC_ALC5682I_VS
+ end
+ end
+ end
+ end
+ end
end # domain
device ref i2c_2 on
--
To view, visit https://review.coreboot.org/c/coreboot/+/59558
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I0c78aa166010ffa4d0cacc8a11d418d5a6906749
Gerrit-Change-Number: 59558
Gerrit-PatchSet: 15
Gerrit-Owner: Kane Chen <kane_chen(a)pegatron.corp-partner.google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Isaac Lee <isaaclee(a)google.com>
Gerrit-Reviewer: Kane Chen <kane_chen(a)pegatron.corp-partner.google.com>
Gerrit-Reviewer: Kangheui Won <khwon(a)chromium.org>
Gerrit-Reviewer: Reka Norman <rekanorman(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: chris wang <Chris.Wang(a)amd.com>
Gerrit-CC: Frank Chu <frank_chu(a)pegatron.corp-partner.google.com>
Gerrit-CC: Hank Lin <hank2_lin(a)pegatron.corp-partner.google.com>
Gerrit-CC: Ken Lu <ken_lu(a)pegatron.corp-partner.google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: Randy Wang <ifanw(a)google.com>
Gerrit-MessageType: merged
Attention is currently required from: Jason Glenesk, Nico Huber, Raul Rangel, Marshall Dawson, Felix Held.
Rob Barnes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/60024 )
Change subject: mb/google/guybrush: Add PSP_S0I3_RESUME_VERSTAGE Kconfig option
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
> Ah, so there's hardware init because verstage runs before the bootblock, […]
bootblock is not running during s0i3 resume, just verstage.
On AMD, S0i3 is only entered after explicit request from Kernel. The kernel needs to send a shutdown command to the TPM before reset is asserted so the TPM state can be preserved and restored.
--
To view, visit https://review.coreboot.org/c/coreboot/+/60024
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I2c185f787c1e77bd09f6cbbb1f47deb665ed0c79
Gerrit-Change-Number: 60024
Gerrit-PatchSet: 2
Gerrit-Owner: Rob Barnes <robbarnes(a)google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Comment-Date: Mon, 13 Dec 2021 13:59:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Rob Barnes <robbarnes(a)google.com>
Gerrit-MessageType: comment
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/59666 )
Change subject: soc/intel/alderlake: Implement function to map physical port to EC port
......................................................................
soc/intel/alderlake: Implement function to map physical port to EC port
Currently coreboot and EC had different logic to interpret TCSS port
number which would break retimer update functionality since coreboot
would pass wrong port information to EC.
To correct this, coreboot has implemented function which converts
coreboot physical port mapping to EC's abstract port mapping.
Each SoC needs to implement this weak function since only SoC will have
correct physical port mapping data. This function should resolve issue
of port mismatch since coreboot will count only enabled ports and
provide correct EC port number in return.
BUG=b:207057940
BRANCH=None
TEST=Check if retimer update works on Redrix and correct port
information is passed to EC.
Change-Id: I3735b7c7794b46123aba3beac8c0268ce72d658c
Signed-off-by: MAULIK V VAGHELA <maulik.v.vaghela(a)intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59666
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/soc/intel/alderlake/Makefile.inc
A src/soc/intel/alderlake/retimer.c
2 files changed, 33 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Tim Wawrzynczak: Looks good to me, approved
diff --git a/src/soc/intel/alderlake/Makefile.inc b/src/soc/intel/alderlake/Makefile.inc
index 6962ab2..d2c48b7 100644
--- a/src/soc/intel/alderlake/Makefile.inc
+++ b/src/soc/intel/alderlake/Makefile.inc
@@ -39,6 +39,7 @@
ramstage-y += pcie_rp.c
ramstage-y += pmc.c
ramstage-y += reset.c
+ramstage-y += retimer.c
ramstage-y += soundwire.c
ramstage-y += systemagent.c
ramstage-y += vr_config.c
diff --git a/src/soc/intel/alderlake/retimer.c b/src/soc/intel/alderlake/retimer.c
new file mode 100644
index 0000000..09bf112
--- /dev/null
+++ b/src/soc/intel/alderlake/retimer.c
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <drivers/intel/usb4/retimer/retimer.h>
+#include <intelblocks/tcss.h>
+
+int retimer_get_index_for_typec(uint8_t typec_port)
+{
+ int ec_port = 0;
+
+ const struct device *tcss_port_arr[] = {
+ DEV_PTR(tcss_usb3_port1),
+ DEV_PTR(tcss_usb3_port2),
+ DEV_PTR(tcss_usb3_port3),
+ DEV_PTR(tcss_usb3_port4),
+ };
+
+ for (uint8_t i = 0; i < MAX_TYPE_C_PORTS; i++) {
+ if (i == typec_port) {
+ printk(BIOS_ERR, "USB Type-C %d mapped to EC port %d\n", typec_port,
+ ec_port);
+ return ec_port;
+ }
+
+ if (is_dev_enabled(tcss_port_arr[i]))
+ ec_port++;
+ }
+
+ // Code should not come here if typec_port input is correct
+ return -1;
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/59666
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3735b7c7794b46123aba3beac8c0268ce72d658c
Gerrit-Change-Number: 59666
Gerrit-PatchSet: 16
Gerrit-Owner: Maulik V Vaghela <maulik.v.vaghela(a)intel.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: Subrata Banik <subrata.banik(a)intel.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/59665 )
Change subject: drivers/intel/usb4/retimer: Add function to correct EC port mapping
......................................................................
drivers/intel/usb4/retimer: Add function to correct EC port mapping
Currently coreboot interprets TCSS port number as per physical port
number while EC abstracts port number and provides indices as port
number. For example, if TCSS port 1 and 3 are enabled on the board,
coreboot will interpret port numbers as 0 and 2, but since only 2 ports
are enabled in the system EC will assign port numbers as 0 and 1.
This creates a port number mismatch while communicating between EC and
coreboot. This patch addresses issue where SoC can implement function
to map correct EC port as per port enabled in mainboard.
BUG=b:207057940
BRANCH=None
TEST=Check if code compiles successfully. Functionality will work once
function is implemented in SoC code.
Change-Id: Ia7a5e63838e6529196bd211516e4d665b084f79e
Signed-off-by: MAULIK V VAGHELA <maulik.v.vaghela(a)intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59665
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/drivers/intel/usb4/retimer/retimer.c
M src/drivers/intel/usb4/retimer/retimer.h
2 files changed, 36 insertions(+), 2 deletions(-)
Approvals:
build bot (Jenkins): Verified
Tim Wawrzynczak: Looks good to me, approved
diff --git a/src/drivers/intel/usb4/retimer/retimer.c b/src/drivers/intel/usb4/retimer/retimer.c
index e549525..8a20ebe 100644
--- a/src/drivers/intel/usb4/retimer/retimer.c
+++ b/src/drivers/intel/usb4/retimer/retimer.c
@@ -341,6 +341,7 @@
static char dfp[DEVICE_PATH_MAX];
struct acpi_pld pld;
uint8_t dfp_port, usb_port;
+ int ec_port = 0;
usb4_retimer_scope = acpi_device_scope(dev);
if (!usb4_retimer_scope || !config)
@@ -365,8 +366,14 @@
usb_device = config->dfp[dfp_port].typec_port;
usb_port = usb_device->path.usb.port_id;
+ ec_port = retimer_get_index_for_typec(usb_port);
+ if (ec_port == -1) {
+ printk(BIOS_ERR, "%s: No relative EC port found for TC port %d\n",
+ __func__, usb_port);
+ continue;
+ }
/* DFPx */
- snprintf(dfp, sizeof(dfp), "DFP%1d", usb_port);
+ snprintf(dfp, sizeof(dfp), "DFP%1d", ec_port);
acpigen_write_device(dfp);
/* _ADR part is for the lane adapter */
acpigen_write_ADR(dfp_port*2 + 1);
@@ -396,7 +403,7 @@
/* Return (Buffer (One) { 0x0 }) */
acpigen_write_return_singleton_buffer(0x0);
acpigen_pop_len();
- usb4_retimer_write_dsm(usb_port, INTEL_USB4_RETIMER_DSM_UUID,
+ usb4_retimer_write_dsm(ec_port, INTEL_USB4_RETIMER_DSM_UUID,
usb4_retimer_callbacks, ARRAY_SIZE(usb4_retimer_callbacks),
(void *)&config->dfp[dfp_port].power_gpio);
/* Default case: Return (Buffer (One) { 0x0 }) */
@@ -436,3 +443,20 @@
__weak void ec_retimer_fw_update(uint8_t data)
{
}
+
+/*
+ * This function will convert CPU physical port mapping to abstract
+ * EC port mapping.
+ * For example, board might have enabled TCSS port 1 and 3 as per physical
+ * port mapping. Since only 2 TCSS ports are enabled EC will index it as port 0
+ * and port 1. So there will be an issue when coreboot sends command to EC for
+ * port 3 (with coreboot index of 2). EC will produce an error due to wrong index.
+ *
+ * Note: Each SoC code using retimer driver needs to implement this function
+ * since SoC will have physical port details.
+ */
+__weak int retimer_get_index_for_typec(uint8_t typec_port)
+{
+ /* By default assume that retimer port index = Type C port */
+ return (int)typec_port;
+}
diff --git a/src/drivers/intel/usb4/retimer/retimer.h b/src/drivers/intel/usb4/retimer/retimer.h
index 5a040a0..ff87c19 100644
--- a/src/drivers/intel/usb4/retimer/retimer.h
+++ b/src/drivers/intel/usb4/retimer/retimer.h
@@ -30,5 +30,15 @@
const char *ec_retimer_fw_update_path(void);
void ec_retimer_fw_update(uint8_t data);
+/*
+ * This function will convert CPU physical port mapping to abstract
+ * EC port mapping. For example, board might have enabled TCSS port 1
+ * and 3 as per physical port mapping. Since only 2 TCSS ports are enabled
+ * EC will name it as port 0 and port 1. So there will be mismatch when
+ * coreboot sends index for port 3.
+ * Each SoC code using retimer driver needs to implement this function
+ * since SoC will have physical port details.
+ */
+int retimer_get_index_for_typec(uint8_t typec_port);
#endif /* _DRIVERS_INTEL_USB4_RETIMER_H_ */
--
To view, visit https://review.coreboot.org/c/coreboot/+/59665
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ia7a5e63838e6529196bd211516e4d665b084f79e
Gerrit-Change-Number: 59665
Gerrit-PatchSet: 11
Gerrit-Owner: Maulik V Vaghela <maulik.v.vaghela(a)intel.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: Subrata Banik <subrata.banik(a)intel.com>
Gerrit-Reviewer: Sugnan Prabhu S <sugnan.prabhu.s(a)intel.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged