Skip to content

drivers/espi: ite: Refactor eSPI driver support for SoC flexibility #90640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 5, 2025

Conversation

GTLin08
Copy link
Collaborator

@GTLin08 GTLin08 commented May 27, 2025

This PR includes the following improvements:

  1. Register definitions previously located in a shared header file have been moved into the driver source file. This reduces cross-dependencies and makes the driver easier to adapt for different SoCs. Chip-specific function and macro names were also renamed to more generic forms to align with the SoC-common structure.

  2. Added necessary configurations when CONFIG_ESPI is enabled, including disabling the eSPI pad before changing the PLL sequence and setting the appropriate mode in vector.S.

GTLin08 added 4 commits May 26, 2025 21:18
Move register definitions from chip_chipregs.h into espi_it8xxx2.c to
make the driver more adaptable to different SoCs.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
…_ESPI

If CONFIG_ESPI is defined, use 0xA4 (eSPI mode).
Otherwise, use 0xA5 (LPC mode).

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Renamed two functions and a macro to use more generic names,
removing chip-specific identifiers.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
We have to disable eSPI pad before changing PLL sequence or sequence
will fail if CS# pin is low.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Copy link

Comment on lines +17 to +18
#define ESPI_IT8XXX2_SOC_DEV DEVICE_DT_GET(DT_NODELABEL(espi0))
#define ESPI_ITE_SOC_DEV ESPI_IT8XXX2_SOC_DEV
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - do you need both macros?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept ESPI_IT8XXX2_SOC_DEV because it's still used in some parts of espi_it8xxx2.c. So for now, both macros are needed.

@GTLin08
Copy link
Collaborator Author

GTLin08 commented Jun 5, 2025

Hi @nordic-krch, could you please take a look at this PR? Thanks!

@kartben kartben merged commit 706b7e9 into zephyrproject-rtos:main Jun 5, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants