Add PECI init

This commit is contained in:
Jeremy Soller 2020-01-12 20:18:57 -07:00
parent 0687488ec4
commit e9c308b789
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
3 changed files with 14 additions and 4 deletions

View File

@ -51,11 +51,9 @@ void init(void) {
kbscan_init();
pwm_init();
smbus_init();
peci_init();
//TODO: INTC, PECI
// Allow PECI pin to be used
GCR2 |= (1 << 4);
//TODO: INTC
}
void ac_adapter() {

View File

@ -2,6 +2,7 @@
#include <board/peci.h>
#include <common/debug.h>
#include <ec/gpio.h>
#include <ec/pwm.h>
// Tjunction = 100C for i7-8565U (and probably the same for all WHL-U)
@ -16,6 +17,16 @@ static bool peci_config_loaded = false;
#define PECI_TEMP(X) (((int16_t)(X)) << 6)
void peci_init(void) {
// Allow PECI pin to be used
GCR2 |= (1 << 4);
// Set frequency to 1MHz
HOCTL2R = 0x01;
// Set VTT to 1V
PADCTLR = 0x02;
}
// Read tjmax using index 16 of RdPkgConfig
static void peci_config(void) {
// Wait for completion

View File

@ -13,5 +13,6 @@ static volatile uint8_t __xdata __at(0x3006) HOWRDR;
static volatile uint8_t __xdata __at(0x3007) HORDDR;
static volatile uint8_t __xdata __at(0x3008) HOCTL2R;
static volatile uint8_t __xdata __at(0x3009) RWFCSV;
static volatile uint8_t __xdata __at(0x300E) PADCTLR;
#endif // _EC_PECI_H