Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42372 )
Change subject: cpu/x86/smm: Clean up SMM_ASEG
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/42372/1/src/cpu/x86/smm/aseg_regio…
File src/cpu/x86/smm/aseg_region.c:
https://review.coreboot.org/c/coreboot/+/42372/1/src/cpu/x86/smm/aseg_regio…
PS1, Line 19: 0x20000
Use a define for that?
--
To view, visit https://review.coreboot.org/c/coreboot/+/42372
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I519c242aa3b837f3e09fd34dee5aa4a2dc3c97ba
Gerrit-Change-Number: 42372
Gerrit-PatchSet: 1
Gerrit-Owner: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 23 Jun 2020 06:01:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42337 )
Change subject: mb/google/zork: Add FSP_M_FILE and FSP_S_FILE selection to Kconfig
......................................................................
mb/google/zork: Add FSP_M_FILE and FSP_S_FILE selection to Kconfig
This change adds FSP_M_FILE and FSP_S_FILE selection to Kconfig
dependent on ADD_FSP_BINARIES. This relieves each variant from setting
this config separately in config.${VARIANT} in chromiumos-overlay in
chromium tree.
Change-Id: Ib1db5e1a53afb9eb2d2bf200f8e806160014e06c
Signed-off-by: Furquan Shaikh <furquan(a)google.com>
---
M src/mainboard/google/zork/Kconfig
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42337/1
diff --git a/src/mainboard/google/zork/Kconfig b/src/mainboard/google/zork/Kconfig
index ab24213..442d569 100644
--- a/src/mainboard/google/zork/Kconfig
+++ b/src/mainboard/google/zork/Kconfig
@@ -136,4 +136,14 @@
help
Which board version did FW_CONFIG become valid in CBI.
+config FSP_M_FILE
+ string
+ depends on ADD_FSP_BINARIES
+ default "3rdparty/amd_blobs/picasso/PICASSO_M.fd"
+
+config FSP_S_FILE
+ string
+ depends on ADD_FSP_BINARIES
+ default "3rdparty/amd_blobs/picasso/PICASSO_S.fd"
+
endif # BOARD_GOOGLE_BASEBOARD_TREMBYLE || BOARD_GOOGLE_BASEBOARD_DALBOZ
--
To view, visit https://review.coreboot.org/c/coreboot/+/42337
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ib1db5e1a53afb9eb2d2bf200f8e806160014e06c
Gerrit-Change-Number: 42337
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan(a)google.com>
Gerrit-MessageType: newchange
Zhuohao Lee has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42185 )
Change subject: palkia: separate the gpio pins control for the second touch
......................................................................
palkia: separate the gpio pins control for the second touch
We use the different gpio pins to control the second touch,
so we need to modify the devicetree to adopt this change.
With this change, we can control the primary touch controller
and secondary touch controller respectively.
BUG=b:149714955
TEST=touch works correctly
Change-Id: I1f896e334e51c78300af724cbef8d57641ae5612
Signed-off-by: Zhuohao Lee <zhuohao(a)chromium.org>
---
M src/mainboard/google/hatch/variants/palkia/gpio.c
M src/mainboard/google/hatch/variants/palkia/overridetree.cb
2 files changed, 7 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/85/42185/1
diff --git a/src/mainboard/google/hatch/variants/palkia/gpio.c b/src/mainboard/google/hatch/variants/palkia/gpio.c
index 04f1d85..ff02b25 100644
--- a/src/mainboard/google/hatch/variants/palkia/gpio.c
+++ b/src/mainboard/google/hatch/variants/palkia/gpio.c
@@ -45,6 +45,10 @@
/* C23 : UART2_CTS# ==> NC */
PAD_NC(GPP_C23, NONE),
+ /* D4 : USI_BASE_REPORT_EN */
+ PAD_CFG_GPO(GPP_D4, 0, DEEP),
+ /* D10 : GPP_D10 ==> EN_PP3300_DX_TOUCHSCREEN */
+ PAD_CFG_GPO(GPP_D10, 0, DEEP),
/* D16 : USI_INT_L */
PAD_CFG_GPI_APIC(GPP_D16, NONE, PLTRST, LEVEL, INVERT),
diff --git a/src/mainboard/google/hatch/variants/palkia/overridetree.cb b/src/mainboard/google/hatch/variants/palkia/overridetree.cb
index 31017bc..7de423b 100644
--- a/src/mainboard/google/hatch/variants/palkia/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/palkia/overridetree.cb
@@ -76,7 +76,7 @@
device usb 2.5 off end
end
chip drivers/usb/acpi
- # No Right Tpype-C port
+ # No Right Type-C port
device usb 3.1 off end
end
chip drivers/usb/acpi
@@ -136,12 +136,12 @@
"ACPI_IRQ_EDGE_LOW(GPP_C7_IRQ)"
register "generic.probed" = "1"
register "generic.enable_gpio" =
- "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D9)"
+ "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D10)"
register "generic.enable_delay_ms" = "12"
register "generic.enable_off_delay_ms" = "10"
register "generic.has_power_resource" = "1"
register "generic.stop_gpio" =
- "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_C4)"
+ "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D4)"
register "generic.stop_delay_ms" = "15"
register "generic.stop_off_delay_ms" = "5"
register "hid_desc_reg_offset" = "0x01"
--
To view, visit https://review.coreboot.org/c/coreboot/+/42185
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I1f896e334e51c78300af724cbef8d57641ae5612
Gerrit-Change-Number: 42185
Gerrit-PatchSet: 1
Gerrit-Owner: Zhuohao Lee <zhuohao(a)chromium.org>
Gerrit-MessageType: newchange
Jonathan Zhang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42022 )
Change subject: mb/facebook/watson: support firmware version
......................................................................
mb/facebook/watson: support firmware version
SMBIOS type 0 has a field for overall firmware version. This version
is the semantic version of the entire host firmware, with coreboot
being part of it.
In build/release process, overall firmware version is expected to
be updated into version variable in VPD_RO flash region.
If "version" key is found in VPD_RO flash region, use its value to fill
in SMBIOS type 0. Otherwise, generate a BIOS_ERR message, concatenate
"cb_ver:" and coreboot_version to fill in SMBIOS type 0.
Signed-off-by: Jonathan Zhang <jonzhang(a)fb.com>
Change-Id: I831fe7019ddd75beb6824b8e09445f339bf7cc8d
---
M src/mainboard/facebook/watson/Makefile.inc
A src/mainboard/facebook/watson/ramstage.c
2 files changed, 46 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/22/42022/1
diff --git a/src/mainboard/facebook/watson/Makefile.inc b/src/mainboard/facebook/watson/Makefile.inc
index f1384f7..17a5918 100644
--- a/src/mainboard/facebook/watson/Makefile.inc
+++ b/src/mainboard/facebook/watson/Makefile.inc
@@ -14,5 +14,6 @@
##
ramstage-y += irqroute.c
+ramstage-y += ramstage.c
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
diff --git a/src/mainboard/facebook/watson/ramstage.c b/src/mainboard/facebook/watson/ramstage.c
new file mode 100644
index 0000000..f844d03
--- /dev/null
+++ b/src/mainboard/facebook/watson/ramstage.c
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ * Copyright (C) 2015 Intel Corp.
+ * Copyright (C) 2020 Facebook Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <console/console.h>
+#include <drivers/vpd/vpd.h>
+#include <smbios.h>
+#include <version.h>
+#include <string.h>
+
+#define VER_LEN 20
+
+/*
+ * If "version" key is found in VPD_RO, use its value as overall
+ * firmware version; otherwise use coreboot_version as overall
+ * firmware version.
+ */
+const char *smbios_mainboard_bios_version(void)
+{
+ static char version[VER_LEN] = {0};
+
+ if (vpd_gets("version", version, VER_LEN, VPD_RO)) {
+ printk(BIOS_DEBUG, "Got version from VPD: %s\n", version);
+ } else {
+ static char cb_ver[] = "cb_ver:";
+ strcpy(version, cb_ver);
+ strncpy(version + strlen(cb_ver), coreboot_version,
+ VER_LEN - strlen(cb_ver) - 1);
+ printk(BIOS_ERR, "Unable to get version from VPD, use %s\n", version);
+ }
+ return version;
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/42022
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: 4.11_branch
Gerrit-Change-Id: I831fe7019ddd75beb6824b8e09445f339bf7cc8d
Gerrit-Change-Number: 42022
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Zhang <jonzhang(a)fb.com>
Gerrit-MessageType: newchange
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42672 )
Change subject: mb/google/hatch: Make puff and variants share common mainboard.c
......................................................................
mb/google/hatch: Make puff and variants share common mainboard.c
Here we consolidate some of the mainboard.c duplication between
Puff and it's variants.
Customizations can be done later via introducing a devicetree
parameterisation.
BUG=b:154071868
BRANCH=none
TEST=none
Change-Id: I75c2de7ae8efd544d800bc77e34e667c3afa4b01
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M src/mainboard/google/hatch/variants/baseboard/Makefile.inc
R src/mainboard/google/hatch/variants/baseboard/mainboard.c
M src/mainboard/google/hatch/variants/duffy/Makefile.inc
D src/mainboard/google/hatch/variants/duffy/mainboard.c
M src/mainboard/google/hatch/variants/kaisa/Makefile.inc
D src/mainboard/google/hatch/variants/kaisa/mainboard.c
M src/mainboard/google/hatch/variants/noibat/Makefile.inc
D src/mainboard/google/hatch/variants/noibat/mainboard.c
M src/mainboard/google/hatch/variants/puff/Makefile.inc
9 files changed, 1 insertion(+), 485 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/42672/1
diff --git a/src/mainboard/google/hatch/variants/baseboard/Makefile.inc b/src/mainboard/google/hatch/variants/baseboard/Makefile.inc
index c051437..c92d1bb 100644
--- a/src/mainboard/google/hatch/variants/baseboard/Makefile.inc
+++ b/src/mainboard/google/hatch/variants/baseboard/Makefile.inc
@@ -6,6 +6,7 @@
romstage-y += memory.c
ramstage-y += gpio.c
+ramstage-$(BOARD_GOOGLE_BASEBOARD_PUFF) += mainboard.c
verstage-y += gpio.c
diff --git a/src/mainboard/google/hatch/variants/puff/mainboard.c b/src/mainboard/google/hatch/variants/baseboard/mainboard.c
similarity index 100%
rename from src/mainboard/google/hatch/variants/puff/mainboard.c
rename to src/mainboard/google/hatch/variants/baseboard/mainboard.c
diff --git a/src/mainboard/google/hatch/variants/duffy/Makefile.inc b/src/mainboard/google/hatch/variants/duffy/Makefile.inc
index 2afd494..3b5b7d0 100644
--- a/src/mainboard/google/hatch/variants/duffy/Makefile.inc
+++ b/src/mainboard/google/hatch/variants/duffy/Makefile.inc
@@ -1,5 +1,4 @@
## SPDX-License-Identifier: GPL-2.0-only
ramstage-y += gpio.c
-ramstage-y += mainboard.c
bootblock-y += gpio.c
diff --git a/src/mainboard/google/hatch/variants/duffy/mainboard.c b/src/mainboard/google/hatch/variants/duffy/mainboard.c
deleted file mode 100644
index 253a7c9..0000000
--- a/src/mainboard/google/hatch/variants/duffy/mainboard.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <baseboard/variants.h>
-#include <chip.h>
-#include <delay.h>
-#include <device/device.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include <ec/google/chromeec/ec.h>
-#include <gpio.h>
-#include <intelblocks/power_limit.h>
-#include <soc/pci_devs.h>
-#include <timer.h>
-
-#define GPIO_HDMI_HPD GPP_E13
-#define GPIO_DP_HPD GPP_E14
-
-/* TODO: This can be moved to common directory */
-static void wait_for_hpd(gpio_t gpio, long timeout)
-{
- struct stopwatch sw;
-
- printk(BIOS_INFO, "Waiting for HPD\n");
- stopwatch_init_msecs_expire(&sw, timeout);
- while (!gpio_get(gpio)) {
- if (stopwatch_expired(&sw)) {
- printk(BIOS_WARNING,
- "HPD not ready after %ldms. Abort.\n", timeout);
- return;
- }
- mdelay(200);
- }
- printk(BIOS_INFO, "HPD ready after %lu ms\n",
- stopwatch_duration_msecs(&sw));
-}
-
-/*
- * For type-C chargers, set PL2 to 90% of max power to account for
- * cable loss and FET Rdson loss in the path from the source.
- */
-#define SET_PSYSPL2(w) (9 * (w) / 10)
-#define PUFF_U22_PL2 (35)
-#define PUFF_U62_U42_PL2 (51)
-#define PUFF_CELERON_PENTIUM_PSYSPL2 (65)
-#define PUFF_CORE_CPU_PSYSPL2 (90)
-#define PUFF_MAX_TIME_WINDOW 6
-#define PUFF_MIN_DUTYCYCLE 4
-
-/*
- * mainboard_set_power_limits
- *
- * Set Pl2 and SysPl2 values based on detected charger.
- * Values are defined below but we use U22 value for all SKUs for now.
- * definitions:
- * x = no value entered. Use default value in parenthesis.
- * will set 0 to anything that shouldn't be set.
- * n = max value of power adapter.
- * +-------------+-----+---------+-----------+-------+
- * | sku_id | PL2 | PsysPL2 | PsysPL3 | PL4 |
- * +-------------+-----+---------+-----------+-------+
- * | i7 U42 | 51 | 90 | x(.85PL4) | x(82) |
- * | i3 U22 | 35 | 65 | x(.85PL4) | x(51) |
- * +-------------+-----+---------+-----------+-------+
- * For USB C charger:
- * +-------------+-----------------+---------+---------+-------+
- * | Max Power(W)| PL2 | PsysPL2 | PsysPL3 | PL4 |
- * +-------------+-----+-----------+---------+---------+-------+
- * | n | min(0.9n, PL2) | 0.9n | 0.9n | 0.9n |
- * +-------------+-----+-----------+---------+---------+-------+
- */
-
-/*
- * Psys_pmax considerations
- *
- * Given the hardware design in puff, the serial shunt resistor is 0.01ohm.
- * The full scale of hardware PSYS signal 0.8v maps to system current 9.6A
- * instead of real system power. The equation is shown below:
- * PSYS = 0.8v = (0.01ohm x Iinput) x 50 (INA213, gain 50V/V) x 15k/(15k + 75k)
- * Hence, Iinput (Amps) = 9.6A
- * Since there is no voltage information from PSYS, different voltage input
- * would map to different Psys_pmax settings:
- * For Type-C 15V, the Psys_pmax sholud be 15v x 9.6A = 144W
- * For Type-C 20V, the Psys_pmax should be 20v x 9.6A = 192W
- * For a barral jack, the Psys_pmax should be 19v x 9.6A = 182.4W
- */
-#define PSYS_IMAX 9600
-#define BJ_VOLTS_MV 19000
-
-static void mainboard_set_power_limits(struct soc_power_limits_config *conf)
-{
- enum usb_chg_type type;
- u32 watts;
- u16 volts_mv, current_ma;
- u32 psyspl2 = PUFF_CELERON_PENTIUM_PSYSPL2; // default BJ value
- u32 pl2 = PUFF_U22_PL2; // default PL2 for U22
- int rv = google_chromeec_get_usb_pd_power_info(&type, ¤t_ma, &volts_mv);
-
- struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT);
- u16 mch_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff;
- dev = pcidev_path_on_root(SA_DEVFN_IGD);
- u16 igd_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff;
-
- /* use SoC default value for PsysPL3 and PL4 unless we're on USB-PD*/
- conf->tdp_psyspl3 = 0;
- conf->tdp_pl4 = 0;
-
- if (rv == 0 && type == USB_CHG_TYPE_PD) {
- /* Detected USB-PD. Base on max value of adapter */
- watts = ((u32)current_ma * volts_mv) / 1000000;
- /* set psyspl2 to 90% of adapter rating */
- psyspl2 = SET_PSYSPL2(watts);
-
- /* Limit PL2 if the adapter is with lower capability */
- if (mch_id == PCI_DEVICE_ID_INTEL_CML_ULT ||
- mch_id == PCI_DEVICE_ID_INTEL_CML_ULT_6_2)
- pl2 = (psyspl2 > PUFF_U62_U42_PL2) ? PUFF_U62_U42_PL2 : psyspl2;
- else
- pl2 = (psyspl2 > PUFF_U22_PL2) ? PUFF_U22_PL2 : psyspl2;
-
- conf->tdp_psyspl3 = psyspl2;
- /* set max possible time window */
- conf->tdp_psyspl3_time = PUFF_MAX_TIME_WINDOW;
- /* set minimum duty cycle */
- conf->tdp_psyspl3_dutycycle = PUFF_MIN_DUTYCYCLE;
- /* No data about an arbitrary Type-C adapter, set pl4 conservatively. */
- conf->tdp_pl4 = psyspl2;
- } else {
- /*
- * Input type is barrel jack, from the SKU matrix:
- * 1. i3/i5/i7 SKUs use 90W BJ
- * 2. Celeron and Pentium use 65W BJ (default)
- */
- volts_mv = BJ_VOLTS_MV;
- /* Use IGD ID to check if CPU is Core SKUs */
- if (igd_id != PCI_DEVICE_ID_INTEL_CML_GT1_ULT_1 &&
- igd_id != PCI_DEVICE_ID_INTEL_CML_GT2_ULT_5) {
- psyspl2 = PUFF_CORE_CPU_PSYSPL2;
- if (mch_id == PCI_DEVICE_ID_INTEL_CML_ULT ||
- mch_id == PCI_DEVICE_ID_INTEL_CML_ULT_6_2)
- pl2 = PUFF_U62_U42_PL2;
- }
- }
- /* voltage unit is milliVolts and current is in milliAmps */
- conf->psys_pmax = (u16)(((u32)PSYS_IMAX * volts_mv) / 1000000);
-
- conf->tdp_pl2_override = pl2;
- conf->tdp_psyspl2 = psyspl2;
-}
-
-void variant_ramstage_init(void)
-{
- static const long display_timeout_ms = 3000;
- struct soc_power_limits_config *soc_config;
- config_t *confg = config_of_soc();
-
- /* This is reconfigured back to whatever FSP-S expects by gpio_configure_pads. */
- gpio_input(GPIO_HDMI_HPD);
- gpio_input(GPIO_DP_HPD);
- if (display_init_required()
- && !gpio_get(GPIO_HDMI_HPD)
- && !gpio_get(GPIO_DP_HPD)) {
- /* This has to be done before FSP-S runs. */
- if (google_chromeec_wait_for_displayport(display_timeout_ms))
- wait_for_hpd(GPIO_DP_HPD, display_timeout_ms);
- }
- /* Psys_pmax needs to be setup before FSP-S */
- soc_config = &confg->power_limits_config;
- mainboard_set_power_limits(soc_config);
-}
diff --git a/src/mainboard/google/hatch/variants/kaisa/Makefile.inc b/src/mainboard/google/hatch/variants/kaisa/Makefile.inc
index 2afd494..3b5b7d0 100644
--- a/src/mainboard/google/hatch/variants/kaisa/Makefile.inc
+++ b/src/mainboard/google/hatch/variants/kaisa/Makefile.inc
@@ -1,5 +1,4 @@
## SPDX-License-Identifier: GPL-2.0-only
ramstage-y += gpio.c
-ramstage-y += mainboard.c
bootblock-y += gpio.c
diff --git a/src/mainboard/google/hatch/variants/kaisa/mainboard.c b/src/mainboard/google/hatch/variants/kaisa/mainboard.c
deleted file mode 100644
index 253a7c9..0000000
--- a/src/mainboard/google/hatch/variants/kaisa/mainboard.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <baseboard/variants.h>
-#include <chip.h>
-#include <delay.h>
-#include <device/device.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include <ec/google/chromeec/ec.h>
-#include <gpio.h>
-#include <intelblocks/power_limit.h>
-#include <soc/pci_devs.h>
-#include <timer.h>
-
-#define GPIO_HDMI_HPD GPP_E13
-#define GPIO_DP_HPD GPP_E14
-
-/* TODO: This can be moved to common directory */
-static void wait_for_hpd(gpio_t gpio, long timeout)
-{
- struct stopwatch sw;
-
- printk(BIOS_INFO, "Waiting for HPD\n");
- stopwatch_init_msecs_expire(&sw, timeout);
- while (!gpio_get(gpio)) {
- if (stopwatch_expired(&sw)) {
- printk(BIOS_WARNING,
- "HPD not ready after %ldms. Abort.\n", timeout);
- return;
- }
- mdelay(200);
- }
- printk(BIOS_INFO, "HPD ready after %lu ms\n",
- stopwatch_duration_msecs(&sw));
-}
-
-/*
- * For type-C chargers, set PL2 to 90% of max power to account for
- * cable loss and FET Rdson loss in the path from the source.
- */
-#define SET_PSYSPL2(w) (9 * (w) / 10)
-#define PUFF_U22_PL2 (35)
-#define PUFF_U62_U42_PL2 (51)
-#define PUFF_CELERON_PENTIUM_PSYSPL2 (65)
-#define PUFF_CORE_CPU_PSYSPL2 (90)
-#define PUFF_MAX_TIME_WINDOW 6
-#define PUFF_MIN_DUTYCYCLE 4
-
-/*
- * mainboard_set_power_limits
- *
- * Set Pl2 and SysPl2 values based on detected charger.
- * Values are defined below but we use U22 value for all SKUs for now.
- * definitions:
- * x = no value entered. Use default value in parenthesis.
- * will set 0 to anything that shouldn't be set.
- * n = max value of power adapter.
- * +-------------+-----+---------+-----------+-------+
- * | sku_id | PL2 | PsysPL2 | PsysPL3 | PL4 |
- * +-------------+-----+---------+-----------+-------+
- * | i7 U42 | 51 | 90 | x(.85PL4) | x(82) |
- * | i3 U22 | 35 | 65 | x(.85PL4) | x(51) |
- * +-------------+-----+---------+-----------+-------+
- * For USB C charger:
- * +-------------+-----------------+---------+---------+-------+
- * | Max Power(W)| PL2 | PsysPL2 | PsysPL3 | PL4 |
- * +-------------+-----+-----------+---------+---------+-------+
- * | n | min(0.9n, PL2) | 0.9n | 0.9n | 0.9n |
- * +-------------+-----+-----------+---------+---------+-------+
- */
-
-/*
- * Psys_pmax considerations
- *
- * Given the hardware design in puff, the serial shunt resistor is 0.01ohm.
- * The full scale of hardware PSYS signal 0.8v maps to system current 9.6A
- * instead of real system power. The equation is shown below:
- * PSYS = 0.8v = (0.01ohm x Iinput) x 50 (INA213, gain 50V/V) x 15k/(15k + 75k)
- * Hence, Iinput (Amps) = 9.6A
- * Since there is no voltage information from PSYS, different voltage input
- * would map to different Psys_pmax settings:
- * For Type-C 15V, the Psys_pmax sholud be 15v x 9.6A = 144W
- * For Type-C 20V, the Psys_pmax should be 20v x 9.6A = 192W
- * For a barral jack, the Psys_pmax should be 19v x 9.6A = 182.4W
- */
-#define PSYS_IMAX 9600
-#define BJ_VOLTS_MV 19000
-
-static void mainboard_set_power_limits(struct soc_power_limits_config *conf)
-{
- enum usb_chg_type type;
- u32 watts;
- u16 volts_mv, current_ma;
- u32 psyspl2 = PUFF_CELERON_PENTIUM_PSYSPL2; // default BJ value
- u32 pl2 = PUFF_U22_PL2; // default PL2 for U22
- int rv = google_chromeec_get_usb_pd_power_info(&type, ¤t_ma, &volts_mv);
-
- struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT);
- u16 mch_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff;
- dev = pcidev_path_on_root(SA_DEVFN_IGD);
- u16 igd_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff;
-
- /* use SoC default value for PsysPL3 and PL4 unless we're on USB-PD*/
- conf->tdp_psyspl3 = 0;
- conf->tdp_pl4 = 0;
-
- if (rv == 0 && type == USB_CHG_TYPE_PD) {
- /* Detected USB-PD. Base on max value of adapter */
- watts = ((u32)current_ma * volts_mv) / 1000000;
- /* set psyspl2 to 90% of adapter rating */
- psyspl2 = SET_PSYSPL2(watts);
-
- /* Limit PL2 if the adapter is with lower capability */
- if (mch_id == PCI_DEVICE_ID_INTEL_CML_ULT ||
- mch_id == PCI_DEVICE_ID_INTEL_CML_ULT_6_2)
- pl2 = (psyspl2 > PUFF_U62_U42_PL2) ? PUFF_U62_U42_PL2 : psyspl2;
- else
- pl2 = (psyspl2 > PUFF_U22_PL2) ? PUFF_U22_PL2 : psyspl2;
-
- conf->tdp_psyspl3 = psyspl2;
- /* set max possible time window */
- conf->tdp_psyspl3_time = PUFF_MAX_TIME_WINDOW;
- /* set minimum duty cycle */
- conf->tdp_psyspl3_dutycycle = PUFF_MIN_DUTYCYCLE;
- /* No data about an arbitrary Type-C adapter, set pl4 conservatively. */
- conf->tdp_pl4 = psyspl2;
- } else {
- /*
- * Input type is barrel jack, from the SKU matrix:
- * 1. i3/i5/i7 SKUs use 90W BJ
- * 2. Celeron and Pentium use 65W BJ (default)
- */
- volts_mv = BJ_VOLTS_MV;
- /* Use IGD ID to check if CPU is Core SKUs */
- if (igd_id != PCI_DEVICE_ID_INTEL_CML_GT1_ULT_1 &&
- igd_id != PCI_DEVICE_ID_INTEL_CML_GT2_ULT_5) {
- psyspl2 = PUFF_CORE_CPU_PSYSPL2;
- if (mch_id == PCI_DEVICE_ID_INTEL_CML_ULT ||
- mch_id == PCI_DEVICE_ID_INTEL_CML_ULT_6_2)
- pl2 = PUFF_U62_U42_PL2;
- }
- }
- /* voltage unit is milliVolts and current is in milliAmps */
- conf->psys_pmax = (u16)(((u32)PSYS_IMAX * volts_mv) / 1000000);
-
- conf->tdp_pl2_override = pl2;
- conf->tdp_psyspl2 = psyspl2;
-}
-
-void variant_ramstage_init(void)
-{
- static const long display_timeout_ms = 3000;
- struct soc_power_limits_config *soc_config;
- config_t *confg = config_of_soc();
-
- /* This is reconfigured back to whatever FSP-S expects by gpio_configure_pads. */
- gpio_input(GPIO_HDMI_HPD);
- gpio_input(GPIO_DP_HPD);
- if (display_init_required()
- && !gpio_get(GPIO_HDMI_HPD)
- && !gpio_get(GPIO_DP_HPD)) {
- /* This has to be done before FSP-S runs. */
- if (google_chromeec_wait_for_displayport(display_timeout_ms))
- wait_for_hpd(GPIO_DP_HPD, display_timeout_ms);
- }
- /* Psys_pmax needs to be setup before FSP-S */
- soc_config = &confg->power_limits_config;
- mainboard_set_power_limits(soc_config);
-}
diff --git a/src/mainboard/google/hatch/variants/noibat/Makefile.inc b/src/mainboard/google/hatch/variants/noibat/Makefile.inc
index 2afd494..3b5b7d0 100644
--- a/src/mainboard/google/hatch/variants/noibat/Makefile.inc
+++ b/src/mainboard/google/hatch/variants/noibat/Makefile.inc
@@ -1,5 +1,4 @@
## SPDX-License-Identifier: GPL-2.0-only
ramstage-y += gpio.c
-ramstage-y += mainboard.c
bootblock-y += gpio.c
diff --git a/src/mainboard/google/hatch/variants/noibat/mainboard.c b/src/mainboard/google/hatch/variants/noibat/mainboard.c
deleted file mode 100644
index b5bc699..0000000
--- a/src/mainboard/google/hatch/variants/noibat/mainboard.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <baseboard/variants.h>
-#include <chip.h>
-#include <delay.h>
-#include <device/device.h>
-#include <ec/google/chromeec/ec.h>
-#include <gpio.h>
-#include <intelblocks/power_limit.h>
-#include <timer.h>
-
-#define GPIO_HDMI_HPD GPP_E13
-#define GPIO_DP_HPD GPP_E14
-
-/* TODO: This can be moved to common directory */
-static void wait_for_hpd(gpio_t gpio, long timeout)
-{
- struct stopwatch sw;
-
- printk(BIOS_INFO, "Waiting for HPD\n");
- stopwatch_init_msecs_expire(&sw, timeout);
- while (!gpio_get(gpio)) {
- if (stopwatch_expired(&sw)) {
- printk(BIOS_WARNING,
- "HPD not ready after %ldms. Abort.\n", timeout);
- return;
- }
- mdelay(200);
- }
- printk(BIOS_INFO, "HPD ready after %lu ms\n",
- stopwatch_duration_msecs(&sw));
-}
-
-/*
- * For type-C chargers, set PL2 to 90% of max power to account for
- * cable loss and FET Rdson loss in the path from the source.
- */
-#define SET_PSYSPL2(w) (9 * (w) / 10)
-
-#define PUFF_PL2 (35)
-
-#define PUFF_PSYSPL2 (58)
-
-#define PUFF_MAX_TIME_WINDOW 6
-#define PUFF_MIN_DUTYCYCLE 4
-
-/*
- * mainboard_set_power_limits
- *
- * Set Pl2 and SysPl2 values based on detected charger.
- * Values are defined below but we use U22 value for all SKUs for now.
- * definitions:
- * x = no value entered. Use default value in parenthesis.
- * will set 0 to anything that shouldn't be set.
- * n = max value of power adapter.
- * +-------------+-----+---------+-----------+-------+
- * | sku_id | PL2 | PsysPL2 | PsysPL3 | PL4 |
- * +-------------+-----+---------+-----------+-------+
- * | i7 U42 | 51 | 81 | x(.85PL4) | x(82) |
- * | celeron U22 | 35 | 58 | x(.85PL4) | x(51) |
- * +-------------+-----+---------+-----------+-------+
- * For USB C charger:
- * +-------------+-----+---------+---------+-------+
- * | Max Power(W)| PL2 | PsysPL2 | PsysPL3 | PL4 |
- * +-------------+-----+---------+---------+-------+
- * | 60 (U42) | 44 | 54 | 54 | 54 |
- * | 60 (U22) | 29 | 54 | 54 | x(43) |
- * | n (U42) | 44 | .9n | .9n | .9n |
- * | n (U22) | 29 | .9n | .9n | x(43) |
- * +-------------+-----+---------+---------+-------+
- */
-
-/*
- * Psys_pmax considerations
- *
- * Given the hardware design in puff, the serial shunt resistor is 0.01ohm.
- * The full scale of hardware PSYS signal 0.8v maps to system current 9.6A
- * instead of real system power. The equation is shown below:
- * PSYS = 0.8v = (0.01ohm x Iinput) x 50 (INA213, gain 50V/V) x 15k/(15k + 75k)
- * Hence, Iinput (Amps) = 9.6A
- * Since there is no voltage information from PSYS, different voltage input
- * would map to different Psys_pmax settings:
- * For Type-C 15V, the Psys_pmax sholud be 15v x 9.6A = 144W
- * For Type-C 20V, the Psys_pmax should be 20v x 9.6A = 192W
- * For a barral jack, the Psys_pmax should be 19v x 9.6A = 182.4W
- */
-#define PSYS_IMAX 9600
-#define BJ_VOLTS_MV 19000
-
-static void mainboard_set_power_limits(struct soc_power_limits_config *conf)
-{
- enum usb_chg_type type;
- u32 watts;
- u16 volts_mv, current_ma;
- u32 psyspl2 = PUFF_PSYSPL2; // default barrel jack value for U22
- int rv = google_chromeec_get_usb_pd_power_info(&type, ¤t_ma, &volts_mv);
-
- /* use SoC default value for PsysPL3 and PL4 unless we're on USB-PD*/
- conf->tdp_psyspl3 = 0;
- conf->tdp_pl4 = 0;
-
- if (rv == 0 && type == USB_CHG_TYPE_PD) {
- /* Detected USB-PD. Base on max value of adapter */
- watts = ((u32)current_ma * volts_mv) / 1000000;
- psyspl2 = watts;
- conf->tdp_psyspl3 = SET_PSYSPL2(psyspl2);
- /* set max possible time window */
- conf->tdp_psyspl3_time = PUFF_MAX_TIME_WINDOW;
- /* set minimum duty cycle */
- conf->tdp_psyspl3_dutycycle = PUFF_MIN_DUTYCYCLE;
- conf->tdp_pl4 = SET_PSYSPL2(psyspl2);
- } else {
- /* Input type is barrel jack */
- volts_mv = BJ_VOLTS_MV;
- }
- /* voltage unit is milliVolts and current is in milliAmps */
- conf->psys_pmax = (u16)(((u32)PSYS_IMAX * volts_mv) / 1000000);
-
- conf->tdp_pl2_override = PUFF_PL2;
- /* set psyspl2 to 90% of max adapter power */
- conf->tdp_psyspl2 = SET_PSYSPL2(psyspl2);
-}
-
-void variant_ramstage_init(void)
-{
- static const long display_timeout_ms = 3000;
- struct soc_power_limits_config *soc_config;
- config_t *conf = config_of_soc();
-
- /* This is reconfigured back to whatever FSP-S expects by gpio_configure_pads. */
- gpio_input(GPIO_HDMI_HPD);
- gpio_input(GPIO_DP_HPD);
- if (display_init_required()
- && !gpio_get(GPIO_HDMI_HPD)
- && !gpio_get(GPIO_DP_HPD)) {
- /* This has to be done before FSP-S runs. */
- if (google_chromeec_wait_for_displayport(display_timeout_ms))
- wait_for_hpd(GPIO_DP_HPD, display_timeout_ms);
- }
- /* Psys_pmax needs to be setup before FSP-S */
- soc_config = &conf->power_limits_config;
- mainboard_set_power_limits(soc_config);
-}
diff --git a/src/mainboard/google/hatch/variants/puff/Makefile.inc b/src/mainboard/google/hatch/variants/puff/Makefile.inc
index 2afd494..3b5b7d0 100644
--- a/src/mainboard/google/hatch/variants/puff/Makefile.inc
+++ b/src/mainboard/google/hatch/variants/puff/Makefile.inc
@@ -1,5 +1,4 @@
## SPDX-License-Identifier: GPL-2.0-only
ramstage-y += gpio.c
-ramstage-y += mainboard.c
bootblock-y += gpio.c
--
To view, visit https://review.coreboot.org/c/coreboot/+/42672
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I75c2de7ae8efd544d800bc77e34e667c3afa4b01
Gerrit-Change-Number: 42672
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange