Skip to content

Commit 8d855a2

Browse files
GTLin08kartben
authored andcommitted
soc: ite: it8xxx2: Disable I2C0 alternate function to allow sleep entry
The chip requires a successful sleep entry to change the PLL sequence. By default, the IT8XXX2 chip enables the I2C0 alternate function, which can cause the clock/data lines to meet the start condition, preventing EC from entering sleep mode. This commit disables the I2C0 alternate function before executing the PLL sequence change to ensure that the EC can enter sleep mode successfully. Signed-off-by: Tim Lin <[email protected]>
1 parent 38b959e commit 8d855a2

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

soc/ite/ec/common/chip_chipregs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@
191191
*/
192192
/* GPIO control register */
193193
#ifdef CONFIG_SOC_IT8XXX2_REG_SET_V1
194+
#define IT8XXX2_GPIO_GPCRB3 ECREG(EC_REG_BASE_ADDR + 0x161B)
195+
#define IT8XXX2_GPIO_GPCRB4 ECREG(EC_REG_BASE_ADDR + 0x161C)
194196
#define GPCRF4 ECREG(EC_REG_BASE_ADDR + 0x163C)
195197
#define GPCRF5 ECREG(EC_REG_BASE_ADDR + 0x163D)
196198
#define GPCRH1 ECREG(EC_REG_BASE_ADDR + 0x1649)

soc/ite/ec/it8xxx2/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config SOC_SERIES_IT8XXX2
77
select ARCH_HAS_CUSTOM_CPU_IDLE
88
select ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
99
select RISCV_SOC_HAS_GP_RELATIVE_ADDRESSING
10+
select SOC_PREP_HOOK
1011

1112
if SOC_SERIES_IT8XXX2
1213

soc/ite/ec/it8xxx2/soc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,18 @@ void arch_cpu_atomic_idle(unsigned int key)
369369
riscv_idle(CHIP_PLL_DOZE, key);
370370
}
371371

372+
void soc_prep_hook(void)
373+
{
374+
#ifdef CONFIG_SOC_IT8XXX2_REG_SET_V1
375+
/*
376+
* Disables the I2C0 alternate function before executing the PLL sequence change
377+
* to ensure that the EC can enter sleep mode successfully.
378+
*/
379+
IT8XXX2_GPIO_GPCRB3 = GPCR_PORT_PIN_MODE_INPUT;
380+
IT8XXX2_GPIO_GPCRB4 = GPCR_PORT_PIN_MODE_INPUT;
381+
#endif
382+
}
383+
372384
static int ite_it8xxx2_init(void)
373385
{
374386
struct gpio_it8xxx2_regs *const gpio_regs = GPIO_IT8XXX2_REG_BASE;

0 commit comments

Comments
 (0)