From d8a4dd0b3290cc904f58211f161b2363efac7b90 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Mon, 16 Nov 2020 15:36:23 -0600 Subject: mb/purism/librem_cnl: move setting of FSP-M UPDs into variant.c The upcoming Librem 14 variant won't use the same SATA HSIO adjustments as the Librem Mini, so move these settings into a variant-specific file. Rename existing gpio.h to variant.h, move to board root directory, and use for all variant-specific declarations; adjust references as needed. Add newly-created variant.c to Makefile. Test: build/boot Librem Mini, verify SATA functionality unchanged. Change-Id: Ie8f714cc759675c692ad6e3f20e50adad8d09d4b Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/48519 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/purism/librem_cnl/Makefile.inc | 2 ++ src/mainboard/purism/librem_cnl/ramstage.c | 2 +- src/mainboard/purism/librem_cnl/romstage.c | 8 ++------ src/mainboard/purism/librem_cnl/variant.h | 14 ++++++++++++++ .../purism/librem_cnl/variants/librem_mini/gpio.c | 2 +- .../librem_cnl/variants/librem_mini/include/variant/gpio.h | 11 ----------- .../purism/librem_cnl/variants/librem_mini/variant.c | 12 ++++++++++++ 7 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 src/mainboard/purism/librem_cnl/variant.h delete mode 100644 src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/gpio.h create mode 100644 src/mainboard/purism/librem_cnl/variants/librem_mini/variant.c diff --git a/src/mainboard/purism/librem_cnl/Makefile.inc b/src/mainboard/purism/librem_cnl/Makefile.inc index ba157dfd05..8e3b5a6f36 100644 --- a/src/mainboard/purism/librem_cnl/Makefile.inc +++ b/src/mainboard/purism/librem_cnl/Makefile.inc @@ -1,5 +1,7 @@ ## SPDX-License-Identifier: GPL-2.0-only +romstage-y += variants/$(VARIANT_DIR)/variant.c + ramstage-y += variants/$(VARIANT_DIR)/gpio.c ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c ramstage-y += ramstage.c diff --git a/src/mainboard/purism/librem_cnl/ramstage.c b/src/mainboard/purism/librem_cnl/ramstage.c index 56ed1b7844..e93911e324 100644 --- a/src/mainboard/purism/librem_cnl/ramstage.c +++ b/src/mainboard/purism/librem_cnl/ramstage.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include -#include +#include "variant.h" void mainboard_silicon_init_params(FSP_S_CONFIG *params) { diff --git a/src/mainboard/purism/librem_cnl/romstage.c b/src/mainboard/purism/librem_cnl/romstage.c index 3a3ca6b491..b7c57ee379 100644 --- a/src/mainboard/purism/librem_cnl/romstage.c +++ b/src/mainboard/purism/librem_cnl/romstage.c @@ -2,6 +2,7 @@ #include #include +#include "variant.h" static const struct cnl_mb_cfg memcfg = { @@ -50,10 +51,5 @@ void mainboard_memory_init_params(FSPM_UPD *memupd) { FSP_M_CONFIG *mem_cfg = &memupd->FspmConfig; cannonlake_memcfg_init(mem_cfg, &memcfg); - - /* Enable and set SATA HSIO adjustments for ports 0 and 2 */ - mem_cfg->PchSataHsioRxGen3EqBoostMagEnable[0] = 1; - mem_cfg->PchSataHsioRxGen3EqBoostMagEnable[2] = 1; - mem_cfg->PchSataHsioRxGen3EqBoostMag[0] = 2; - mem_cfg->PchSataHsioRxGen3EqBoostMag[2] = 1; + variant_memory_init_params(mem_cfg); } diff --git a/src/mainboard/purism/librem_cnl/variant.h b/src/mainboard/purism/librem_cnl/variant.h new file mode 100644 index 0000000000..79a32414b8 --- /dev/null +++ b/src/mainboard/purism/librem_cnl/variant.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef VARIANT_H +#define VARIANT_H + +#include +#include +#include + +const struct pad_config *variant_gpio_table(size_t *num); + +void variant_memory_init_params(FSP_M_CONFIG *mem_cfg); + +#endif diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c b/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c index 8fa4ac57ec..08134e0c76 100644 --- a/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c +++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/gpio.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include +#include "../../variant.h" /* Pad configuration was generated automatically using intelp2m utility */ static const struct pad_config gpio_table[] = { diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/gpio.h b/src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/gpio.h deleted file mode 100644 index 9094b0419d..0000000000 --- a/src/mainboard/purism/librem_cnl/variants/librem_mini/include/variant/gpio.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef VARIANT_GPIO_H -#define VARIANT_GPIO_H - -#include -#include - -const struct pad_config *variant_gpio_table(size_t *num); - -#endif diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/variant.c b/src/mainboard/purism/librem_cnl/variants/librem_mini/variant.c new file mode 100644 index 0000000000..9d7e27fd3e --- /dev/null +++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/variant.c @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include "../../variant.h" + +void variant_memory_init_params(FSP_M_CONFIG *mem_cfg) +{ + /* Enable and set SATA HSIO adjustments for ports 0 and 2 */ + mem_cfg->PchSataHsioRxGen3EqBoostMagEnable[0] = 1; + mem_cfg->PchSataHsioRxGen3EqBoostMagEnable[2] = 1; + mem_cfg->PchSataHsioRxGen3EqBoostMag[0] = 2; + mem_cfg->PchSataHsioRxGen3EqBoostMag[2] = 1; +} -- cgit v1.2.3