Skip to content

Commit

Permalink
Add basic support for IT5571E
Browse files Browse the repository at this point in the history
The IT5571E is nearly identical to the IT5570E.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
  • Loading branch information
crawfxrd committed Aug 15, 2023
1 parent 13dd6a1 commit dc482dd
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/board/system76/common/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void pwm_init(void) {
// Turn off CPU fan (temperature control in peci_get_fan_duty)
DCR2 = 0;

#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
// Reload counters when they reach 0 instead of immediately
PWMLCCR = 0xFF;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void ec_init(void) {
}

void ec_read_post_codes(void) {
#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
while (P80H81HS & 1) {
uint8_t p80h = P80HD;
uint8_t p81h = P81HD;
Expand Down
4 changes: 4 additions & 0 deletions src/ec/ite/ec.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ CFLAGS+=-DCONFIG_EC_ITE_IT5570E=1
# 0x0E00-0x1000 is used for AP communication. So this is brought down to 2048,
# which matches IT8587E limits
SRAM_SIZE=2048
else ifeq ($(CONFIG_EC_ITE_IT5571E), y)
# The IT5571E is effectively the same as the IT5570E.
CFLAGS+=-DCONFIG_EC_ITE_IT5571E=1
SRAM_SIZE=2048
else
$(error Unsupported EC)
endif
Expand Down
4 changes: 2 additions & 2 deletions src/ec/ite/espi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <ec/espi.h>

#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E

// Not all wires are defined or implemented
// Index 2 - AP to EC
Expand Down Expand Up @@ -68,4 +68,4 @@ void vw_set(struct VirtualWire *vw, enum VirtualWireState state) __critical {
*vw->index = index;
}

#endif // CONFIG_EC_ITE_IT5570E
#endif // CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
2 changes: 1 addition & 1 deletion src/ec/ite/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct I2C __code I2C_1 = {
.trasla = TRASLAB,
};

#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
struct I2C __code I2C_4 = {
.hosta = HOSTAE,
.hoctl = HOCTLE,
Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/include/ec/gctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
volatile uint8_t __xdata __at(0x2006) RSTS;
volatile uint8_t __xdata __at(0x200A) BADRSEL;
volatile uint8_t __xdata __at(0x200D) SPCTRL1;
#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
volatile uint8_t __xdata __at(0x2030) P80H81HS;
volatile uint8_t __xdata __at(0x2031) P80HD;
volatile uint8_t __xdata __at(0x2032) P81HD;
Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/include/ec/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ volatile uint8_t __xdata __at(0x16FE) GCR15;
volatile uint8_t __xdata __at(0x16E0) GCR16;
volatile uint8_t __xdata __at(0x16E1) GCR17;
volatile uint8_t __xdata __at(0x16E2) GCR18;
#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
volatile uint8_t __xdata __at(0x16E4) GCR19;
volatile uint8_t __xdata __at(0x16E5) GCR20;
volatile uint8_t __xdata __at(0x16E6) GCR21;
Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/include/ec/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

extern struct I2C __code I2C_0;
extern struct I2C __code I2C_1;
#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
extern struct I2C __code I2C_4;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/include/ec/intc.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ volatile uint8_t __xdata __at(0x114D) IER18;
volatile uint8_t __xdata __at(0x114E) IELMR18;
volatile uint8_t __xdata __at(0x114F) IPOLR18;

#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
volatile uint8_t __xdata __at(0x1150) ISR19;
volatile uint8_t __xdata __at(0x1151) IER19;
volatile uint8_t __xdata __at(0x1152) IELMR19;
Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/include/ec/pwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ volatile uint8_t __xdata __at(0x1823) ZTIER;
// Tachometer switch control register
volatile uint8_t __xdata __at(0x1848) TSWCTLR;

#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
// PWM Load Counter Control Register
volatile uint8_t __xdata __at(0x185A) PWMLCCR;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/include/ec/smbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ volatile uint8_t __xdata __at(0x1C44) RESLADR2B;
// SMCLK timing setting for channel B
volatile uint8_t __xdata __at(0x1C41) SCLKTSB;

#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
// Host status for channel E
volatile uint8_t __xdata __at(0x1CA0) HOSTAE;
// Host control for channel E
Expand Down
2 changes: 1 addition & 1 deletion src/ec/ite/intc.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static const struct IrqGroup irqs[] = {
IRQ_GROUP(16),
IRQ_GROUP(17),
IRQ_GROUP(18),
#if CONFIG_EC_ITE_IT5570E
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
IRQ_GROUP(19),
IRQ_GROUP(20),
IRQ_GROUP(21),
Expand Down

0 comments on commit dc482dd

Please sign in to comment.