From d12d537725f0d113958efd576cefd6b81fb39b0b Mon Sep 17 00:00:00 2001 From: Grover Yen Date: Fri, 15 Aug 2014 19:29:22 +0800 Subject: cranky: Implement LAN power control. Based on the code cloned from rambi, and 1.Apply PM6 as LAN power control pin. 2.Enable LAN power in S0 and S3. BUG=chrome-os-partner:30749 BRANCH=none TEST=make -j buildall, make -j tests Change-Id: I27031b26f595cfcb790c919aff347eb310a626d5 Signed-off-by: Grover Yen Reviewed-on: https://chromium-review.googlesource.com/212598 Reviewed-by: Randall Spangler Reviewed-by: Mohammed Habibulla --- board/cranky/board.c | 1 + board/cranky/board.h | 2 ++ include/config.h | 5 +++++ power/baytrail.c | 10 ++++++++++ 4 files changed, 18 insertions(+) diff --git a/board/cranky/board.c b/board/cranky/board.c index a2afa3b8e8..72ab476965 100644 --- a/board/cranky/board.c +++ b/board/cranky/board.c @@ -93,6 +93,7 @@ const struct gpio_info gpio_list[] = { {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_ODR_HIGH, NULL}, {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL}, {"ENTERING_RW", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL}, + {"LAN_POWER", LM4_GPIO_M, (1<<6), GPIO_OUT_LOW, NULL}, {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL}, {"PCH_CORE_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL}, {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_ODR_HIGH, NULL}, diff --git a/board/cranky/board.h b/board/cranky/board.h index b82daac1c8..967b54ec5e 100644 --- a/board/cranky/board.h +++ b/board/cranky/board.h @@ -29,6 +29,7 @@ #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_IRQ_GPIO GPIO_KBD_IRQ_L #define CONFIG_KEYBOARD_PROTOCOL_8042 +#define CONFIG_LAN_POWER_S3 GPIO_LAN_POWER #define CONFIG_LED_COMMON #define CONFIG_LOW_POWER_IDLE #undef CONFIG_PECI @@ -109,6 +110,7 @@ enum gpio_signal { GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */ GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */ + GPIO_LAN_POWER, /* Enable LAN power supplies*/ GPIO_LPC_CLKRUN_L, /* Request that PCH drive LPC clock */ GPIO_PCH_CORE_PWROK, /* Indicate core well power is stable */ GPIO_PCH_PWRBTN_L, /* Power button output to PCH */ diff --git a/include/config.h b/include/config.h index bd6bb63c87..839bc6d9b1 100755 --- a/include/config.h +++ b/include/config.h @@ -887,6 +887,11 @@ */ #undef CONFIG_WIRELESS_SUSPEND +/* + * Support LAN controller be powered in suspend (S3). + */ +#undef CONFIG_LAN_POWER_S3 + /* * Write protect signal is active-high. If this is defined, there must be a * GPIO named GPIO_WP; if not defined, there must be a GPIO names GPIO_WP_L. diff --git a/power/baytrail.c b/power/baytrail.c index 16764dd803..f6320812bd 100755 --- a/power/baytrail.c +++ b/power/baytrail.c @@ -227,6 +227,11 @@ enum power_state power_handle_state(enum power_state state) */ gpio_set_level(GPIO_ENABLE_TOUCHPAD, 1); +#ifdef CONFIG_LAN_POWER_S3 + /* Turn on LAN controller power */ + gpio_set_level(CONFIG_LAN_POWER_S3, 1); +#endif + /* Call hooks now that rails are up */ hook_notify(HOOK_CHIPSET_STARTUP); return POWER_S3; @@ -384,6 +389,11 @@ enum power_state power_handle_state(enum power_state state) gpio_set_level(GPIO_ENABLE_TOUCHPAD, 0); gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, 0); +#ifdef CONFIG_LAN_POWER_S3 + /* Turn off LAN controller power */ + gpio_set_level(CONFIG_LAN_POWER_S3, 0); +#endif + /* Turn off power to RAM */ gpio_set_level(GPIO_PP1350_EN, 0); -- cgit v1.2.1