Lines Matching +full:wakeup +full:- +full:and +full:- +full:sleep

4  * SPDX-License-Identifier: Apache-2.0
15 #include <zephyr/dt-bindings/interrupt-controller/ite-intc.h>
19 * ITE EC chip from dtsi (include status disable). Both it81202 and
34 /* PLL Frequency Auto-Calibration Control 0 Register */
44 /* PLL Frequency Auto-Calibration Control 2 Register */
79 return -ERANGE; in chip_get_pll_freq()
91 * for deep doze / sleep mode in chip_pll_ctrl()
180 /* Enable HW timer to wakeup chip from the sleep mode */ in chip_run_pll_sequence()
186 * into wakeup from the sleep mode. in chip_run_pll_sequence()
188 * enter sleep mode, and wait HW timer to wakeup chip to in chip_run_pll_sequence()
191 IT8XXX2_ECPM_PLLFREQR = pll->pll_freq; in chip_run_pll_sequence()
192 /* Pre-set FND clock frequency = PLL / 3 */ in chip_run_pll_sequence()
194 /* JTAG and EC */ in chip_run_pll_sequence()
195 IT8XXX2_ECPM_SCDCR3 = (pll->div_jtag << 4) | pll->div_ec; in chip_run_pll_sequence()
196 /* Chip sleep after wait for interrupt (wfi) instruction */ in chip_run_pll_sequence()
198 /* Chip sleep and wait timer wake it up */ in chip_run_pll_sequence()
200 /* New FND and MCU clock frequency */ in chip_run_pll_sequence()
201 IT8XXX2_ECPM_SCDCR0 = (pll->div_fnd << 4) | pll->div_mcu; in chip_run_pll_sequence()
204 /* USB and UART */ in chip_run_pll_sequence()
205 IT8XXX2_ECPM_SCDCR1 = (pll->div_usb << 4) | pll->div_uart; in chip_run_pll_sequence()
206 /* SSPI and SMB */ in chip_run_pll_sequence()
207 IT8XXX2_ECPM_SCDCR2 = (pll->div_sspi << 4) | pll->div_smb; in chip_run_pll_sequence()
208 /* USBPD and PWM */ in chip_run_pll_sequence()
209 IT8XXX2_ECPM_SCDCR4 = (pll->div_usbpd << 4) | pll->div_pwm; in chip_run_pll_sequence()
214 /* Re-configure PLL clock or not. */ in chip_configure_pll()
215 if (((IT8XXX2_ECPM_PLLFREQR & 0xf) != pll->pll_freq) || in chip_configure_pll()
216 ((IT8XXX2_ECPM_SCDCR0 & 0xf0) != (pll->div_fnd << 4)) || in chip_configure_pll()
217 ((IT8XXX2_ECPM_SCDCR3 & 0xf) != pll->div_ec)) { in chip_configure_pll()
298 * called without interrupts locked. Hence we disable M-mode external in riscv_idle()
306 * mode will disable CPU and RAM clocks, enable eSPI transaction in riscv_idle()
322 * register is non-zero. in riscv_idle()
324 * it means that EC waked-up by the above issue not an in riscv_idle()
341 * Enable M-mode external interrupt in riscv_idle()
380 usb_regs->port0_misc_control &= ~PULL_DOWN_EN; in ite_it8xxx2_init()
381 usb_regs->port1_misc_control &= ~PULL_DOWN_EN; in ite_it8xxx2_init()
385 * bit7: wake up CPU if it is in low power mode and in ite_it8xxx2_init()
388 gctrl_regs->GCTRL_WMCR |= BIT(7); in ite_it8xxx2_init()
394 gctrl_regs->GCTRL_MCCR &= ~IT8XXX2_GCTRL_USB_DEBUG_EN; in ite_it8xxx2_init()
397 * Disable this feature that can detect pre-define hardware in ite_it8xxx2_init()
419 gctrl_regs->GCTRL_RSTDMMC |= IT8XXX2_GCTRL_UART1SD; in ite_it8xxx2_init()
421 gctrl_regs->GCTRL_RSTC4 = IT8XXX2_GCTRL_RUART1; in ite_it8xxx2_init()
424 gpio_regs->GPIO_GCR1 |= IT8XXX2_GPIO_U1CTRL_SIN0_SOUT0_EN; in ite_it8xxx2_init()
431 gpio_regs->GPIO_GCR21 &= ~(IT8XXX2_GPIO_GPH1VS | IT8XXX2_GPIO_GPH2VS); in ite_it8xxx2_init()
437 gctrl_regs->GCTRL_RSTDMMC |= IT8XXX2_GCTRL_UART2SD; in ite_it8xxx2_init()
439 gctrl_regs->GCTRL_RSTC4 = IT8XXX2_GCTRL_RUART2; in ite_it8xxx2_init()
442 gpio_regs->GPIO_GCR1 |= IT8XXX2_GPIO_U2CTRL_SIN1_SOUT1_EN; in ite_it8xxx2_init()
466 /* Power down all CC, and disable CC voltage detector */ in ite_it8xxx2_init()
467 base->CCGCR |= (IT8XXX2_USBPD_DISABLE_CC | in ite_it8xxx2_init()
470 * Disconnect CC analog module (ex.UP/RD/DET/TX/RX), and in ite_it8xxx2_init()
473 base->CCCSR |= (IT8XXX2_USBPD_CC2_DISCONNECT | in ite_it8xxx2_init()
478 base->CCPSR |= (IT8XXX2_USBPD_DISCONNECT_POWER_CC2 | in ite_it8xxx2_init()
480 /* Dis-connect 5.1K dead battery resistor to CC */ in ite_it8xxx2_init()
481 base->CCPSR |= (IT8XXX2_USBPD_DISCONNECT_5_1K_CC2_DB | in ite_it8xxx2_init()