Gaggery Tsai has uploaded this change for review. ( https://review.coreboot.org/27644
Change subject: mb/google/poppy/variant/nami: Overwrite AC/DC loadlines ......................................................................
mb/google/poppy/variant/nami: Overwrite AC/DC loadlines
This patch adds a fucntion to overwrite AC/DC loadlines for differnt projects.
BUG=b:111761175 BRANCH=None TEST=emerge-nami coreboot chromeos-bootimage and use DCI to dump AC/DC loadline settings.
Change-Id: Id0068c5334c257b9f4c32b6088becbfe8391a864 Signed-off-by: Gaggery Tsai gaggery.tsai@intel.com --- A src/mainboard/google/poppy/variants/nami/include/variant/variant.h M src/mainboard/google/poppy/variants/nami/mainboard.c 2 files changed, 173 insertions(+), 27 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/27644/1
diff --git a/src/mainboard/google/poppy/variants/nami/include/variant/variant.h b/src/mainboard/google/poppy/variants/nami/include/variant/variant.h new file mode 100644 index 0000000..4a3d37a --- /dev/null +++ b/src/mainboard/google/poppy/variants/nami/include/variant/variant.h @@ -0,0 +1,132 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2018 Google 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. + */ + +#ifndef __SKU_VARIANT_H__ +#define __SKU_VARIANT_H__ + +enum project_sku { + PRJ_LIST_MIN = 0x1, + PRJ_AKALI = PRJ_LIST_MIN, + PRJ_TBD = PRJ_AKALI + 1, + PRJ_VAYNE = PRJ_TBD + 1, + PRJ_SONA = PRJ_VAYNE + 1, + PRJ_PANTHEON = PRJ_SONA + 1, + PRJ_LIST_MAX = PRJ_PANTHEON +}; + +#define PRJ_DEFAULT PRJ_VAYNE + +/* Variant for AKALI */ +#define AKALI_SA_AC_LOADLINE 1100 +#define AKALI_SA_DC_LOADLINE 1028 +#define AKALI_IA_AC_LOADLINE 272 +#define AKALI_IA_DC_LOADLINE 247 +#define AKALI_GT_AC_LOADLINE 314 +#define AKALI_GT_DC_LOADLINE 321 + +/* Variant for Nami */ +#define NAMI_SA_AC_LOADLINE 1490 +#define NAMI_SA_DC_LOADLINE 1420 +#define NAMI_IA_AC_LOADLINE 400 +#define NAMI_IA_DC_LOADLINE 400 +#define NAMI_GT_AC_LOADLINE 310 +#define NAMI_GT_DC_LOADLINE 310 +#define NAMI_GTS_AC_LOADLINE 310 +#define NAMI_GTS_DC_LOADLINE 310 + +const struct { + enum project_sku sku; + int ac_loadline[NUM_VR_DOMAINS]; + int dc_loadline[NUM_VR_DOMAINS]; +} sku_ll_mapping[] = { + [PRJ_AKALI] = { + .sku = PRJ_AKALI, + .ac_loadline = { + AKALI_SA_AC_LOADLINE, + AKALI_IA_AC_LOADLINE, + AKALI_GT_AC_LOADLINE, + AKALI_GT_AC_LOADLINE + }, + .dc_loadline = { + AKALI_SA_DC_LOADLINE, + AKALI_IA_DC_LOADLINE, + AKALI_GT_DC_LOADLINE, + AKALI_GT_DC_LOADLINE + } + }, + [PRJ_SONA] = { + .sku = PRJ_SONA, + .ac_loadline = { + NAMI_SA_AC_LOADLINE, + NAMI_IA_AC_LOADLINE, + NAMI_GT_AC_LOADLINE, + NAMI_GTS_AC_LOADLINE + }, + .dc_loadline = { + NAMI_SA_DC_LOADLINE, + NAMI_IA_DC_LOADLINE, + NAMI_GT_DC_LOADLINE, + NAMI_GTS_DC_LOADLINE + } + }, + [PRJ_TBD] = { + .sku = PRJ_TBD, + .ac_loadline = { + NAMI_SA_AC_LOADLINE, + NAMI_IA_AC_LOADLINE, + NAMI_GT_AC_LOADLINE, + NAMI_GTS_AC_LOADLINE + }, + .dc_loadline = { + NAMI_SA_DC_LOADLINE, + NAMI_IA_DC_LOADLINE, + NAMI_GT_DC_LOADLINE, + NAMI_GTS_DC_LOADLINE + } + }, + [PRJ_VAYNE] = { + .sku = PRJ_VAYNE, + .ac_loadline = { + NAMI_SA_AC_LOADLINE, + NAMI_IA_AC_LOADLINE, + NAMI_GT_AC_LOADLINE, + NAMI_GTS_AC_LOADLINE + }, + .dc_loadline = { + NAMI_SA_DC_LOADLINE, + NAMI_IA_DC_LOADLINE, + NAMI_GT_DC_LOADLINE, + NAMI_GTS_DC_LOADLINE + } + }, + [PRJ_PANTHEON] = { + .sku = PRJ_PANTHEON, + .ac_loadline = { + NAMI_SA_AC_LOADLINE, + NAMI_IA_AC_LOADLINE, + NAMI_GT_AC_LOADLINE, + NAMI_GTS_AC_LOADLINE + }, + .dc_loadline = { + NAMI_SA_DC_LOADLINE, + NAMI_IA_DC_LOADLINE, + NAMI_GT_DC_LOADLINE, + NAMI_GTS_DC_LOADLINE + } + }, +}; + + +#endif /* __OEM_SKU_VARIANT_H__ */ diff --git a/src/mainboard/google/poppy/variants/nami/mainboard.c b/src/mainboard/google/poppy/variants/nami/mainboard.c index 8080c94..3c2c75f 100644 --- a/src/mainboard/google/poppy/variants/nami/mainboard.c +++ b/src/mainboard/google/poppy/variants/nami/mainboard.c @@ -28,6 +28,7 @@ #include <soc/ramstage.h> #include <string.h> #include <variant/sku.h> +#include <variant/variant.h>
#define PL2_I7_SKU 44 #define PL2_DEFAULT 29 @@ -61,33 +62,6 @@ return sku_id; }
-/* Override dev tree settings per board */ -void variant_devtree_update(void) -{ - uint32_t sku_id = variant_board_sku(); - struct device *root = SA_DEV_ROOT; - config_t *cfg = root->chip_info; - - /* Update PL2 based on SKU. */ - cfg->tdp_pl2_override = get_pl2(sku_id); - - switch (sku_id) { - case SKU_0_VAYNE: - case SKU_1_VAYNE: - case SKU_2_VAYNE: - case SKU_0_PANTHEON: - case SKU_1_PANTHEON: - case SKU_2_PANTHEON: - case SKU_0_SONA: - case SKU_1_SONA: - /* Disable unused port USB port */ - cfg->usb2_ports[5].enable = 0; - break; - default: - break; - } -} - const char *smbios_mainboard_sku(void) { static char sku_str[14]; /* sku{0..4294967295} */ @@ -189,3 +163,43 @@ break; } } + +/* Override dev tree settings per board */ +void variant_devtree_update(void) +{ + uint32_t sku_id = variant_board_sku(); + uint32_t i; + struct device *root = SA_DEV_ROOT; + config_t *cfg = root->chip_info; + + /* Update PL2 based on SKU. */ + cfg->tdp_pl2_override = get_pl2(sku_id); + + switch (sku_id) { + case SKU_0_VAYNE: + case SKU_1_VAYNE: + case SKU_2_VAYNE: + case SKU_0_PANTHEON: + case SKU_1_PANTHEON: + case SKU_2_PANTHEON: + case SKU_0_SONA: + case SKU_1_SONA: + /* Disable unused port USB port */ + cfg->usb2_ports[5].enable = 0; + break; + default: + break; + } + + /* Update AC/DC loadlines based on OEM ID */ + sku_id = read_oem_id(); + if (sku_id < PRJ_LIST_MIN || sku_id > PRJ_LIST_MAX) + sku_id = PRJ_DEFAULT; + + for (i = 0; i < ARRAY_SIZE(cfg->domain_vr_config); i++) { + cfg->domain_vr_config[i].ac_loadline = sku_ll_mapping[sku_id].ac_loadline[i]; + cfg->domain_vr_config[i].dc_loadline = sku_ll_mapping[sku_id].dc_loadline[i]; + } +} + +