Cliff Huang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81332?usp=email )
Change subject: soc/intel/meteorlake: Update Touch Controller UDP params ......................................................................
soc/intel/meteorlake: Update Touch Controller UDP params
The UPD, ThcAssignment, and ThcMode, ThcWakeOnTouch, are specified via THC driver in the device tree. Therefore, SOC needs to get the driver config. a weak function drivers_intel_touch_config() is added such that the mainboard can implement the function to provide the config from the device tree. The CONFIG_SOC_INTEL_TOUCH is needed to add THC support for Meteorlake SOC.
BUG=b:307775082
Signed-off-by: Cliff Huang cliff.huang@intel.com Change-Id: I19edbcad705e889166d7d340b2caa74ab3bf15a1 --- M src/soc/intel/meteorlake/Kconfig M src/soc/intel/meteorlake/chip.c M src/soc/intel/meteorlake/chip.h M src/soc/intel/meteorlake/fsp_params.c 4 files changed, 92 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/81332/1
diff --git a/src/soc/intel/meteorlake/Kconfig b/src/soc/intel/meteorlake/Kconfig index a4ebad4..c4a7170 100644 --- a/src/soc/intel/meteorlake/Kconfig +++ b/src/soc/intel/meteorlake/Kconfig @@ -155,6 +155,11 @@ select COS_MAPPED_TO_MSB select CAR_HAS_L3_PROTECTED_WAYS
+config SOC_INTEL_TOUCH + bool + default n + select DRIVERS_INTEL_TOUCH + config MAX_CPUS int default 22 diff --git a/src/soc/intel/meteorlake/chip.c b/src/soc/intel/meteorlake/chip.c index 03adfdb..b5647d3 100644 --- a/src/soc/intel/meteorlake/chip.c +++ b/src/soc/intel/meteorlake/chip.c @@ -82,6 +82,8 @@ case PCI_DEVFN_TBT2: return "TRP2"; case PCI_DEVFN_TBT3: return "TRP3"; case PCI_DEVFN_IPU: return "IPU0"; + case PCI_DEVFN_THC0: return "THC0"; + case PCI_DEVFN_THC1: return "THC1"; case PCI_DEVFN_ISH: return "ISHB"; case PCI_DEVFN_GNA: return "GNA"; case PCI_DEVFN_XHCI: return "XHCI"; diff --git a/src/soc/intel/meteorlake/chip.h b/src/soc/intel/meteorlake/chip.h index cfef3c1..1eb66aa 100644 --- a/src/soc/intel/meteorlake/chip.h +++ b/src/soc/intel/meteorlake/chip.h @@ -525,6 +525,13 @@ * as per `enum slew_rate` data type. */ uint8_t slow_slew_rate_config[NUM_VR_DOMAINS]; + + /* THC configuraiton */ + enum { + THC_CONFIG_NONE, + THC_CONFIG_SINGLE_PORT0, + THC_CONFIG_DOUBLE_CONTROLLER, + } thc_configuration; };
typedef struct soc_intel_meteorlake_config config_t; diff --git a/src/soc/intel/meteorlake/fsp_params.c b/src/soc/intel/meteorlake/fsp_params.c index a02d4b9..557dfda 100644 --- a/src/soc/intel/meteorlake/fsp_params.c +++ b/src/soc/intel/meteorlake/fsp_params.c @@ -34,6 +34,10 @@ #include <stdlib.h> #include <string.h> #include <types.h> +#if CONFIG(SOC_INTEL_TOUCH) +#include <drivers/intel/touch/chip.h> +const struct drivers_intel_touch_config *mainboard_get_intel_touch_config(int ctl_idx); +#endif
/* THC assignment definition */ #define THC_NONE 0 @@ -599,6 +603,77 @@ s_cfg->VmdEnable = is_devfn_enabled(PCI_DEVFN_VMD); }
+#if CONFIG(SOC_INTEL_TOUCH) +__weak const struct drivers_intel_touch_config *mainboard_get_intel_touch_config(int ctl_idx) +{ + printk(BIOS_ERR, "missing %s define in the mainboard\n", __func__); + return NULL; +} + +static void fill_fsps_single_thc_params(FSP_S_CONFIG *s_cfg, int ctl_idx) +{ + const struct drivers_intel_touch_config *touch_config = mainboard_get_intel_touch_config(ctl_idx); + if (touch_config == NULL) { + printk(BIOS_ERR, "No config found for THC%d\n", ctl_idx); + return; + } + s_cfg->ThcMode[ctl_idx] = touch_config->mode; + printk(BIOS_DEBUG, "THC%d mode: %d\n", ctl_idx, touch_config->mode); + printk(BIOS_DEBUG, "THC%d connected device: %d\n", ctl_idx, + touch_config->connected_device); + if (touch_config->mode == THC_HID_SPI_MODE) { + if (touch_config->connected_device != TH_SENSOR_NONE) { + printk(BIOS_DEBUG, "THC%d sensor device: %s\n", ctl_idx, + touch_config->sensor_dev_name); + printk(BIOS_DEBUG, "THC%d wake enable: %d\n", ctl_idx, + touch_config->wake_on_touch); + s_cfg->ThcWakeOnTouch[ctl_idx] = touch_config->wake_on_touch; + } + } else + printk(BIOS_DEBUG, "THC UPD update is only required for THC with HID SPID mode at this time!\n"); +} + +static void fill_fsps_thc_params(FSP_S_CONFIG *s_cfg, + const struct soc_intel_meteorlake_config *config) +{ + s_cfg->ThcAssignment[0] = THC_NONE; + s_cfg->ThcAssignment[1] = THC_NONE; + + switch (config->thc_configuration) { + case THC_CONFIG_NONE: + printk(BIOS_WARNING, "THC configuration: None\n"); + break; + case THC_CONFIG_SINGLE_PORT0: + printk(BIOS_WARNING, "THC configuration: THC0 Controllers\n"); + if (is_devfn_enabled(PCI_DEVFN_THC0)) { + s_cfg->ThcAssignment[0] = THC_0; + s_cfg->ThcAssignment[1] = THC_NONE; + fill_fsps_single_thc_params(s_cfg, 0); + } else + printk(BIOS_WARNING, "THC0 is not enabled for configuration.\n"); + if (is_devfn_enabled(PCI_DEVFN_THC1)) + printk(BIOS_WARNING, + "Only THC0 should be enabled for single port configuration\n"); + break; + case THC_CONFIG_DOUBLE_CONTROLLER: + printk(BIOS_WARNING, "THC configuration: Double Controllers\n"); + if (is_devfn_enabled(PCI_DEVFN_THC0)) { + printk(BIOS_DEBUG, "THC0 function is enabled\n"); + s_cfg->ThcAssignment[0] = THC_0; + fill_fsps_single_thc_params(s_cfg, 0); + } + if (is_devfn_enabled(PCI_DEVFN_THC1)) { + printk(BIOS_DEBUG, "THC1 function is enabled\n"); + s_cfg->ThcAssignment[1] = THC_1; + fill_fsps_single_thc_params(s_cfg, 1); + } + if (!is_devfn_enabled(PCI_DEVFN_THC0) || !is_devfn_enabled(PCI_DEVFN_THC1)) + printk(BIOS_WARNING, + "Both THC0 and THC1 must be enabled for double controller configuration!\n"); + } +} +#endif + static void fill_fsps_tbt_params(FSP_S_CONFIG *s_cfg, const struct soc_intel_meteorlake_config *config) { @@ -802,6 +877,9 @@ fill_fsps_lan_params, fill_fsps_cnvi_params, fill_fsps_vmd_params, +#if CONFIG(SOC_INTEL_TOUCH) + fill_fsps_thc_params, +#endif fill_fsps_tbt_params, fill_fsps_8254_params, fill_fsps_pm_timer_params,