Use ECPM to reduce power usage

This commit is contained in:
Jeremy Soller 2020-02-04 12:44:55 -07:00
parent c58c5f06d4
commit 9fbd0b2273
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
3 changed files with 25 additions and 4 deletions

View File

@ -0,0 +1,10 @@
#include <board/ecpm.h>
void ecpm_init(void) {
// Clock gate EGPC, CIR, and SWUC
CGCTRL2 |= (1 << 6) | (1 << 5) | (1 << 4);
// Clock gate UART, SSPI, and DBGR
CGCTRL3 |= (1 << 2) | (1 << 1) | (1 << 0);
// Clock gate CEC
CGCTRL4 |= (1 << 0);
}

View File

@ -0,0 +1,8 @@
#ifndef _BOARD_ECPM_H
#define _BOARD_ECPM_H
#include <ec/ecpm.h>
void ecpm_init(void);
#endif // _BOARD_ECPM_H

View File

@ -7,6 +7,7 @@
#include <arch/delay.h>
#include <arch/time.h>
#include <board/battery.h>
#include <board/ecpm.h>
#include <board/gpio.h>
#include <board/gctrl.h>
#include <board/kbc.h>
@ -33,17 +34,19 @@ void timer_2(void) __interrupt(5) {}
uint8_t main_cycle = 0;
void init(void) {
// Must happen first
arch_init();
gpio_init();
gctrl_init();
pwm_init();
gpio_init();
// Can happen in any order
ecpm_init();
kbc_init();
kbled_init();
kbscan_init();
pmc_init();
peci_init();
pmc_init();
pwm_init();
smbus_init();
//TODO: INTC