platform/chrome: cros_ec_lpc: Support direct EC register memory access
authorGwendal Grignou <gwendal@chromium.org>
Tue, 7 Jan 2025 17:45:14 +0000 (09:45 -0800)
committerTzung-Bi Shih <tzungbi@kernel.org>
Wed, 8 Jan 2025 02:12:02 +0000 (02:12 +0000)
commitbe4fccb5e1fb5c732f2868b9a278e71d9be0283c
tree580907909ebb946d660f622b89f8b5193f497241
parent58517215304b6113beaa3a319ed19cdd9f8fbcc1
platform/chrome: cros_ec_lpc: Support direct EC register memory access

Add support to access EC memory region HOST command and ACPI memory
region directly.

The memory region comes from the CRS ACPI resource descriptor.

The driver retrieves the memory information by adding a resource walker
for the CRS region. If a memory region is found, it is mapped and the
driver uses a new set of read/write primitives to access the EC doorbell
and external registers.

Once the memory is mapped, it belongs to the driver:
grep GOOG0004 /proc/iomem
    fe0b0000-fe0bffff : GOOG0004:00

We can verify the communication is established checking the EC version,
or monitoring the commands using the cros-ec kernel tracer.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20250107174514.2748108-3-gwendal@chromium.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_lpc.c