Hello Chris Wang,
I'd like you to do a code review. Please visit
https://review.coreboot.org/22752
to review the following change.
Change subject: mb/google/reef: provide override gpio table in coral ......................................................................
mb/google/reef: provide override gpio table in coral
Allow overriding specific GPIOs by SKU ID. To override two GPIO settings for nasher to save the power consumption when the system in S0ix.
AVS_DMIC_CLK_A1: IGNORE -> Tx1RXDCRx0. AVS_DMIC_CLK_B1: IGNORE -> Tx1RXDCRx0.
BUG=b:69025557 BRANCH=master TEST=compiled/verify the power consumption by ODM.
Change-Id: I9e0674f206426fddb3947273754774b310106334 Signed-off-by: Chris Wang chriswang@ami.corp-partner.google.com --- M src/mainboard/google/reef/mainboard.c M src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/reef/variants/coral/mainboard.c 3 files changed, 50 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/22752/1
diff --git a/src/mainboard/google/reef/mainboard.c b/src/mainboard/google/reef/mainboard.c index 90ffe13..78affce 100644 --- a/src/mainboard/google/reef/mainboard.c +++ b/src/mainboard/google/reef/mainboard.c @@ -29,6 +29,11 @@ #include <variant/ec.h> #include <variant/gpio.h>
+/* override specific gpio by sku id*/ +void __attribute__((weak))sku_gpio_update(void) +{ +} + static void mainboard_init(void *chip_info) { int boardid; @@ -40,6 +45,7 @@
pads = variant_gpio_table(&num); gpio_configure_pads(pads, num); + sku_gpio_update();
mainboard_ec_init();
diff --git a/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h index 0f2c376..e4f3d93 100644 --- a/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h @@ -29,6 +29,7 @@ const struct pad_config *variant_gpio_table(size_t *num); const struct pad_config *variant_early_gpio_table(size_t *num); const struct pad_config *variant_sleep_gpio_table(u8 slp_typ, size_t *num); +const struct pad_config *sku_gpio_table(size_t *num);
/* Baseboard default swizzle. Can be reused if swizzle is same. */ extern const struct lpddr4_swizzle_cfg baseboard_lpddr4_swizzle; @@ -50,4 +51,6 @@ const char **oem_table_id, uint32_t *oem_revision); void variant_nhlt_init(struct nhlt *nhlt);
+void sku_gpio_update(void); + #endif /* BASEBOARD_VARIANTS_H */ diff --git a/src/mainboard/google/reef/variants/coral/mainboard.c b/src/mainboard/google/reef/variants/coral/mainboard.c index 5daf96c..1a69b3e 100644 --- a/src/mainboard/google/reef/variants/coral/mainboard.c +++ b/src/mainboard/google/reef/variants/coral/mainboard.c @@ -19,6 +19,7 @@ #include <soc/cpu.h> #include <soc/intel/apollolake/chip.h> #include <soc/intel/common/vbt.h> +#include <soc/gpio.h>
enum { SKU_0_ASTRONAUT = 0, @@ -122,3 +123,43 @@ break; } } + +static const struct pad_config nasher_gpio_tables[] = { + /* AVS_DMIC_CLK_A1 */ + PAD_CFG_NF_IOSSTATE(GPIO_79, NATIVE, DEEP, NF1, Tx1RXDCRx0), + /* AVS_DMIC_CLK_B1 */ + PAD_CFG_NF_IOSSTATE(GPIO_80, NATIVE, DEEP, NF1, Tx1RXDCRx0), +}; + +const struct pad_config *sku_gpio_table(size_t *num) +{ + int sku_id = variant_board_sku(); + const struct pad_config *board_gpio_tables; + + switch (sku_id) { + case SKU_160_NASHER: + case SKU_161_NASHER: + case SKU_162_NASHER: + case SKU_163_NASHER360: + case SKU_164_NASHER360: + case SKU_165_NASHER360: + case SKU_166_NASHER360: + *num = ARRAY_SIZE(nasher_gpio_tables); + board_gpio_tables = nasher_gpio_tables; + break; + default: + break; + } + + return board_gpio_tables; +} + +void sku_gpio_update(void) +{ + const struct pad_config *pads; + size_t num; + + pads = sku_gpio_table(&num); + gpio_configure_pads(pads, num); + +}