From fa0080d187c8086d28bcad7c33bac66f624aa753 Mon Sep 17 00:00:00 2001 From: Eric Lai Date: Wed, 16 Sep 2020 11:21:08 +0800 Subject: mb/google/octopus: Clean up LTE power off function All octopus board share the same power off sequence. Move to smihandler.c instead variant.c. BUG=b:168075958 BRANCH=octopus TEST=build image and verify on the DUT with LTE DB. Signed-off-by: Eric Lai Change-Id: I2be5a656fb42fff99c56d21aaa73ed9140caad37 Reviewed-on: https://review.coreboot.org/c/coreboot/+/45436 Reviewed-by: Patrick Georgi Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) --- src/mainboard/google/octopus/smihandler.c | 31 ++++++++++++++++++++++ .../baseboard/include/baseboard/variants.h | 4 +++ .../google/octopus/variants/bobba/variant.c | 30 +-------------------- .../google/octopus/variants/dood/variant.c | 31 +--------------------- .../google/octopus/variants/fleex/variant.c | 30 +-------------------- .../google/octopus/variants/garg/variant.c | 30 +-------------------- 6 files changed, 39 insertions(+), 117 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/octopus/smihandler.c b/src/mainboard/google/octopus/smihandler.c index 2c68045685..488ba07cc4 100644 --- a/src/mainboard/google/octopus/smihandler.c +++ b/src/mainboard/google/octopus/smihandler.c @@ -3,15 +3,22 @@ #include #include #include +#include #include #include #include +#include #include #include #include #include #include +struct gpio_with_delay { + gpio_t gpio; + unsigned int delay_msecs; +}; + void mainboard_smi_gpi_handler(const struct gpi_status *sts) { if (gpi_status_get(sts, EC_SMI_GPI)) @@ -54,3 +61,27 @@ void __weak variant_smi_sleep(u8 slp_typ) { /* Leave for the variant to implement if necessary. */ } + +void power_off_lte_module(void) +{ + + const struct gpio_with_delay lte_power_off_gpios[] = { + { + GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */ + 30, + }, + { + GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */ + 100 + }, + { + GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */ + 0 + } + }; + + for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) { + gpio_output(lte_power_off_gpios[i].gpio, 0); + mdelay(lte_power_off_gpios[i].delay_msecs); + } +} diff --git a/src/mainboard/google/octopus/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/octopus/variants/baseboard/include/baseboard/variants.h index 206ce8bd90..f39a786f11 100644 --- a/src/mainboard/google/octopus/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/octopus/variants/baseboard/include/baseboard/variants.h @@ -50,4 +50,8 @@ bool no_touchscreen_sku(uint32_t sku_id); /* allow each variants to customize smi sleep flow. */ void variant_smi_sleep(u8 slp_typ); +/* LTE power off sequence: + * GPIO_161 -> 30ms -> GPIO_117 -> 100ms -> GPIO_67 */ +void power_off_lte_module(void); + #endif /* BASEBOARD_VARIANTS_H */ diff --git a/src/mainboard/google/octopus/variants/bobba/variant.c b/src/mainboard/google/octopus/variants/bobba/variant.c index 97c77a95dc..0c4f93e051 100644 --- a/src/mainboard/google/octopus/variants/bobba/variant.c +++ b/src/mainboard/google/octopus/variants/bobba/variant.c @@ -16,34 +16,6 @@ enum { SKU_40_DROID = 40, /* LTE + Touch + KB backlight*/ }; -struct gpio_with_delay { - gpio_t gpio; - unsigned int delay_msecs; -}; - -static void power_off_lte_module(u8 slp_typ) -{ - const struct gpio_with_delay lte_power_off_gpios[] = { - { - GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */ - 30, - }, - { - GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */ - 100 - }, - { - GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */ - 0 - } - }; - - for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) { - gpio_output(lte_power_off_gpios[i].gpio, 0); - mdelay(lte_power_off_gpios[i].delay_msecs); - } -} - const char *get_wifi_sar_cbfs_filename(void) { const char *filename = NULL; @@ -68,7 +40,7 @@ void variant_smi_sleep(u8 slp_typ) case SKU_38_DROID: case SKU_39_DROID: case SKU_40_DROID: - power_off_lte_module(slp_typ); + power_off_lte_module(); return; default: return; diff --git a/src/mainboard/google/octopus/variants/dood/variant.c b/src/mainboard/google/octopus/variants/dood/variant.c index dda24f8330..1a8a37164a 100644 --- a/src/mainboard/google/octopus/variants/dood/variant.c +++ b/src/mainboard/google/octopus/variants/dood/variant.c @@ -16,35 +16,6 @@ enum { SKU_4_WIFI_2CAM = 4, /* Wifi + dual camera */ }; -struct gpio_with_delay { - gpio_t gpio; - unsigned int delay_msecs; -}; - -static void power_off_lte_module(u8 slp_typ) -{ - const struct gpio_with_delay lte_power_off_gpios[] = { - { - GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */ - 30, - }, - { - GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */ - 100 - }, - { - GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */ - 0 - } - }; - - for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) { - gpio_output(lte_power_off_gpios[i].gpio, 0); - mdelay(lte_power_off_gpios[i].delay_msecs); - } -} - - void variant_smi_sleep(u8 slp_typ) { /* Currently use cases here all target to S5 therefore we do early return @@ -55,7 +26,7 @@ void variant_smi_sleep(u8 slp_typ) switch (google_chromeec_get_board_sku()) { case SKU_1_LTE: case SKU_3_LTE_2CAM: - power_off_lte_module(slp_typ); + power_off_lte_module(); return; default: return; diff --git a/src/mainboard/google/octopus/variants/fleex/variant.c b/src/mainboard/google/octopus/variants/fleex/variant.c index c71a63e68b..52f822a6c4 100644 --- a/src/mainboard/google/octopus/variants/fleex/variant.c +++ b/src/mainboard/google/octopus/variants/fleex/variant.c @@ -6,34 +6,6 @@ #include #include -struct gpio_with_delay { - gpio_t gpio; - unsigned int delay_msecs; -}; - -static void power_off_lte_module(u8 slp_typ) -{ - const struct gpio_with_delay lte_power_off_gpios[] = { - { - GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */ - 30, - }, - { - GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */ - 100 - }, - { - GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */ - 0 - } - }; - - for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) { - gpio_output(lte_power_off_gpios[i].gpio, 0); - mdelay(lte_power_off_gpios[i].delay_msecs); - } -} - void variant_smi_sleep(u8 slp_typ) { /* Currently use cases here all target to S5 therefore we do early return @@ -41,5 +13,5 @@ void variant_smi_sleep(u8 slp_typ) if (slp_typ != ACPI_S5) return; - power_off_lte_module(slp_typ); + power_off_lte_module(); } diff --git a/src/mainboard/google/octopus/variants/garg/variant.c b/src/mainboard/google/octopus/variants/garg/variant.c index 5d9c5ee57b..7c84f2696b 100644 --- a/src/mainboard/google/octopus/variants/garg/variant.c +++ b/src/mainboard/google/octopus/variants/garg/variant.c @@ -9,34 +9,6 @@ #include #include -struct gpio_with_delay { - gpio_t gpio; - unsigned int delay_msecs; -}; - -static void power_off_lte_module(u8 slp_typ) -{ - const struct gpio_with_delay lte_power_off_gpios[] = { - { - GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */ - 30, - }, - { - GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */ - 100 - }, - { - GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */ - 0 - } - }; - - for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) { - gpio_output(lte_power_off_gpios[i].gpio, 0); - mdelay(lte_power_off_gpios[i].delay_msecs); - } -} - const char *mainboard_vbt_filename(void) { uint32_t sku_id; @@ -64,7 +36,7 @@ void variant_smi_sleep(u8 slp_typ) switch (google_chromeec_get_board_sku()) { case SKU_17_LTE: case SKU_18_LTE_TS: - power_off_lte_module(slp_typ); + power_off_lte_module(); return; default: return; -- cgit v1.2.3