diff options
author | Mulin Chao <mlchao@nuvoton.com> | 2016-01-13 13:09:38 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-01-14 22:12:05 -0800 |
commit | 77abb5072e8a674d5908dd2366583148858e56c9 (patch) | |
tree | 60e5ed6c060adf327628d0789e0147b5100c861d /chip/npcx/gpio.c | |
parent | a50b12ef9743c911d968e7bf083acc22f691c7c7 (diff) | |
download | chrome-ec-77abb5072e8a674d5908dd2366583148858e56c9.tar.gz |
nuc: Support hibernate_wake_pins on wheatley, npcx_evb and npcx_evb_arm.
Modified hibernate funcs to support hibernate_wake_pins on weatley, npcx_evb
and npcx_evb_arm.
For better power consumption, we disable ADC, tri-state spi pins, all inputs
of wake-ups to prevent leakage current caused by input floating and set
necessary GPIOs' states in hibernate function.
Modified drivers:
1. npcx_evb/board.c: Add hibernate_wake_pins array for hibernate.
2. npcx_evb_arm/board.c: : Add hibernate_wake_pins array for hibernate.
3. wheatley/board.c: Add hibernate_wake_pins array for hibernate.
4. wheatley/board.c: Add board_set_gpio_state_hibernate func for adjusting
GPIOs' status related to board for better power consumption.
5. hwtimer.c: Remove unnecessary interrupt_enable/disable funcs. Interrupt
will disable before it is called.
6. register.h: Add WKINEN definition and declarations used for hibernate.
7. system.c: Add system_set_gpios_and_wakeup_inputs_hibernate to set GPIOs'
state and wake-up inputs before entering hibernate.
8. system_chip.h: Remove unused BBRM_DATA_INDEX_PBUTTON field.
9. gpio.c: Enable WKINEN in gpio_set_flags_by_mask func.
BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none
Change-Id: Ic85814065464095fdcb7a75964c2c528d8f8e62f
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/321466
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip/npcx/gpio.c')
-rw-r--r-- | chip/npcx/gpio.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c index 2e9eb62cd4..5574e1b0e0 100644 --- a/chip/npcx/gpio.c +++ b/chip/npcx/gpio.c @@ -375,6 +375,12 @@ void gpio_interrupt_type_sel(uint8_t port, uint8_t mask, uint32_t flags) /* Enable wake-up input sources */ NPCX_WKEN(table, group) |= pmask; + NPCX_WKINEN(table, group) |= pmask; + /* + * Clear pending bit since it might be set + * if WKINEN bit is changed. + */ + NPCX_WKPCL(table, group) |= pmask; } /* Handle interrupt for edge trigger */ else if ((flags & GPIO_INT_F_RISING) || @@ -399,12 +405,18 @@ void gpio_interrupt_type_sel(uint8_t port, uint8_t mask, uint32_t flags) NPCX_WKAEDG(table, group) &= ~pmask; NPCX_WKEDG(table, group) |= pmask; } + /* Enable wake-up input sources */ NPCX_WKEN(table, group) |= pmask; - } else{ + NPCX_WKINEN(table, group) |= pmask; + /* + * Clear pending bit since it might be set + * if WKINEN bit is changed. + */ + NPCX_WKPCL(table, group) |= pmask; + } else /* Disable wake-up input sources */ NPCX_WKEN(table, group) &= ~pmask; - } /* No support analog mode */ } @@ -511,7 +523,6 @@ int gpio_disable_interrupt(enum gpio_signal signal) void gpio_pre_init(void) { const struct gpio_info *g = gpio_list; - const struct gpio_wui_map *map; int is_warm = system_is_reboot_warm(); int flags; int i, j; @@ -573,13 +584,6 @@ void gpio_pre_init(void) /* Set up GPIO based on flags */ gpio_set_flags_by_mask(g->port, g->mask, flags); } - - /* Put power button information in bbram */ - g = gpio_list + GPIO_POWER_BUTTON_L; - map = gpio_find_wui_from_io(g->port, g->mask); - NPCX_BBRAM(BBRM_DATA_INDEX_PBUTTON) = map->wui_table; - NPCX_BBRAM(BBRM_DATA_INDEX_PBUTTON + 1) = map->wui_group; - NPCX_BBRAM(BBRM_DATA_INDEX_PBUTTON + 2) = map->wui_mask; } /* List of GPIO IRQs to enable. Don't automatically enable interrupts for |