diff --git a/src/board/system76/lemp9/main.c b/src/board/system76/lemp9/main.c index c405bba..0d42317 100644 --- a/src/board/system76/lemp9/main.c +++ b/src/board/system76/lemp9/main.c @@ -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() { diff --git a/src/board/system76/lemp9/peci.c b/src/board/system76/lemp9/peci.c index 6d075ae..a0d08a4 100644 --- a/src/board/system76/lemp9/peci.c +++ b/src/board/system76/lemp9/peci.c @@ -2,6 +2,7 @@ #include #include +#include #include // 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 diff --git a/src/ec/it5570e/include/ec/peci.h b/src/ec/it5570e/include/ec/peci.h index 65e3a4a..acba568 100644 --- a/src/ec/it5570e/include/ec/peci.h +++ b/src/ec/it5570e/include/ec/peci.h @@ -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