mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support
@ 2026-11-18  8:57 Wang Yang
  2026-11-18  8:57 ` [PATCH 1/9] dt-bindings: bus: Add SpacemiT K3 eSPI controller Wang Yang
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

The DeepComputing FML13V05 uses a ChromeOS-compatible embedded controller
connected through the SpacemiT K3 eSPI peripheral channel. Its internal
keyboard is not available on linux-next without the controller and EC
transport support described in this series.

The EC host command registers are exposed through a memory-mapped,
non-linear peripheral window. This interface cannot use the ordinary
cros_ec_spi message transport directly. Add a K3-specific controller and
EC transport, and reuse the existing ChromeOS EC protocol, MFD and
keyboard drivers. Existing EC core, LPC, SPI, protocol and keyboard C
files and the google,cros-ec binding are unchanged.

The series is based on next-20261116. Patches 1-2 document the controller
and EC bindings; patch 3 adds the controller; patches 4-5 enable Chrome
platform support on RISC-V and add the EC transport; patches 6-8 describe
the pins, controller and board keyboard; patch 9 enables the drivers in
riscv defconfig, with the EC transport and keyboard built as modules.

The controller implementation is ported from the SpacemiT vendor BSP
(revision 29b78afb484b, originally authored by goumin
<min.gou@spacemit.com>). Controller programming and recovery remain
separate from the EC client. The EC transport and compatible are scoped
to K3 because the window layout and controller recovery API are specific
to this hardware. Feedback on the transport split and recovery interface
is welcome.

Validation on an FML13V05 with its internal keyboard, 2026-11-18:
- W=1 cross-build of Image, modules and the board DTB completed. No new
  warnings came from the added drivers.
- Both new bindings and their compiled examples passed schema validation;
  the new examples passed strict DT style checks. The new EC, controller
  and keyboard nodes in the board DTB also passed validation.
- Cold boot and module autoload passed all 20 automatic checks.
- 153 read-only EC queries and three EC module unload/reload cycles
  succeeded. EC firmware was FML13V05-V01.06.
- A/B/C/1/2/Enter, all four arrows and Fn+F1/F2/F7/F8 produced the expected
  28 paired press/release events, with no dropped or held keys and no
  new EC/eSPI errors in the kernel log.

The running test kernel was
7.4.0-rc3-next-20261116-fml13v05-k3-espi+.
Booting the test system required a separate K3 PCIe test module and
USB/NVMe DT additions, which are outside this EC series. Suspend/resume,
EC restart fault injection, full-keymap coverage and long-duration
stability were not tested. A previously observed UEFI reset_system()
failure was not addressed or retested by this series.

Checkpatch reports no errors or CHECK findings. Its four new-file
MAINTAINERS reminders were reviewed: the existing SpacemiT N: pattern
and Chrome EC/DT entries already cover the new paths, so no MAINTAINERS
change is included.

OpenAI Codex assisted the port, patch preparation, review analysis and
test tooling. The work was developed through an iterative session to
port the existing DC-linux/BSP support, keep the common EC implementation
unchanged, use K3-specific naming and bindings, and verify the result on
hardware. Human review was completed before submission; the numbered
patches retain the submitter's existing DCO sign-offs.

Wang Yang (9):
  dt-bindings: bus: Add SpacemiT K3 eSPI controller
  dt-bindings: embedded-controller: Add SpacemiT K3 EC window
  bus: Add SpacemiT K3 eSPI controller support
  platform/chrome: Allow ChromeOS platform support on RISC-V
  platform/chrome: Add SpacemiT K3 eSPI EC transport
  riscv: dts: spacemit: Add K3 eSPI pin group
  riscv: dts: spacemit: Describe the K3 eSPI controller
  riscv: dts: spacemit: Enable the FML13V05 EC keyboard
  riscv: defconfig: Enable the FML13V05 EC keyboard modules

 .../bindings/bus/spacemit,k3-espi.yaml        | 146 ++++
 .../spacemit,k3-cros-ec.yaml                  |  58 ++
 .../spacemit/k3-deepcomputing-fml13v05.dts    | 137 +++
 arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi  |  24 +
 arch/riscv/boot/dts/spacemit/k3.dtsi          |  31 +
 arch/riscv/configs/defconfig                  |   5 +
 drivers/bus/Kconfig                           |  10 +
 drivers/bus/Makefile                          |   1 +
 drivers/bus/spacemit-k3-espi.c                | 804 ++++++++++++++++++
 drivers/platform/chrome/Kconfig               |  13 +-
 drivers/platform/chrome/Makefile              |   1 +
 drivers/platform/chrome/cros_ec_spacemit_k3.c | 739 ++++++++++++++++
 include/linux/spacemit-k3-espi.h              |  20 +
 13 files changed, 1988 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
 create mode 100644 Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml
 create mode 100644 drivers/bus/spacemit-k3-espi.c
 create mode 100644 drivers/platform/chrome/cros_ec_spacemit_k3.c
 create mode 100644 include/linux/spacemit-k3-espi.h


base-commit: 749a4de370409464cf8501ec5b2451df45c84eb4
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/9] dt-bindings: bus: Add SpacemiT K3 eSPI controller
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18 17:51   ` Conor Dooley
  2026-11-18  8:57 ` [PATCH 2/9] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Describe the K3 eSPI controller and its peripheral memory translation
window, clocks, resets and link configuration. The EC uses this memory
window rather than the ordinary SPI transfer interface.

The controller implementation is carried as a separate prerequisite so
that the hardware vendor can review it independently.

Prepared with Codex assistance from the existing DC-linux EC support.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 .../bindings/bus/spacemit,k3-espi.yaml        | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml

diff --git a/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml b/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
new file mode 100644
index 000000000..30985ee0a
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
@@ -0,0 +1,146 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bus/spacemit,k3-espi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SpacemiT K3 eSPI controller
+
+maintainers:
+  - Yixun Lan <dlan@kernel.org>
+
+description: |
+  The K3 eSPI controller connects the application processor to an embedded
+  controller. Child registers are accessed through a peripheral shared-memory
+  window, translated by ranges. The controller manages clocks, resets and
+  channel negotiation, including link recovery after an EC reboot.
+
+properties:
+  compatible:
+    const: spacemit,k3-espi
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 1
+
+  ranges:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Serial clock source
+      - description: Serial clock
+      - description: Bus clock
+
+  clock-names:
+    items:
+      - const: sclk_src
+      - const: sclk
+      - const: mclk
+
+  resets:
+    items:
+      - description: Bus reset
+      - description: Serial clock reset
+
+  pr-mem-base0:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: First peripheral memory translation base.
+
+  pr-mem-base1:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Second peripheral memory translation base.
+
+  operating-frequency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Requested link clock frequency in MHz.
+    enum: [20, 25, 33, 50, 66]
+    default: 20
+
+  io-mode:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Requested number of eSPI data lines.
+    enum: [single, dual, quad]
+    default: single
+
+  alert-mode:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Use the shared IO1 line or the dedicated alert pin.
+    enum: [io1, pin]
+    default: io1
+
+  alert-type:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Electrical mode of the dedicated alert pin.
+    enum: [open-drain, push-pull]
+    default: open-drain
+
+  watchdog-timeout:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Controller watchdog counter value.
+    maximum: 65535
+    default: 65535
+
+  crc-enable:
+    type: boolean
+    description: Enable link CRC checking.
+
+  auto-gating-enable:
+    type: boolean
+    description: Enable automatic controller clock gating.
+
+  peripheral-channel-enable:
+    type: boolean
+    description: Enable the peripheral channel.
+
+  vwire-channel-enable:
+    type: boolean
+    description: Enable the virtual-wire channel.
+
+  oob-channel-enable:
+    type: boolean
+    description: Enable the out-of-band channel.
+
+  flash-channel-enable:
+    type: boolean
+    description: Enable the flash access channel.
+
+patternProperties:
+  '^ec@[0-9a-f]+$':
+    $ref: /schemas/embedded-controller/google,cros-ec.yaml#
+
+required:
+  - compatible
+  - reg
+  - '#address-cells'
+  - '#size-cells'
+  - ranges
+  - clocks
+  - clock-names
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/spacemit,k3-clocks.h>
+    #include <dt-bindings/reset/spacemit,k3-resets.h>
+
+    espi@cac8c000 {
+        compatible = "spacemit,k3-espi";
+        reg = <0xcac8c000 0x1000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges = <0 0x84000000 0x1000>;
+        clocks = <&syscon_apmu CLK_APMU_ESPI_SCLK_SRC>,
+                 <&syscon_apmu CLK_APMU_ESPI_SCLK>,
+                 <&syscon_apmu CLK_APMU_ESPI_MCLK>;
+        clock-names = "sclk_src", "sclk", "mclk";
+        resets = <&syscon_apmu RESET_APMU_ESPI_MCLK>,
+                 <&syscon_apmu RESET_APMU_ESPI_SCLK>;
+    };

base-commit: 749a4de370409464cf8501ec5b2451df45c84eb4
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/9] dt-bindings: embedded-controller: Add SpacemiT K3 EC window
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
  2026-11-18  8:57 ` [PATCH 1/9] dt-bindings: bus: Add SpacemiT K3 eSPI controller Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18  8:57 ` [PATCH 3/9] bus: Add SpacemiT K3 eSPI controller support Wang Yang
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Describe the K3-specific non-linear peripheral window in a vendor
binding. Reuse the existing EC keyboard schema and keep the Google EC
binding unchanged. Point the vendor controller child schema at this
binding.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 .../bindings/bus/spacemit,k3-espi.yaml        |  2 +-
 .../spacemit,k3-cros-ec.yaml                  | 58 +++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml

diff --git a/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml b/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
index 30985ee0a..545cc2609 100644
--- a/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
+++ b/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
@@ -112,7 +112,7 @@ properties:
 
 patternProperties:
   '^ec@[0-9a-f]+$':
-    $ref: /schemas/embedded-controller/google,cros-ec.yaml#
+    $ref: /schemas/embedded-controller/spacemit,k3-cros-ec.yaml#
 
 required:
   - compatible
diff --git a/Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml b/Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml
new file mode 100644
index 000000000..971e7b32d
--- /dev/null
+++ b/Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/embedded-controller/spacemit,k3-cros-ec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ChromeOS EC on the SpacemiT K3 peripheral window
+
+maintainers:
+  - Wang Yang <yang.wang@deepcomputing.io>
+
+description: |
+  The embedded controller implements ChromeOS EC host commands through the
+  memory-mapped peripheral window of the SpacemiT K3 eSPI controller. The
+  window uses a non-linear LPC register layout. Offset 0x00 provides host
+  command writes and status reads; offset 0x01 provides host data/results.
+  Protocol v2 arguments and parameters are at 0x10 and 0x18, protocol v3
+  packets at 0x100, and the EC memory map at 0x200. This programming interface
+  is distinct from an EC connected to an ordinary SPI controller.
+
+properties:
+  compatible:
+    const: spacemit,k3-cros-ec
+
+  reg:
+    maxItems: 1
+    description: EC peripheral memory window, at least 0x300 bytes.
+
+  interrupts:
+    maxItems: 1
+
+  wakeup-source: true
+
+  keyboard-controller:
+    $ref: /schemas/input/google,cros-ec-keyb.yaml#
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    bus {
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        ec@0 {
+            compatible = "spacemit,k3-cros-ec";
+            reg = <0x0 0x1000>;
+            interrupt-parent = <&gpio>;
+            interrupts = <1 11 IRQ_TYPE_EDGE_RISING>;
+        };
+    };
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/9] bus: Add SpacemiT K3 eSPI controller support
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
  2026-11-18  8:57 ` [PATCH 1/9] dt-bindings: bus: Add SpacemiT K3 eSPI controller Wang Yang
  2026-11-18  8:57 ` [PATCH 2/9] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18 21:10   ` Aurelien Jarno
  2026-11-18  8:57 ` [PATCH 4/9] platform/chrome: Allow ChromeOS platform support on RISC-V Wang Yang
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Initialize and recover the K3 eSPI peripheral channel before populating
its children. Keep controller register programming, clock and reset
handling in the controller driver rather than in the EC transport.

Port the existing vendor-derived implementation separately from the EC
client. The controller logic comes from the vendor BSP at revision
29b78afb484b, authored by goumin <min.gou@spacemit.com>. Preserve its
register programming and link-recovery behavior.

No matching SpacemiT eSPI submission was found in the archived SPI,
RISC-V and Chrome platform searches used for this port.

Prepared with Codex assistance from the existing DC-linux EC support.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 drivers/bus/Kconfig              |  10 +
 drivers/bus/Makefile             |   1 +
 drivers/bus/spacemit-k3-espi.c   | 804 +++++++++++++++++++++++++++++++
 include/linux/spacemit-k3-espi.h |  20 +
 4 files changed, 835 insertions(+)
 create mode 100644 drivers/bus/spacemit-k3-espi.c
 create mode 100644 include/linux/spacemit-k3-espi.h

diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index e4b1db809..35b00c9ba 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -149,6 +149,16 @@ config STM32_DBG_BUS
 	  platforms when the debug configuration is not accessible by the
 	  normal world.
 
+config SPACEMIT_ESPI_BUS
+	bool "SpacemiT K3 eSPI controller"
+	depends on OF && HAS_IOMEM
+	depends on ARCH_SPACEMIT || COMPILE_TEST
+	help
+	  Enable the SpacemiT K3 eSPI controller, including clock and reset
+	  management, link initialization and recovery after an EC reboot.
+	  Child devices can use its peripheral shared-memory window.
+	  Say Y here to use the EC keyboard on DeepComputing FML13V05.
+
 config STM32_FIREWALL
 	bool "STM32 Firewall framework"
 	depends on (ARCH_STM32 || COMPILE_TEST) && OF
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index a01f97fef..cc46cfc68 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_OMAP_OCP2SCP)	+= omap-ocp2scp.o
 obj-$(CONFIG_QCOM_EBI2)		+= qcom-ebi2.o
 obj-$(CONFIG_QCOM_SSC_BLOCK_BUS)	+= qcom-ssc-block-bus.o
 obj-$(CONFIG_STM32_DBG_BUS)	+= stm32_dbg_bus.o
+obj-$(CONFIG_SPACEMIT_ESPI_BUS) += spacemit-k3-espi.o
 obj-$(CONFIG_STM32_FIREWALL)	+= stm32_firewall.o stm32_rifsc.o stm32_etzpc.o
 obj-$(CONFIG_SUN50I_DE2_BUS)	+= sun50i-de2.o
 obj-$(CONFIG_SUNXI_RSB)		+= sunxi-rsb.o
diff --git a/drivers/bus/spacemit-k3-espi.c b/drivers/bus/spacemit-k3-espi.c
new file mode 100644
index 000000000..b511b164b
--- /dev/null
+++ b/drivers/bus/spacemit-k3-espi.c
@@ -0,0 +1,804 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * SpacemiT K3 eSPI controller driver
+ *
+ * This driver owns controller-level initialization and recovery so child
+ * devices such as cros_ec_espi can treat the peripheral shared memory window
+ * as a transport and ask the parent controller to recover the link when the
+ * EC reboots underneath Linux.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/reset.h>
+#include <linux/sizes.h>
+#include <linux/spacemit-k3-espi.h>
+#include <linux/wordpart.h>
+
+#define ESPI_DN_TXHDR			0x00
+#define ESPI_DN_TXDATA_PORT		0x0c
+#define ESPI_MASTER_CAP			0x2c
+#define ESPI_GLOBAL_CONTROL_0		0x30
+#define ESPI_GLOBAL_CONTROL_1		0x34
+#define ESPI_PR_BASE_ADDR_MEM0		0x38
+#define ESPI_PR_BASE_ADDR_MEM1		0x3c
+#define ESPI_SLAVE0_CONFIG		0x68
+#define ESPI_SLAVE0_INT_EN		0x6c
+#define ESPI_SLAVE0_INT_STS		0x70
+
+#define ESPI_DNCMD_TYPE_MASK		GENMASK(2, 0)
+#define ESPI_DNCMD_EN			BIT(3)
+#define ESPI_DNCMD_SLAVE_SEL_MASK	GENMASK(5, 4)
+
+#define ESPI_DNCMD_SET_CONFIGURATION	0x00
+#define ESPI_DNCMD_GET_CONFIGURATION	0x01
+#define ESPI_DNCMD_IN_BAND_RESET	0x02
+
+#define ESPI_FLASH_REQ_INT		BIT(31)
+#define ESPI_RXOOB_INT			BIT(30)
+#define ESPI_RXMSG_INT			BIT(29)
+#define ESPI_DNCMD_INT			BIT(28)
+#define ESPI_RXVW_GRP3_INT		BIT(27)
+#define ESPI_RXVW_GRP2_INT		BIT(26)
+#define ESPI_RXVW_GRP1_INT		BIT(25)
+#define ESPI_RXVW_GRP0_INT		BIT(24)
+#define ESPI_PROTOCOL_ERR_INT		BIT(15)
+#define ESPI_RXFLASH_OFLOW_INT		BIT(14)
+#define ESPI_RXMSG_OFLOW_INT		BIT(13)
+#define ESPI_RXOOB_OFLOW_INT		BIT(12)
+#define ESPI_ILLEGAL_LEN_INT		BIT(11)
+#define ESPI_ILLEGAL_TAG_INT		BIT(10)
+#define ESPI_UNSUCSS_CPL_INT		BIT(9)
+#define ESPI_INVALID_CT_RSP_INT		BIT(8)
+#define ESPI_UNKNOWN_RSP_INT		BIT(7)
+#define ESPI_NON_FATAL_INT		BIT(6)
+#define ESPI_FATAL_ERR_INT		BIT(5)
+#define ESPI_NO_RSP_INT			BIT(4)
+#define ESPI_CRC_ERR_INT		BIT(2)
+#define ESPI_WAIT_TIMEOUT_INT		BIT(1)
+#define ESPI_BUS_ERR_INT		BIT(0)
+
+#define ESPI_CALLBACK_INT		(ESPI_FLASH_REQ_INT | \
+					 ESPI_RXOOB_INT | \
+					 ESPI_RXMSG_INT | \
+					 ESPI_DNCMD_INT | \
+					 ESPI_RXVW_GRP3_INT | \
+					 ESPI_RXVW_GRP2_INT | \
+					 ESPI_RXVW_GRP1_INT | \
+					 ESPI_RXVW_GRP0_INT)
+#define ESPI_PROTOCOL_INT		(ESPI_PROTOCOL_ERR_INT | \
+					 ESPI_RXFLASH_OFLOW_INT | \
+					 ESPI_RXMSG_OFLOW_INT | \
+					 ESPI_RXOOB_OFLOW_INT | \
+					 ESPI_ILLEGAL_LEN_INT | \
+					 ESPI_ILLEGAL_TAG_INT | \
+					 ESPI_UNSUCSS_CPL_INT | \
+					 ESPI_INVALID_CT_RSP_INT | \
+					 ESPI_UNKNOWN_RSP_INT | \
+					 ESPI_CRC_ERR_INT | \
+					 ESPI_WAIT_TIMEOUT_INT | \
+					 ESPI_BUS_ERR_INT)
+#define ESPI_RESPONSE_INT		(ESPI_NON_FATAL_INT | \
+					 ESPI_FATAL_ERR_INT | \
+					 ESPI_NO_RSP_INT)
+#define ESPI_ALL_INT			(ESPI_CALLBACK_INT | \
+					 ESPI_PROTOCOL_INT | \
+					 ESPI_RESPONSE_INT)
+
+#define ESPI_MST_STOP_EN		BIT(3)
+#define ESPI_CONTROL_WATCHDOG_EN	BIT(0)
+#define ESPI_CONTROL_WATCHDOG_CNT_MASK	GENMASK(23, 8)
+
+#define ESPI_CRC_CHECK_EN		BIT(31)
+#define ESPI_ALERT_MODE_SEL		BIT(30)
+#define ESPI_IO_MODE_SEL_MASK		GENMASK(29, 28)
+#define ESPI_CLK_FREQ_SEL_MASK		GENMASK(27, 25)
+#define ESPI_PR_CHANNEL_ENABLE		BIT(3)
+#define ESPI_VW_CHANNEL_ENABLE		BIT(2)
+#define ESPI_OOB_CHANNEL_ENABLE		BIT(1)
+#define ESPI_FLASH_CHANNEL_ENABLE	BIT(0)
+
+#define ESPI_ESPI_RSTN			BIT(5)
+#define ESPI_SW_RST			BIT(0)
+
+#define ESPI_SLAVE_GEN_CFG		0x08
+#define ESPI_SLAVE_PERI_CFG		0x10
+#define ESPI_SLAVE_VWIRE_CFG		0x20
+#define ESPI_SLAVE_OOB_CFG		0x30
+#define ESPI_SLAVE_FLASH_CFG		0x40
+
+#define ESPI_GEN_CRC_ENABLE		BIT(31)
+#define ESPI_GEN_ALERT_MODE_PIN		BIT(28)
+#define ESPI_GEN_IO_MODE_SUP_MASK	GENMASK(25, 24)
+#define ESPI_GEN_OPEN_DRAIN_ALERT_SEL	BIT(23)
+#define ESPI_GEN_OPEN_DRAIN_ALERT_SUP	BIT(19)
+#define ESPI_GEN_OP_FREQ_SUP_MASK	GENMASK(18, 16)
+#define ESPI_GEN_OP_FREQ_SEL_MASK	GENMASK(22, 20)
+#define ESPI_GEN_IO_MODE_SEL_MASK	GENMASK(27, 26)
+#define ESPI_GEN_FLASH_CHAN_SUP		BIT(3)
+#define ESPI_GEN_OOB_CHAN_SUP		BIT(2)
+#define ESPI_GEN_VWIRE_CHAN_SUP		BIT(1)
+#define ESPI_GEN_PERI_CHAN_SUP		BIT(0)
+
+#define ESPI_GEN_IO_MODE_SINGLE		0x0
+#define ESPI_GEN_IO_MODE_DUAL		0x1
+#define ESPI_GEN_IO_MODE_QUAD		0x2
+
+#define ESPI_GEN_OP_FREQ_20MHZ		0x0
+#define ESPI_GEN_OP_FREQ_25MHZ		0x1
+#define ESPI_GEN_OP_FREQ_33MHZ		0x2
+#define ESPI_GEN_OP_FREQ_50MHZ		0x3
+#define ESPI_GEN_OP_FREQ_66MHZ		0x4
+
+#define ESPI_ENABLE_PR_CHANNEL		0x1115
+#define ESPI_ENABLE_VW_CHANNEL		0x70701
+#define ESPI_ENABLE_OOB_CHANNEL		0x111
+#define ESPI_ENABLE_FLASH_CHANNEL	0x11125
+
+#define ESPI_CFG_TIMEOUT_US		50000
+#define ESPI_TX_IDLE_TIMEOUT_US		1000
+
+#define SPACEMIT_ESPI_DEFAULT_FREQ_MHZ	20
+#define SPACEMIT_ESPI_DEFAULT_WDT	0xffff
+
+struct spacemit_espi {
+	struct device *dev;
+	struct clk_bulk_data *clks;
+	int num_clks;
+	struct clk *sclk;
+	struct reset_control *resets;
+	bool clocks_enabled;
+	void __iomem *regs;
+	u32 pr_mem_base0;
+	u32 pr_mem_base1;
+	u32 op_freq_mhz;
+	u32 watchdog_timeout;
+	u32 io_mode;
+	bool alert_pin_mode;
+	bool alert_open_drain;
+	bool crc_enable;
+	bool enable_peri;
+	bool enable_vwire;
+	bool enable_oob;
+	bool enable_flash;
+	bool auto_gating;
+	bool initialized;
+	bool slave_ready;
+	/* Serialize controller setup, PM and EC-triggered link recovery. */
+	struct mutex lock;
+};
+
+static bool spacemit_espi_property_enabled(struct device_node *np,
+					   const char *name, bool default_value)
+{
+	if (of_find_property(np, name, NULL))
+		return of_property_read_bool(np, name);
+
+	return default_value;
+}
+
+static u32 spacemit_espi_txhdr_reg(unsigned int index)
+{
+	return ESPI_DN_TXHDR + ((index + 1) & ~0x3);
+}
+
+static u32 spacemit_espi_txhdr_shift(unsigned int index)
+{
+	return ((index + 1) & 0x3) * 8;
+}
+
+static void spacemit_espi_write_hdr(struct spacemit_espi *espi, unsigned int index,
+				    u8 value)
+{
+	u32 reg = spacemit_espi_txhdr_reg(index);
+	u32 shift = spacemit_espi_txhdr_shift(index);
+	u32 data;
+
+	data = readl(espi->regs + reg);
+	data &= ~(GENMASK(7, 0) << shift);
+	data |= (u32)value << shift;
+	writel(data, espi->regs + reg);
+}
+
+static u8 spacemit_espi_read_hdr(struct spacemit_espi *espi, unsigned int index)
+{
+	u32 reg = spacemit_espi_txhdr_reg(index);
+	u32 shift = spacemit_espi_txhdr_shift(index);
+
+	return (readl(espi->regs + reg) >> shift) & 0xff;
+}
+
+static void spacemit_espi_trigger_cmd(struct spacemit_espi *espi, u32 cmd_type)
+{
+	u32 val;
+
+	val = readl(espi->regs + ESPI_DN_TXHDR);
+	val &= ~(ESPI_DNCMD_TYPE_MASK | ESPI_DNCMD_EN |
+		 ESPI_DNCMD_SLAVE_SEL_MASK);
+	val |= FIELD_PREP(ESPI_DNCMD_TYPE_MASK, cmd_type);
+	val |= ESPI_DNCMD_EN;
+	writel(val, espi->regs + ESPI_DN_TXHDR);
+}
+
+static int spacemit_espi_wait_tx_idle(struct spacemit_espi *espi)
+{
+	unsigned int timeout = ESPI_TX_IDLE_TIMEOUT_US;
+
+	do {
+		if (!(readl(espi->regs + ESPI_DN_TXHDR) & ESPI_DNCMD_EN))
+			return 0;
+		udelay(1);
+	} while (--timeout);
+
+	return -EBUSY;
+}
+
+static int spacemit_espi_poll_status(struct spacemit_espi *espi, u32 expected)
+{
+	unsigned int timeout = ESPI_CFG_TIMEOUT_US / 10;
+	u32 status;
+
+	writel(expected, espi->regs + ESPI_SLAVE0_INT_STS);
+
+	do {
+		status = readl(espi->regs + ESPI_SLAVE0_INT_STS);
+		if (!status) {
+			fsleep(10);
+			continue;
+		}
+
+		writel(status, espi->regs + ESPI_SLAVE0_INT_STS);
+
+		if (status & expected)
+			return 0;
+
+		if (status & (ESPI_PROTOCOL_INT | ESPI_RESPONSE_INT))
+			return -EIO;
+
+		fsleep(10);
+	} while (--timeout);
+
+	return -ETIMEDOUT;
+}
+
+static int spacemit_espi_cmd_get_config(struct spacemit_espi *espi, u16 addr, u32 *value)
+{
+	int ret;
+
+	spacemit_espi_write_hdr(espi, 0, 0);
+	spacemit_espi_write_hdr(espi, 1, addr >> 8);
+	spacemit_espi_write_hdr(espi, 2, addr);
+	spacemit_espi_trigger_cmd(espi, ESPI_DNCMD_GET_CONFIGURATION);
+
+	ret = spacemit_espi_poll_status(espi, ESPI_DNCMD_INT);
+	if (ret)
+		return ret;
+
+	*value = spacemit_espi_read_hdr(espi, 3);
+	*value |= (u32)spacemit_espi_read_hdr(espi, 4) << 8;
+	*value |= (u32)spacemit_espi_read_hdr(espi, 5) << 16;
+	*value |= (u32)spacemit_espi_read_hdr(espi, 6) << 24;
+
+	return 0;
+}
+
+static int spacemit_espi_cmd_set_config(struct spacemit_espi *espi, u16 addr, u32 value)
+{
+	spacemit_espi_write_hdr(espi, 0, 0);
+	spacemit_espi_write_hdr(espi, 1, addr >> 8);
+	spacemit_espi_write_hdr(espi, 2, addr);
+	spacemit_espi_write_hdr(espi, 3, value);
+	spacemit_espi_write_hdr(espi, 4, value >> 8);
+	spacemit_espi_write_hdr(espi, 5, value >> 16);
+	spacemit_espi_write_hdr(espi, 6, value >> 24);
+	spacemit_espi_trigger_cmd(espi, ESPI_DNCMD_SET_CONFIGURATION);
+
+	return spacemit_espi_poll_status(espi, ESPI_DNCMD_INT);
+}
+
+static void spacemit_espi_enable_irqs(struct spacemit_espi *espi)
+{
+	writel(ESPI_ALL_INT, espi->regs + ESPI_SLAVE0_INT_EN);
+}
+
+static void spacemit_espi_reset_controller(struct spacemit_espi *espi)
+{
+	u32 val;
+
+	val = readl(espi->regs + ESPI_GLOBAL_CONTROL_1);
+	val &= ~ESPI_ESPI_RSTN;
+	writel(val, espi->regs + ESPI_GLOBAL_CONTROL_1);
+
+	val = readl(espi->regs + ESPI_GLOBAL_CONTROL_1);
+	val |= ESPI_ESPI_RSTN | ESPI_SW_RST;
+	writel(val, espi->regs + ESPI_GLOBAL_CONTROL_1);
+}
+
+static void spacemit_espi_send_inband_reset(struct spacemit_espi *espi)
+{
+	spacemit_espi_trigger_cmd(espi, ESPI_DNCMD_IN_BAND_RESET);
+	spacemit_espi_wait_tx_idle(espi);
+	fsleep(1000);
+}
+
+static u32 spacemit_espi_freq_to_sel(u32 mhz)
+{
+	switch (mhz) {
+	case 66:
+		return ESPI_GEN_OP_FREQ_66MHZ;
+	case 50:
+		return ESPI_GEN_OP_FREQ_50MHZ;
+	case 33:
+		return ESPI_GEN_OP_FREQ_33MHZ;
+	case 25:
+		return ESPI_GEN_OP_FREQ_25MHZ;
+	case 20:
+	default:
+		return ESPI_GEN_OP_FREQ_20MHZ;
+	}
+}
+
+static u32 spacemit_espi_build_master_only_config(struct spacemit_espi *espi)
+{
+	u32 cfg = 0;
+
+	if (espi->crc_enable)
+		cfg |= ESPI_GEN_CRC_ENABLE;
+
+	if (espi->alert_pin_mode) {
+		cfg |= ESPI_GEN_ALERT_MODE_PIN;
+		if (espi->alert_open_drain)
+			cfg |= ESPI_GEN_OPEN_DRAIN_ALERT_SEL;
+	}
+
+	cfg |= FIELD_PREP(ESPI_GEN_IO_MODE_SEL_MASK, espi->io_mode);
+	cfg |= FIELD_PREP(ESPI_GEN_OP_FREQ_SEL_MASK,
+			  spacemit_espi_freq_to_sel(espi->op_freq_mhz));
+
+	if (espi->enable_peri)
+		cfg |= ESPI_GEN_PERI_CHAN_SUP;
+	if (espi->enable_vwire)
+		cfg |= ESPI_GEN_VWIRE_CHAN_SUP;
+	if (espi->enable_oob)
+		cfg |= ESPI_GEN_OOB_CHAN_SUP;
+	if (espi->enable_flash)
+		cfg |= ESPI_GEN_FLASH_CHAN_SUP;
+
+	return cfg;
+}
+
+static u32 spacemit_espi_build_negotiated_config(struct spacemit_espi *espi,
+						 u32 slave_caps)
+{
+	u32 cfg = 0;
+	u32 io_mode;
+	u32 freq;
+
+	if (espi->crc_enable)
+		cfg |= ESPI_GEN_CRC_ENABLE;
+
+	if (espi->alert_pin_mode) {
+		cfg |= ESPI_GEN_ALERT_MODE_PIN;
+		if (espi->alert_open_drain &&
+		    (slave_caps & ESPI_GEN_OPEN_DRAIN_ALERT_SUP))
+			cfg |= ESPI_GEN_OPEN_DRAIN_ALERT_SEL;
+	}
+
+	io_mode = min_t(u32, espi->io_mode,
+			FIELD_GET(ESPI_GEN_IO_MODE_SUP_MASK, slave_caps));
+	freq = min_t(u32, spacemit_espi_freq_to_sel(espi->op_freq_mhz),
+		     FIELD_GET(ESPI_GEN_OP_FREQ_SUP_MASK, slave_caps));
+	cfg |= FIELD_PREP(ESPI_GEN_IO_MODE_SEL_MASK, io_mode);
+	cfg |= FIELD_PREP(ESPI_GEN_OP_FREQ_SEL_MASK, freq);
+
+	if (espi->enable_peri && (slave_caps & ESPI_GEN_PERI_CHAN_SUP))
+		cfg |= ESPI_GEN_PERI_CHAN_SUP;
+	if (espi->enable_vwire && (slave_caps & ESPI_GEN_VWIRE_CHAN_SUP))
+		cfg |= ESPI_GEN_VWIRE_CHAN_SUP;
+	if (espi->enable_oob && (slave_caps & ESPI_GEN_OOB_CHAN_SUP))
+		cfg |= ESPI_GEN_OOB_CHAN_SUP;
+	if (espi->enable_flash && (slave_caps & ESPI_GEN_FLASH_CHAN_SUP))
+		cfg |= ESPI_GEN_FLASH_CHAN_SUP;
+
+	return cfg;
+}
+
+static int spacemit_espi_configure_channels(struct spacemit_espi *espi, u32 cfg)
+{
+	int ret;
+
+	if (cfg & ESPI_GEN_PERI_CHAN_SUP) {
+		ret = spacemit_espi_cmd_set_config(espi, ESPI_SLAVE_PERI_CFG,
+						   ESPI_ENABLE_PR_CHANNEL);
+		if (ret)
+			return ret;
+	}
+
+	if (cfg & ESPI_GEN_VWIRE_CHAN_SUP) {
+		ret = spacemit_espi_cmd_set_config(espi, ESPI_SLAVE_VWIRE_CFG,
+						   ESPI_ENABLE_VW_CHANNEL);
+		if (ret)
+			return ret;
+	}
+
+	if (cfg & ESPI_GEN_OOB_CHAN_SUP) {
+		ret = spacemit_espi_cmd_set_config(espi, ESPI_SLAVE_OOB_CFG,
+						   ESPI_ENABLE_OOB_CHANNEL);
+		if (ret)
+			return ret;
+	}
+
+	if (cfg & ESPI_GEN_FLASH_CHAN_SUP) {
+		ret = spacemit_espi_cmd_set_config(espi, ESPI_SLAVE_FLASH_CFG,
+						   ESPI_ENABLE_FLASH_CHANNEL);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static void spacemit_espi_apply_controller_config(struct spacemit_espi *espi, u32 cfg)
+{
+	u32 val;
+	u32 mask = ESPI_CRC_CHECK_EN | ESPI_ALERT_MODE_SEL |
+		   ESPI_IO_MODE_SEL_MASK | ESPI_CLK_FREQ_SEL_MASK |
+		   ESPI_PR_CHANNEL_ENABLE | ESPI_VW_CHANNEL_ENABLE |
+		   ESPI_OOB_CHANNEL_ENABLE | ESPI_FLASH_CHANNEL_ENABLE;
+
+	val = readl(espi->regs + ESPI_SLAVE0_CONFIG);
+	val &= ~mask;
+
+	if (cfg & ESPI_GEN_CRC_ENABLE)
+		val |= ESPI_CRC_CHECK_EN;
+	if (cfg & ESPI_GEN_ALERT_MODE_PIN)
+		val |= ESPI_ALERT_MODE_SEL;
+
+	val |= FIELD_PREP(ESPI_IO_MODE_SEL_MASK,
+			  FIELD_GET(ESPI_GEN_IO_MODE_SEL_MASK, cfg));
+	val |= FIELD_PREP(ESPI_CLK_FREQ_SEL_MASK,
+			  FIELD_GET(ESPI_GEN_OP_FREQ_SEL_MASK, cfg));
+
+	if (cfg & ESPI_GEN_PERI_CHAN_SUP)
+		val |= ESPI_PR_CHANNEL_ENABLE;
+	if (cfg & ESPI_GEN_VWIRE_CHAN_SUP)
+		val |= ESPI_VW_CHANNEL_ENABLE;
+	if (cfg & ESPI_GEN_OOB_CHAN_SUP)
+		val |= ESPI_OOB_CHANNEL_ENABLE;
+	if (cfg & ESPI_GEN_FLASH_CHAN_SUP)
+		val |= ESPI_FLASH_CHANNEL_ENABLE;
+
+	writel(val, espi->regs + ESPI_SLAVE0_CONFIG);
+}
+
+static void spacemit_espi_program_window(struct spacemit_espi *espi)
+{
+	u32 val;
+
+	val = readl(espi->regs + ESPI_GLOBAL_CONTROL_0);
+	val &= ~(ESPI_CONTROL_WATCHDOG_CNT_MASK | ESPI_MST_STOP_EN);
+	val |= ESPI_CONTROL_WATCHDOG_EN;
+	val |= FIELD_PREP(ESPI_CONTROL_WATCHDOG_CNT_MASK,
+			  espi->watchdog_timeout);
+	if (espi->auto_gating)
+		val |= ESPI_MST_STOP_EN;
+	writel(val, espi->regs + ESPI_GLOBAL_CONTROL_0);
+
+	writel(espi->pr_mem_base0, espi->regs + ESPI_PR_BASE_ADDR_MEM0);
+	writel(espi->pr_mem_base1, espi->regs + ESPI_PR_BASE_ADDR_MEM1);
+}
+
+static int spacemit_espi_parse_dt(struct platform_device *pdev,
+				  struct spacemit_espi *espi)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	struct resource range;
+	const char *str;
+	u32 value;
+	int ret;
+
+	espi->op_freq_mhz = SPACEMIT_ESPI_DEFAULT_FREQ_MHZ;
+	of_property_read_u32(np, "operating-frequency", &espi->op_freq_mhz);
+
+	espi->watchdog_timeout = SPACEMIT_ESPI_DEFAULT_WDT;
+	of_property_read_u32(np, "watchdog-timeout", &espi->watchdog_timeout);
+
+	ret = of_range_to_resource(np, 0, &range);
+	if (!ret)
+		espi->pr_mem_base0 = lower_32_bits(range.start);
+
+	if (!of_property_read_u32(np, "pr-mem-base0", &value))
+		espi->pr_mem_base0 = value;
+
+	if (!espi->pr_mem_base0)
+		dev_warn(dev, "missing PR memory base, shared window recovery may fail\n");
+
+	if (!of_property_read_u32(np, "pr-mem-base1", &value))
+		espi->pr_mem_base1 = value;
+	else if (espi->pr_mem_base0)
+		espi->pr_mem_base1 = espi->pr_mem_base0 + SZ_16M;
+
+	if (!of_property_read_string(np, "io-mode", &str)) {
+		if (!strcmp(str, "quad"))
+			espi->io_mode = ESPI_GEN_IO_MODE_QUAD;
+		else if (!strcmp(str, "dual"))
+			espi->io_mode = ESPI_GEN_IO_MODE_DUAL;
+		else
+			espi->io_mode = ESPI_GEN_IO_MODE_SINGLE;
+	} else {
+		espi->io_mode = ESPI_GEN_IO_MODE_SINGLE;
+	}
+
+	if (!of_property_read_string(np, "alert-mode", &str))
+		espi->alert_pin_mode = !strcmp(str, "pin");
+	else
+		espi->alert_pin_mode = false;
+
+	if (!of_property_read_string(np, "alert-type", &str))
+		espi->alert_open_drain = !strcmp(str, "open-drain");
+	else
+		espi->alert_open_drain = true;
+
+	espi->crc_enable = spacemit_espi_property_enabled(np, "crc-enable", true);
+	espi->enable_peri = spacemit_espi_property_enabled(np,
+							   "peripheral-channel-enable",
+							   true);
+	espi->enable_vwire = spacemit_espi_property_enabled(np,
+							    "vwire-channel-enable",
+							    true);
+	espi->enable_oob = spacemit_espi_property_enabled(np,
+							  "oob-channel-enable",
+							  true);
+	espi->enable_flash = spacemit_espi_property_enabled(np,
+							    "flash-channel-enable",
+							    true);
+	espi->auto_gating = spacemit_espi_property_enabled(np,
+							   "auto-gating-enable",
+							   true);
+
+	return 0;
+}
+
+static int spacemit_espi_enable_clks(struct device *dev, struct spacemit_espi *espi)
+{
+	int ret;
+
+	if (!espi->num_clks || espi->clocks_enabled)
+		return 0;
+
+	ret = clk_bulk_prepare_enable(espi->num_clks, espi->clks);
+	if (ret) {
+		dev_err(dev, "failed to enable clocks: %d\n", ret);
+		return ret;
+	}
+
+	espi->clocks_enabled = true;
+	return 0;
+}
+
+static void spacemit_espi_disable_clks(struct spacemit_espi *espi)
+{
+	if (!espi->num_clks || !espi->clocks_enabled)
+		return;
+
+	clk_bulk_disable_unprepare(espi->num_clks, espi->clks);
+	espi->clocks_enabled = false;
+}
+
+static int spacemit_espi_init_locked(struct spacemit_espi *espi)
+{
+	u32 slave_caps = 0;
+	u32 cfg;
+	int ret;
+
+	/*
+	 * Clear the cached link state before starting a new recovery cycle so
+	 * callers never observe a stale "ready" state after an early failure.
+	 */
+	espi->initialized = false;
+	espi->slave_ready = false;
+
+	ret = spacemit_espi_enable_clks(espi->dev, espi);
+	if (ret)
+		return ret;
+
+	ret = reset_control_deassert(espi->resets);
+	if (ret)
+		return ret;
+
+	if (espi->sclk && !IS_ERR(espi->sclk) && espi->op_freq_mhz) {
+		ret = clk_set_rate(espi->sclk, espi->op_freq_mhz * 1000000UL);
+		if (ret)
+			dev_dbg(espi->dev, "failed to set sclk rate: %d\n", ret);
+	}
+
+	spacemit_espi_enable_irqs(espi);
+	writel(ESPI_ALL_INT, espi->regs + ESPI_SLAVE0_INT_STS);
+
+	spacemit_espi_reset_controller(espi);
+	spacemit_espi_send_inband_reset(espi);
+
+	ret = spacemit_espi_cmd_get_config(espi, ESPI_SLAVE_GEN_CFG, &slave_caps);
+	if (ret) {
+		cfg = spacemit_espi_build_master_only_config(espi);
+		espi->slave_ready = false;
+		dev_warn(espi->dev, "slave capability negotiation failed: %d\n", ret);
+	} else {
+		cfg = spacemit_espi_build_negotiated_config(espi, slave_caps);
+		ret = spacemit_espi_configure_channels(espi, cfg);
+		if (ret) {
+			dev_warn(espi->dev, "channel configuration failed: %d\n", ret);
+			cfg = spacemit_espi_build_master_only_config(espi);
+			espi->slave_ready = false;
+		} else {
+			ret = spacemit_espi_cmd_set_config(espi, ESPI_SLAVE_GEN_CFG, cfg);
+			if (ret) {
+				dev_warn(espi->dev, "general configuration failed: %d\n", ret);
+				cfg = spacemit_espi_build_master_only_config(espi);
+				espi->slave_ready = false;
+			} else {
+				espi->slave_ready = true;
+			}
+		}
+	}
+
+	spacemit_espi_apply_controller_config(espi, cfg);
+	spacemit_espi_program_window(espi);
+	espi->initialized = true;
+
+	dev_dbg(espi->dev, "controller ready, slave_ready=%d master_cap=0x%08x\n",
+		espi->slave_ready,
+		readl(espi->regs + ESPI_MASTER_CAP));
+
+	return 0;
+}
+
+/**
+ * spacemit_k3_espi_recover() - Reinitialize the controller and negotiate the link
+ * @dev: K3 eSPI controller device
+ *
+ * Context: Process context. This function may sleep.
+ * Return: 0 on success or a negative error code.
+ */
+int spacemit_k3_espi_recover(struct device *dev)
+{
+	struct spacemit_espi *espi;
+	int ret;
+
+	if (!dev)
+		return -EINVAL;
+
+	espi = dev_get_drvdata(dev);
+	if (!espi)
+		return -ENODEV;
+
+	mutex_lock(&espi->lock);
+	ret = spacemit_espi_init_locked(espi);
+	mutex_unlock(&espi->lock);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(spacemit_k3_espi_recover);
+
+static void spacemit_espi_cleanup(void *data)
+{
+	struct spacemit_espi *espi = data;
+
+	reset_control_assert(espi->resets);
+	spacemit_espi_disable_clks(espi);
+}
+
+static int spacemit_espi_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct spacemit_espi *espi;
+	struct resource *res;
+	int ret;
+
+	espi = devm_kzalloc(dev, sizeof(*espi), GFP_KERNEL);
+	if (!espi)
+		return -ENOMEM;
+
+	espi->dev = dev;
+	mutex_init(&espi->lock);
+
+	espi->num_clks = devm_clk_bulk_get_all(dev, &espi->clks);
+	if (espi->num_clks < 0)
+		return dev_err_probe(dev, espi->num_clks,
+				     "failed to get clocks\n");
+
+	espi->sclk = devm_clk_get_optional(dev, "sclk");
+	if (IS_ERR(espi->sclk))
+		return dev_err_probe(dev, PTR_ERR(espi->sclk),
+				     "failed to get sclk\n");
+
+	espi->resets = devm_reset_control_array_get_optional_exclusive(dev);
+	if (IS_ERR(espi->resets))
+		return dev_err_probe(dev, PTR_ERR(espi->resets),
+				     "failed to get resets\n");
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	espi->regs = devm_ioremap_resource(dev, res);
+	if (IS_ERR(espi->regs))
+		return PTR_ERR(espi->regs);
+
+	spacemit_espi_parse_dt(pdev, espi);
+	platform_set_drvdata(pdev, espi);
+
+	ret = spacemit_espi_enable_clks(dev, espi);
+	if (ret)
+		return ret;
+
+	ret = reset_control_deassert(espi->resets);
+	if (ret) {
+		dev_err_probe(dev, ret, "failed to deassert resets\n");
+		goto err_disable_clks;
+	}
+
+	ret = devm_add_action_or_reset(dev, spacemit_espi_cleanup, espi);
+	if (ret)
+		return ret;
+
+	ret = spacemit_k3_espi_recover(dev);
+	if (ret)
+		dev_warn(dev, "controller init failed, keeping bootloader state: %d\n",
+			 ret);
+
+	ret = devm_of_platform_populate(dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to populate child devices\n");
+
+	return 0;
+
+err_disable_clks:
+	spacemit_espi_disable_clks(espi);
+	return ret;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int spacemit_espi_suspend_noirq(struct device *dev)
+{
+	struct spacemit_espi *espi = dev_get_drvdata(dev);
+
+	spacemit_espi_disable_clks(espi);
+	return 0;
+}
+
+static int spacemit_espi_resume_noirq(struct device *dev)
+{
+	return spacemit_k3_espi_recover(dev);
+}
+#endif
+
+static const struct dev_pm_ops spacemit_espi_pm_ops = {
+	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(spacemit_espi_suspend_noirq,
+				      spacemit_espi_resume_noirq)
+};
+
+static const struct of_device_id spacemit_espi_of_match[] = {
+	{ .compatible = "spacemit,k3-espi" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, spacemit_espi_of_match);
+
+static struct platform_driver spacemit_espi_driver = {
+	.probe = spacemit_espi_probe,
+	.driver = {
+		.name = "spacemit-k3-espi",
+		.of_match_table = spacemit_espi_of_match,
+		.pm = pm_ptr(&spacemit_espi_pm_ops),
+	},
+};
+module_platform_driver(spacemit_espi_driver);
+
+MODULE_DESCRIPTION("SpacemiT K3 eSPI controller driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/spacemit-k3-espi.h b/include/linux/spacemit-k3-espi.h
new file mode 100644
index 000000000..a2a75e2b7
--- /dev/null
+++ b/include/linux/spacemit-k3-espi.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _LINUX_SPACEMIT_K3_ESPI_H
+#define _LINUX_SPACEMIT_K3_ESPI_H
+
+#include <linux/errno.h>
+#include <linux/kconfig.h>
+
+struct device;
+
+#if IS_ENABLED(CONFIG_SPACEMIT_ESPI_BUS)
+int spacemit_k3_espi_recover(struct device *dev);
+#else
+static inline int spacemit_k3_espi_recover(struct device *dev)
+{
+	return -EOPNOTSUPP;
+}
+#endif
+
+#endif /* _LINUX_SPACEMIT_K3_ESPI_H */
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/9] platform/chrome: Allow ChromeOS platform support on RISC-V
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
                   ` (2 preceding siblings ...)
  2026-11-18  8:57 ` [PATCH 3/9] bus: Add SpacemiT K3 eSPI controller support Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18  8:57 ` [PATCH 5/9] platform/chrome: Add SpacemiT K3 eSPI EC transport Wang Yang
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Expose the ChromeOS EC configuration menu on RISC-V so boards using an
EC over a supported transport can select the common protocol and input
drivers. Individual transport dependencies remain in effect.

Prepared with Codex assistance from the existing DC-linux EC support.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 drivers/platform/chrome/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig
index ca2e84420..6beda4655 100644
--- a/drivers/platform/chrome/Kconfig
+++ b/drivers/platform/chrome/Kconfig
@@ -5,7 +5,7 @@
 
 menuconfig CHROME_PLATFORMS
 	bool "Platform support for Chrome hardware"
-	depends on X86 || ARM || ARM64 || COMPILE_TEST
+	depends on X86 || ARM || ARM64 || RISCV || COMPILE_TEST
 	depends on !CPU_BIG_ENDIAN || COMPILE_TEST
 	help
 	  Say Y here to get to see options for platform support for
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 5/9] platform/chrome: Add SpacemiT K3 eSPI EC transport
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
                   ` (3 preceding siblings ...)
  2026-11-18  8:57 ` [PATCH 4/9] platform/chrome: Allow ChromeOS platform support on RISC-V Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18  8:57 ` [PATCH 6/9] riscv: dts: spacemit: Add K3 eSPI pin group Wang Yang
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Add the K3-specific EC transport as a separate driver. Use a vendor-
scoped Kconfig symbol, module name and compatible. The register mapping
and recovery API are tied to the SpacemiT K3 controller, so this does
not claim to be a generic eSPI EC transport.

Preserve the original independent eSPI command and event logic. Existing
EC core, LPC, protocol and keyboard implementations remain unchanged.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 drivers/platform/chrome/Kconfig               |  11 +
 drivers/platform/chrome/Makefile              |   1 +
 drivers/platform/chrome/cros_ec_spacemit_k3.c | 739 ++++++++++++++++++
 3 files changed, 751 insertions(+)
 create mode 100644 drivers/platform/chrome/cros_ec_spacemit_k3.c

diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig
index 6beda4655..10933f7af 100644
--- a/drivers/platform/chrome/Kconfig
+++ b/drivers/platform/chrome/Kconfig
@@ -154,6 +154,17 @@ config CROS_EC_LPC
 	  To compile this driver as a module, choose M here: the
 	  module will be called cros_ec_lpcs.
 
+config CROS_EC_SPACEMIT_K3
+	tristate "SpacemiT K3 ChromeOS EC over eSPI"
+	depends on CROS_EC && SPACEMIT_ESPI_BUS
+	help
+	  Support a ChromeOS EC connected through the SpacemiT K3 eSPI
+	  peripheral shared-memory window. The transport supports host
+	  command protocol versions 2 and 3 and EC event interrupts.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called cros_ec_spacemit_k3.
+
 config CROS_EC_PROTO
 	tristate
 	help
diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Makefile
index b981a1bb5..e3357a6bc 100644
--- a/drivers/platform/chrome/Makefile
+++ b/drivers/platform/chrome/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_CROS_EC_I2C)		+= cros_ec_i2c.o
 obj-$(CONFIG_CROS_EC_ISHTP)		+= cros_ec_ishtp.o
 obj-$(CONFIG_CROS_TYPEC_SWITCH)		+= cros_typec_switch.o
 obj-$(CONFIG_CROS_EC_RPMSG)		+= cros_ec_rpmsg.o
+obj-$(CONFIG_CROS_EC_SPACEMIT_K3)		+= cros_ec_spacemit_k3.o
 obj-$(CONFIG_CROS_EC_SPI)		+= cros_ec_spi.o
 obj-$(CONFIG_CROS_EC_UART)		+= cros_ec_uart.o
 cros_ec_lpcs-objs			:= cros_ec_lpc.o cros_ec_lpc_mec.o
diff --git a/drivers/platform/chrome/cros_ec_spacemit_k3.c b/drivers/platform/chrome/cros_ec_spacemit_k3.c
new file mode 100644
index 000000000..b3010e2bf
--- /dev/null
+++ b/drivers/platform/chrome/cros_ec_spacemit_k3.c
@@ -0,0 +1,739 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * ChromeOS EC interface for the SpacemiT K3 eSPI controller
+ *
+ * Copyright (c) 2012 The Chromium OS Authors.
+ * Copyright (c) 2024 SpacemiT, Inc.
+ *
+ * This driver provides the SpacemiT K3 eSPI window for ChromeOS EC communication.
+ * It converts LPC I/O port accesses to eSPI shared memory accesses while maintaining
+ * compatibility with the existing ChromeOS EC protocol stack.
+ */
+
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/platform_data/cros_ec_commands.h>
+#include <linux/platform_data/cros_ec_proto.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/spacemit-k3-espi.h>
+#include <linux/suspend.h>
+
+#include "cros_ec.h"
+
+#define DRV_NAME "cros_ec_spacemit_k3"
+
+/* eSPI shared memory access timeout */
+#define ESPI_CMD_TIMEOUT_MS 5000
+/*
+ * After an EC reboot the transport may recover well before the EC firmware
+ * finishes repopulating the shared memory window. Allow a longer grace period
+ * here so the first post-reboot command does not immediately fall into another
+ * full timeout cycle.
+ */
+#define ESPI_READY_TIMEOUT_MS 20000
+#define ESPI_READY_POLL_INTERVAL_US 20000
+#define ESPI_RECOVERY_RETRY_INTERVAL_MS 5000
+#define ESPI_INVALID_STATUS_VALUE 0xff
+#define ESPI_INVALID_STATUS_MAX_POLLS 5
+
+/*
+ * eSPI Shared Memory Address Mapping for EC Communication
+ *
+ * This driver converts LPC I/O port accesses to eSPI shared memory accesses.
+ * The original LPC addresses are mapped to offsets within the eSPI shared memory region.
+ *
+ * Address Mapping Strategy:
+ * - LPC addresses are mapped to shared memory offsets
+ * - The mapping preserves the relative layout and functionality of the original LPC interface
+ * - All accesses go through espi_shared_mem_base + offset
+ *
+ * Memory Layout in eSPI Shared Memory:
+ * 0x000: Host command register (EC_LPC_ADDR_HOST_CMD -> 0x000)
+ * 0x001: Host data register (EC_LPC_ADDR_HOST_DATA -> 0x001)
+ * 0x010-0x017: Host arguments (8 bytes)
+ * 0x018-0x0FF: Host parameters (up to 232 bytes)
+ * 0x100-0x1FF: Packet data area (256 bytes for protocol v3)
+ * 0x200-0x2FF: Memory map region (256 bytes)
+ */
+
+/* eSPI shared memory offsets */
+#define ESPI_HOST_CMD_OFFSET 0x000 /* EC_LPC_ADDR_HOST_CMD -> 0x000 */
+#define ESPI_HOST_DATA_OFFSET 0x001 /* EC_LPC_ADDR_HOST_DATA -> 0x001 */
+#define ESPI_HOST_ARGS_OFFSET 0x010 /* EC_LPC_ADDR_HOST_ARGS -> 0x010 */
+#define ESPI_HOST_PARAM_OFFSET 0x018 /* EC_LPC_ADDR_HOST_PARAM -> 0x018 */
+#define ESPI_HOST_PACKET_OFFSET 0x100 /* EC_LPC_ADDR_HOST_PACKET -> 0x100 */
+#define ESPI_MEMMAP_OFFSET 0x200 /* EC_LPC_ADDR_MEMMAP -> 0x200 */
+
+/**
+ * struct cros_ec_espi - eSPI device-specific data
+ * @espi_shared_mem_base: Base address of eSPI shared memory region
+ * @mmio_memory_base: The first I/O port addressing EC mapped memory
+ * @io_mutex: Mutex to protect eSPI shared memory access
+ */
+struct cros_ec_espi {
+	void __iomem *espi_shared_mem_base;
+	u16 mmio_memory_base;
+	/* Serialize shared-window accesses and link recovery. */
+	struct mutex io_mutex;
+};
+
+/* Convert LPC address to eSPI shared memory offset */
+static inline u32 lpc_to_espi_offset(struct cros_ec_device *ec, u32 lpc_addr)
+{
+	switch (lpc_addr & 0xFF00) {
+	case 0x200: /* HOST_CMD/DATA region */
+		if (lpc_addr == EC_LPC_ADDR_HOST_CMD)
+			return ESPI_HOST_CMD_OFFSET;
+		else if (lpc_addr == EC_LPC_ADDR_HOST_DATA)
+			return ESPI_HOST_DATA_OFFSET;
+		break;
+	case 0x800: /* HOST_ARGS/PARAM/PACKET region */
+		/* Protocols 2 and 3 use the same LPC addresses. */
+		if (ec->proto_version > 2)
+			return ESPI_HOST_PACKET_OFFSET +
+			       (lpc_addr - EC_LPC_ADDR_HOST_PACKET);
+		else if (lpc_addr >= EC_LPC_ADDR_HOST_ARGS &&
+			 lpc_addr < EC_LPC_ADDR_HOST_PARAM)
+			return ESPI_HOST_ARGS_OFFSET +
+			       (lpc_addr - EC_LPC_ADDR_HOST_ARGS);
+		else if (lpc_addr >= EC_LPC_ADDR_HOST_PARAM)
+			return ESPI_HOST_PARAM_OFFSET +
+			       (lpc_addr - EC_LPC_ADDR_HOST_PARAM);
+		break;
+	case 0x900: /* MEMMAP region */
+		return ESPI_MEMMAP_OFFSET + (lpc_addr - EC_LPC_ADDR_MEMMAP);
+	}
+
+	/* Default mapping for unknown addresses */
+	pr_warn_once("Unknown LPC address 0x%x, using direct offset\n",
+		     lpc_addr);
+	return lpc_addr & 0xFF;
+}
+
+/* Return the checksum of the bytes read from the peripheral window. */
+static int cros_ec_espi_read_bytes(struct cros_ec_device *ec,
+				   unsigned int offset, unsigned int length,
+				   u8 *dest)
+{
+	struct cros_ec_espi *ec_espi = ec->priv;
+	void __iomem *addr;
+	u32 espi_offset;
+	u8 sum = 0;
+	int i;
+
+	mutex_lock(&ec_espi->io_mutex);
+
+	for (i = 0; i < length; ++i) {
+		espi_offset = lpc_to_espi_offset(ec, offset + i);
+		addr = ec_espi->espi_shared_mem_base + espi_offset;
+
+		/* eSPI shared memory: 1-byte access */
+		dest[i] = readb(addr);
+		sum += dest[i];
+	}
+
+	mutex_unlock(&ec_espi->io_mutex);
+
+	/* Return checksum of all bytes read */
+	return sum;
+}
+
+/* Return the checksum of the bytes written to the peripheral window. */
+static int cros_ec_espi_write_bytes(struct cros_ec_device *ec,
+				    unsigned int offset, unsigned int length,
+				    const u8 *msg)
+{
+	struct cros_ec_espi *ec_espi = ec->priv;
+	void __iomem *addr;
+	u32 espi_offset;
+	u8 sum = 0;
+	int i;
+
+	mutex_lock(&ec_espi->io_mutex);
+
+	for (i = 0; i < length; ++i) {
+		espi_offset = lpc_to_espi_offset(ec, offset + i);
+		addr = ec_espi->espi_shared_mem_base + espi_offset;
+
+		/* eSPI shared memory: 1-byte access */
+		writeb(msg[i], addr);
+		sum += msg[i];
+	}
+
+	mutex_unlock(&ec_espi->io_mutex);
+
+	/* Return checksum of all bytes written */
+	return sum;
+}
+
+static int ec_response_timed_out(struct cros_ec_device *ec)
+{
+	unsigned long timeout = jiffies + msecs_to_jiffies(ESPI_CMD_TIMEOUT_MS);
+	unsigned int invalid_status_polls = 0;
+	u8 data;
+	int ret;
+
+	usleep_range(200, 300);
+	do {
+		ret = cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_HOST_CMD, 1, &data);
+		if (ret < 0)
+			return ret;
+
+		if (!(data & EC_LPC_STATUS_BUSY_MASK))
+			return 0;
+
+		/*
+		 * While the EC is rebooting the shared window reads back as 0xff.
+		 * Escalate to controller recovery quickly instead of burning the
+		 * whole command timeout on an absent endpoint.
+		 */
+		if (data == ESPI_INVALID_STATUS_VALUE) {
+			if (++invalid_status_polls >= ESPI_INVALID_STATUS_MAX_POLLS)
+				return 1;
+		} else {
+			invalid_status_polls = 0;
+		}
+
+		usleep_range(100, 200);
+	} while (time_before(jiffies, timeout));
+
+	return 1;
+}
+
+static bool cros_ec_espi_valid_id(const u8 *buf)
+{
+	return buf[0] == 'E' && buf[1] == 'C';
+}
+
+static int cros_ec_espi_read_id(struct cros_ec_device *ec, u8 *buf)
+{
+	return cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf);
+}
+
+static int cros_ec_espi_recover_bus(struct cros_ec_device *ec)
+{
+	struct cros_ec_espi *ec_espi = ec->priv;
+	int ret;
+
+	mutex_lock(&ec_espi->io_mutex);
+	ret = spacemit_k3_espi_recover(ec->dev->parent);
+	mutex_unlock(&ec_espi->io_mutex);
+
+	return ret;
+}
+
+static int cros_ec_espi_wait_ready(struct cros_ec_device *ec, const char *reason)
+{
+	struct device *dev = ec->dev;
+	unsigned long timeout = jiffies + msecs_to_jiffies(ESPI_READY_TIMEOUT_MS);
+	unsigned long next_recover =
+		jiffies + msecs_to_jiffies(ESPI_RECOVERY_RETRY_INTERVAL_MS);
+	u8 buf[2] = {};
+	int ret = 0;
+
+	do {
+		ret = cros_ec_espi_read_id(ec, buf);
+		if (ret >= 0 && cros_ec_espi_valid_id(buf))
+			return 0;
+
+		/*
+		 * The first recover may happen while the EC is still updating and
+		 * leave the controller in a master-only state. Retry link recovery
+		 * periodically while waiting so we can renegotiate as soon as the
+		 * EC starts responding again.
+		 */
+		if (time_after_eq(jiffies, next_recover)) {
+			ret = cros_ec_espi_recover_bus(ec);
+			if (ret)
+				dev_dbg(dev, "background eSPI recovery failed: %d\n", ret);
+			next_recover = jiffies +
+				msecs_to_jiffies(ESPI_RECOVERY_RETRY_INTERVAL_MS);
+			continue;
+		}
+
+		usleep_range(ESPI_READY_POLL_INTERVAL_US,
+			     ESPI_READY_POLL_INTERVAL_US + 10000);
+	} while (time_before(jiffies, timeout));
+
+	if (ret < 0)
+		dev_warn(dev, "EC not ready after %s: %d\n", reason, ret);
+	else
+		dev_warn(dev, "EC not ready after %s (id: 0x%02x 0x%02x)\n",
+			 reason, buf[0], buf[1]);
+
+	return ret < 0 ? ret : -ETIMEDOUT;
+}
+
+static int cros_ec_espi_recover_controller(struct cros_ec_device *ec,
+					   const char *reason)
+{
+	struct device *dev = ec->dev;
+	int ret;
+
+	if (!dev->parent)
+		return -ENODEV;
+
+	dev_warn(dev, "attempting eSPI controller recovery after %s\n", reason);
+	ret = cros_ec_espi_recover_bus(ec);
+	if (ret)
+		dev_err(dev, "eSPI controller recovery failed: %d\n", ret);
+
+	if (ret)
+		return ret;
+
+	return cros_ec_espi_wait_ready(ec, reason);
+}
+
+static int cros_ec_pkt_xfer_espi_once(struct cros_ec_device *ec,
+				      struct cros_ec_command *msg)
+{
+	struct ec_host_response response;
+	u8 sum;
+	int ret = 0;
+	u8 *dout;
+
+	/*
+	 * Give EC some time between commands to avoid overwhelming it.
+	 * This prevents timing issues when multiple commands are sent rapidly.
+	 */
+	usleep_range(500, 1000);
+
+	ret = cros_ec_prepare_tx(ec, msg);
+	if (ret < 0) {
+		dev_err(ec->dev, "cros_ec_prepare_tx failed: %d\n", ret);
+		goto done;
+	}
+
+	/* Write buffer */
+	ret = cros_ec_espi_write_bytes(ec, EC_LPC_ADDR_HOST_PACKET, ret, ec->dout);
+	if (ret < 0) {
+		dev_err(ec->dev, "Write to HOST_PACKET failed: %d\n", ret);
+		goto done;
+	}
+
+	/* Here we go */
+	sum = EC_COMMAND_PROTOCOL_3;
+	ret = cros_ec_espi_write_bytes(ec, EC_LPC_ADDR_HOST_CMD, 1, &sum);
+	if (ret < 0) {
+		dev_err(ec->dev, "Write to HOST_CMD failed: %d\n", ret);
+		goto done;
+	}
+
+	ret = ec_response_timed_out(ec);
+	if (ret < 0) {
+		dev_err(ec->dev, "ec_response_timed_out failed: %d\n", ret);
+		goto done;
+	}
+	if (ret) {
+		dev_warn(ec->dev, "EC response timed out\n");
+		ret = -ETIMEDOUT;
+		goto done;
+	}
+
+	/* Check result */
+	ret = cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_HOST_DATA, 1, &sum);
+	if (ret < 0) {
+		dev_err(ec->dev, "Read from HOST_DATA failed: %d\n", ret);
+		goto done;
+	}
+
+	msg->result = sum;
+	ret = cros_ec_check_result(ec, msg);
+	if (ret) {
+		dev_err(ec->dev, "cros_ec_check_result failed: %d\n", ret);
+		goto done;
+	}
+
+	/* Read back response */
+	dout = (u8 *)&response;
+	ret = cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_HOST_PACKET, sizeof(response),
+				      dout);
+	if (ret < 0) {
+		dev_err(ec->dev, "Read response header failed: %d\n", ret);
+		goto done;
+	}
+	sum = ret;
+
+	msg->result = response.result;
+
+	if (response.data_len > msg->insize) {
+		dev_err(ec->dev, "packet too long (%d bytes, expected %d)",
+			response.data_len, msg->insize);
+		ret = -EMSGSIZE;
+		goto done;
+	}
+
+	/* Read response and process checksum */
+	ret = cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_HOST_PACKET + sizeof(response),
+				      response.data_len, msg->data);
+	if (ret < 0) {
+		dev_err(ec->dev, "Read response data failed: %d\n", ret);
+		goto done;
+	}
+	sum += ret;
+
+	if (sum) {
+		dev_err(ec->dev, "bad packet checksum %02x\n",
+			response.checksum);
+		ret = -EBADMSG;
+		goto done;
+	}
+
+	/* Return actual amount of data received */
+	ret = response.data_len;
+done:
+	return ret;
+}
+
+static int cros_ec_espi_xfer_retry(struct cros_ec_device *ec,
+				   struct cros_ec_command *msg,
+				   int (*xfer_once)(struct cros_ec_device *ec,
+						    struct cros_ec_command *msg),
+				   const char *name)
+{
+	int ret;
+
+	ret = xfer_once(ec, msg);
+	if (ret != -ETIMEDOUT)
+		return ret;
+
+	if (cros_ec_espi_recover_controller(ec, name))
+		return ret;
+
+	dev_dbg(ec->dev, "eSPI controller recovered, retrying %s\n", name);
+	return xfer_once(ec, msg);
+}
+
+static int cros_ec_pkt_xfer_espi(struct cros_ec_device *ec,
+				 struct cros_ec_command *msg)
+{
+	return cros_ec_espi_xfer_retry(ec, msg, cros_ec_pkt_xfer_espi_once,
+				       "packet transfer timeout");
+}
+
+static int cros_ec_cmd_xfer_espi_once(struct cros_ec_device *ec,
+				      struct cros_ec_command *msg)
+{
+	struct ec_lpc_host_args args;
+	u8 sum;
+	int ret = 0;
+
+	if (msg->outsize > EC_PROTO2_MAX_PARAM_SIZE ||
+	    msg->insize > EC_PROTO2_MAX_PARAM_SIZE) {
+		dev_err(ec->dev, "invalid buffer sizes (out %d, in %d)\n",
+			msg->outsize, msg->insize);
+		return -EINVAL;
+	}
+
+	/*
+	 * Give EC some time between commands to avoid overwhelming it.
+	 * This prevents timing issues when multiple commands are sent rapidly.
+	 */
+	usleep_range(500, 1000);
+
+	/* Now actually send the command to the EC and get the result */
+	args.flags = EC_HOST_ARGS_FLAG_FROM_HOST;
+	args.command_version = msg->version;
+	args.data_size = msg->outsize;
+
+	/* Initialize checksum */
+	sum = msg->command + args.flags + args.command_version + args.data_size;
+
+	/* Copy data and update checksum */
+	ret = cros_ec_espi_write_bytes(ec, EC_LPC_ADDR_HOST_PARAM, msg->outsize,
+				       msg->data);
+	if (ret < 0) {
+		dev_err(ec->dev, "Write to HOST_PARAM failed: %d\n", ret);
+		goto done;
+	}
+	sum += ret;
+
+	/* Finalize checksum and write args */
+	args.checksum = sum;
+	ret = cros_ec_espi_write_bytes(ec, EC_LPC_ADDR_HOST_ARGS, sizeof(args),
+				       (u8 *)&args);
+	if (ret < 0) {
+		dev_err(ec->dev, "Write to HOST_ARGS failed: %d\n", ret);
+		goto done;
+	}
+
+	/* Here we go */
+	sum = msg->command;
+	ret = cros_ec_espi_write_bytes(ec, EC_LPC_ADDR_HOST_CMD, 1, &sum);
+	if (ret < 0) {
+		dev_err(ec->dev, "Write to HOST_CMD failed: %d\n", ret);
+		goto done;
+	}
+
+	ret = ec_response_timed_out(ec);
+	if (ret < 0) {
+		dev_err(ec->dev, "ec_response_timed_out failed: %d\n", ret);
+		goto done;
+	}
+	if (ret) {
+		dev_warn(ec->dev, "EC response timed out\n");
+		ret = -ETIMEDOUT;
+		goto done;
+	}
+
+	/* Check result */
+	ret = cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_HOST_DATA, 1, &sum);
+	if (ret < 0) {
+		dev_err(ec->dev, "Read from HOST_DATA failed: %d\n", ret);
+		goto done;
+	}
+
+	msg->result = sum;
+	ret = cros_ec_check_result(ec, msg);
+	if (ret) {
+		dev_err(ec->dev, "cros_ec_check_result failed: %d\n", ret);
+		goto done;
+	}
+
+	/* Read back args */
+	ret = cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_HOST_ARGS, sizeof(args),
+				      (u8 *)&args);
+	if (ret < 0) {
+		dev_err(ec->dev, "Read HOST_ARGS failed: %d\n", ret);
+		goto done;
+	}
+
+	if (args.data_size > msg->insize) {
+		dev_err(ec->dev, "packet too long (%d bytes, expected %d)",
+			args.data_size, msg->insize);
+		ret = -ENOSPC;
+		goto done;
+	}
+
+	/* Start calculating response checksum */
+	sum = msg->command + args.flags + args.command_version + args.data_size;
+
+	/* Read response and update checksum */
+	ret = cros_ec_espi_read_bytes(ec, EC_LPC_ADDR_HOST_PARAM, args.data_size,
+				      msg->data);
+	if (ret < 0) {
+		dev_err(ec->dev, "Read response data failed: %d\n", ret);
+		goto done;
+	}
+	sum += ret;
+
+	/* Verify checksum */
+	if (args.checksum != sum) {
+		dev_err(ec->dev,
+			"bad packet checksum, expected %02x, got %02x\n",
+			args.checksum, sum);
+		ret = -EBADMSG;
+		goto done;
+	}
+
+	/* Return actual amount of data received */
+	ret = args.data_size;
+done:
+	return ret;
+}
+
+static int cros_ec_cmd_xfer_espi(struct cros_ec_device *ec,
+				 struct cros_ec_command *msg)
+{
+	return cros_ec_espi_xfer_retry(ec, msg, cros_ec_cmd_xfer_espi_once,
+				       "command transfer timeout");
+}
+
+/* Returns num bytes read, or negative on error. Doesn't need locking. */
+static int cros_ec_espi_readmem(struct cros_ec_device *ec, unsigned int offset,
+				unsigned int bytes, void *dest)
+{
+	struct cros_ec_espi *ec_espi = ec->priv;
+	int i = offset;
+	char *s = dest;
+	int cnt = 0;
+	int ret;
+
+	if (offset >= EC_MEMMAP_SIZE || bytes > EC_MEMMAP_SIZE - offset)
+		return -EINVAL;
+
+	/* fixed length */
+	if (bytes) {
+		ret = cros_ec_espi_read_bytes(ec, ec_espi->mmio_memory_base + offset,
+					      bytes, s);
+		if (ret < 0)
+			return ret;
+		return bytes;
+	}
+
+	/* string */
+	for (; i < EC_MEMMAP_SIZE; i++, s++) {
+		ret = cros_ec_espi_read_bytes(ec, ec_espi->mmio_memory_base + i, 1,
+					      s);
+		if (ret < 0)
+			return ret;
+		cnt++;
+		if (!*s)
+			break;
+	}
+
+	return cnt;
+}
+
+static irqreturn_t cros_ec_espi_irq_handler(int irq, void *data)
+{
+	struct cros_ec_device *ec_dev = data;
+
+	ec_dev->last_event_time = cros_ec_get_time_ns();
+
+	return IRQ_WAKE_THREAD;
+}
+
+static int cros_ec_espi_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cros_ec_device *ec;
+	struct cros_ec_espi *ec_espi;
+	struct resource *res;
+	u8 id[2];
+	int irq, ret;
+
+	ec_espi = devm_kzalloc(dev, sizeof(*ec_espi), GFP_KERNEL);
+	if (!ec_espi)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res || resource_size(res) < 0x300)
+		return -EINVAL;
+	ec_espi->espi_shared_mem_base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(ec_espi->espi_shared_mem_base))
+		return PTR_ERR(ec_espi->espi_shared_mem_base);
+
+	ec_espi->mmio_memory_base = EC_LPC_ADDR_MEMMAP;
+	mutex_init(&ec_espi->io_mutex);
+
+	ec = cros_ec_device_alloc(dev);
+	if (!ec)
+		return -ENOMEM;
+
+	ec->phys_name = dev_name(dev);
+	ec->cmd_xfer = cros_ec_cmd_xfer_espi;
+	ec->pkt_xfer = cros_ec_pkt_xfer_espi;
+	ec->cmd_readmem = cros_ec_espi_readmem;
+	ec->priv = ec_espi;
+	platform_set_drvdata(pdev, ec);
+
+	ret = cros_ec_espi_read_id(ec, id);
+	if (ret < 0 || !cros_ec_espi_valid_id(id)) {
+		ret = cros_ec_espi_recover_controller(ec, "EC detection");
+		if (ret)
+			return dev_err_probe(dev, ret, "EC is not ready\n");
+	}
+
+	/* The EC still initializes its command window after publishing its ID. */
+	msleep(100);
+
+	irq = platform_get_irq_optional(pdev, 0);
+	if (irq < 0 && irq != -ENXIO)
+		return irq;
+
+	/* Keep IRQ ownership here; the core requests a fixed low-level IRQ. */
+	ret = cros_ec_register(ec);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to register EC\n");
+
+	if (irq > 0) {
+		ec->irq = irq;
+		ret = devm_request_threaded_irq(dev, irq, cros_ec_espi_irq_handler,
+						cros_ec_irq_thread, IRQF_ONESHOT,
+						"chromeos-ec", ec);
+		if (ret) {
+			cros_ec_unregister(ec);
+			return dev_err_probe(dev, ret, "failed to request EC IRQ\n");
+		}
+
+		/* Drain events queued before the edge-triggered IRQ was ready. */
+		if (ec->mkbp_event_supported)
+			cros_ec_irq_thread(irq, ec);
+	}
+
+	return 0;
+}
+
+static void cros_ec_espi_remove(struct platform_device *pdev)
+{
+	struct cros_ec_device *ec = platform_get_drvdata(pdev);
+
+	if (ec->irq > 0)
+		devm_free_irq(&pdev->dev, ec->irq, ec);
+	cros_ec_unregister(ec);
+}
+
+static const struct of_device_id cros_ec_espi_of_match[] = {
+	{ .compatible = "spacemit,k3-cros-ec" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, cros_ec_espi_of_match);
+
+#ifdef CONFIG_PM_SLEEP
+static int cros_ec_espi_prepare(struct device *dev)
+{
+	struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
+
+	return cros_ec_suspend_prepare(ec_dev);
+}
+
+static void cros_ec_espi_complete(struct device *dev)
+{
+	struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
+
+	cros_ec_resume_complete(ec_dev);
+}
+
+static int cros_ec_espi_suspend_late(struct device *dev)
+{
+	struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
+
+	return cros_ec_suspend_late(ec_dev);
+}
+
+static int cros_ec_espi_resume_early(struct device *dev)
+{
+	struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
+
+	return cros_ec_resume_early(ec_dev);
+}
+#endif
+
+static const struct dev_pm_ops cros_ec_espi_pm_ops = {
+#ifdef CONFIG_PM_SLEEP
+	.prepare = cros_ec_espi_prepare,
+	.complete = cros_ec_espi_complete,
+#endif
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(cros_ec_espi_suspend_late,
+				     cros_ec_espi_resume_early)
+};
+
+static struct platform_driver cros_ec_espi_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.of_match_table = cros_ec_espi_of_match,
+		.pm = &cros_ec_espi_pm_ops,
+		/*
+		 * Child devices may probe before us, and they racily
+		 * check our drvdata pointer. Force synchronous probe until
+		 * those races are resolved.
+		 */
+		.probe_type = PROBE_FORCE_SYNCHRONOUS,
+	},
+	.probe = cros_ec_espi_probe,
+	.remove = cros_ec_espi_remove,
+};
+
+module_platform_driver(cros_ec_espi_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("SpacemiT K3 eSPI ChromeOS EC transport");
+MODULE_ALIAS("platform:" DRV_NAME);
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 6/9] riscv: dts: spacemit: Add K3 eSPI pin group
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
                   ` (4 preceding siblings ...)
  2026-11-18  8:57 ` [PATCH 5/9] platform/chrome: Add SpacemiT K3 eSPI EC transport Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18  8:57 ` [PATCH 7/9] riscv: dts: spacemit: Describe the K3 eSPI controller Wang Yang
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Describe the eSPI0 pin function on pads 91 through 98, including the
separate clock pull configuration. The group is only applied when a
board references it.

Prepared with Codex assistance from the existing DC-linux EC support.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi b/arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi
index cb4f4f4e3..5bae382fa 100644
--- a/arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi
@@ -11,6 +11,30 @@
 #define K3_GPIO(x)	(x / 32) (x % 32)
 
 &pinctrl {
+	espi0_2_cfg: espi0-2-cfg {
+		espi0-0-pins {
+			pinmux = <K3_PADCONF(91, 4)>,	/* espi0 d0 */
+				 <K3_PADCONF(92, 4)>,	/* espi0 d1 */
+				 <K3_PADCONF(93, 4)>,	/* espi0 d2 */
+				 <K3_PADCONF(94, 4)>,	/* espi0 d3 */
+				 <K3_PADCONF(95, 4)>,	/* espi0 cs */
+				 <K3_PADCONF(97, 4)>,	/* espi0 reset */
+				 <K3_PADCONF(98, 4)>;	/* espi0 alert */
+
+			bias-pull-up;			/* normal pull-up */
+			drive-strength = <25>;		/* DS8 */
+			power-source = <1800>;
+		};
+
+		espi0-1-pins {
+			pinmux = <K3_PADCONF(96, 4)>;	/* espi0 clk */
+
+			bias-pull-down;			/* normal pull-down */
+			drive-strength = <25>;		/* DS8 */
+			power-source = <1800>;
+		};
+	};
+
 	gmac0_rgmii_0_cfg: gmac0-rgmii-0-cfg {
 		gmac0-rgmii-0-pins {
 			pinmux = <K3_PADCONF(0, 1)>,	/* gmac0_rxdv */
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 7/9] riscv: dts: spacemit: Describe the K3 eSPI controller
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
                   ` (5 preceding siblings ...)
  2026-11-18  8:57 ` [PATCH 6/9] riscv: dts: spacemit: Add K3 eSPI pin group Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18  8:57 ` [PATCH 8/9] riscv: dts: spacemit: Enable the FML13V05 EC keyboard Wang Yang
  2026-11-18  8:57 ` [PATCH 9/9] riscv: defconfig: Enable the FML13V05 EC keyboard modules Wang Yang
  8 siblings, 0 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Add the disabled eSPI controller with its memory window, clock and reset
connections. Keep the board-specific EC child out of the common SoC
description. Other K3 boards remain disabled by default.

Prepared with Codex assistance from the existing DC-linux EC support.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 arch/riscv/boot/dts/spacemit/k3.dtsi | 31 ++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k3.dtsi b/arch/riscv/boot/dts/spacemit/k3.dtsi
index e89d2cc5c..d859c84bb 100644
--- a/arch/riscv/boot/dts/spacemit/k3.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k3.dtsi
@@ -648,6 +648,37 @@ gmac1_axi_setup: stmmac-axi-config {
 			};
 		};
 
+		espi0: espi@cac8c000 {
+			compatible = "spacemit,k3-espi";
+			reg = <0x0 0xcac8c000 0x0 0x1000>;
+			ranges = <0x0 0x0 0x84000000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			pr-mem-base0 = <0x84000000>;
+			pr-mem-base1 = <0xcac8c000>;
+			clocks = <&syscon_apmu CLK_APMU_ESPI_SCLK_SRC>,
+				 <&syscon_apmu CLK_APMU_ESPI_SCLK>,
+				 <&syscon_apmu CLK_APMU_ESPI_MCLK>;
+			clock-names = "sclk_src", "sclk", "mclk";
+			resets = <&syscon_apmu RESET_APMU_ESPI_MCLK>,
+				 <&syscon_apmu RESET_APMU_ESPI_SCLK>;
+			assigned-clocks = <&syscon_apmu CLK_APMU_ESPI_SCLK>;
+			assigned-clock-parents = <&syscon_apmu CLK_APMU_ESPI_SCLK_SRC>;
+			operating-frequency = <20>;
+			io-mode = "single";
+			alert-mode = "io1";
+			alert-type = "open-drain";
+			watchdog-timeout = <0xffff>;
+			crc-enable;
+			auto-gating-enable;
+			peripheral-channel-enable;
+			vwire-channel-enable;
+			oob-channel-enable;
+			flash-channel-enable;
+
+			status = "disabled";
+		};
+
 		eth2: ethernet@cac8e000 {
 			compatible = "spacemit,k3-dwmac", "snps,dwmac-5.40a";
 			reg = <0x0 0xcac8e000 0x0 0x2000>;
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 8/9] riscv: dts: spacemit: Enable the FML13V05 EC keyboard
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
                   ` (6 preceding siblings ...)
  2026-11-18  8:57 ` [PATCH 7/9] riscv: dts: spacemit: Describe the K3 eSPI controller Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  2026-11-18  8:57 ` [PATCH 9/9] riscv: defconfig: Enable the FML13V05 EC keyboard modules Wang Yang
  8 siblings, 0 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Connect the board EC to the eSPI peripheral window and GPIO43 rising-
edge interrupt. Describe the vendor 8 by 16 keyboard matrix and its Fn
mappings for the existing google,cros-ec-keyb driver.

Preserve the upstream model and compatible strings and keep the EC child
local to this board.

Prepared with Codex assistance from the existing DC-linux EC support.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 .../spacemit/k3-deepcomputing-fml13v05.dts    | 137 ++++++++++++++++++
 1 file changed, 137 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k3-deepcomputing-fml13v05.dts b/arch/riscv/boot/dts/spacemit/k3-deepcomputing-fml13v05.dts
index b5d5112de..214c8bbb5 100644
--- a/arch/riscv/boot/dts/spacemit/k3-deepcomputing-fml13v05.dts
+++ b/arch/riscv/boot/dts/spacemit/k3-deepcomputing-fml13v05.dts
@@ -3,6 +3,8 @@
  * Copyright (C) 2026 DeepComputing (HK) Limited
  */
 
+#include <dt-bindings/input/input.h>
+
 #include "k3.dtsi"
 #include "k3-pinctrl.dtsi"
 
@@ -29,3 +31,138 @@ &uart0 {
 	pinctrl-0 = <&uart0_0_cfg>;
 	status = "okay";
 };
+
+&espi0 {
+	pinctrl-0 = <&espi0_2_cfg>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	ec: ec@0 {
+		compatible = "spacemit,k3-cros-ec";
+		reg = <0x0 0x1000>;
+		interrupt-parent = <&gpio>;
+		interrupts = <1 11 IRQ_TYPE_EDGE_RISING>;
+
+		keyboard-controller {
+			compatible = "google,cros-ec-keyb";
+			keypad,num-rows = <8>;
+			keypad,num-columns = <16>;
+			linux,keymap = <
+					/* Row 0 */
+					MATRIX_KEY(0x00, 0x00, KEY_C)
+					MATRIX_KEY(0x00, 0x01, KEY_DELETE)
+					MATRIX_KEY(0x00, 0x02, KEY_Q)
+					MATRIX_KEY(0x00, 0x03, KEY_RIGHTALT)
+					MATRIX_KEY(0x00, 0x05, KEY_X)
+					MATRIX_KEY(0x00, 0x06, KEY_V)
+					MATRIX_KEY(0x00, 0x07, KEY_M)
+					MATRIX_KEY(0x00, 0x08, KEY_DOT)
+					MATRIX_KEY(0x00, 0x09, KEY_RIGHTSHIFT)
+					MATRIX_KEY(0x00, 0x0a, KEY_COMMA)
+					MATRIX_KEY(0x00, 0x0c, KEY_RIGHTCTRL)
+					MATRIX_KEY(0x00, 0x0d, KEY_SLASH)
+					MATRIX_KEY(0x00, 0x0e, KEY_APOSTROPHE)
+
+					/* Row 1 */
+					MATRIX_KEY(0x01, 0x03, KEY_LEFTALT)
+					MATRIX_KEY(0x01, 0x04, KEY_SPACE)
+					MATRIX_KEY(0x01, 0x05, KEY_Z)
+					MATRIX_KEY(0x01, 0x06, KEY_B)
+					MATRIX_KEY(0x01, 0x07, KEY_N)
+					MATRIX_KEY(0x01, 0x08, KEY_DOWN)
+					MATRIX_KEY(0x01, 0x09, KEY_LEFTSHIFT)
+					MATRIX_KEY(0x01, 0x0c, KEY_LEFTCTRL)
+					MATRIX_KEY(0x01, 0x0d, KEY_UP)
+					MATRIX_KEY(0x01, 0x0e, KEY_ENTER)
+					MATRIX_KEY(0x01, 0x0f, KEY_F8)
+
+					/* Row 2 */
+					MATRIX_KEY(0x02, 0x02, KEY_FN)
+					MATRIX_KEY(0x02, 0x04, KEY_E)
+					MATRIX_KEY(0x02, 0x05, KEY_F2)
+					MATRIX_KEY(0x02, 0x06, KEY_G)
+					MATRIX_KEY(0x02, 0x07, KEY_H)
+					MATRIX_KEY(0x02, 0x08, KEY_BACKSLASH)
+					MATRIX_KEY(0x02, 0x0a, KEY_F7)
+					MATRIX_KEY(0x02, 0x0d, KEY_MINUS)
+					MATRIX_KEY(0x02, 0x0f, KEY_RIGHT)
+
+					/* Row 3 */
+					MATRIX_KEY(0x03, 0x01, KEY_LEFTMETA)
+					MATRIX_KEY(0x03, 0x02, KEY_TAB)
+					MATRIX_KEY(0x03, 0x04, KEY_F4)
+					MATRIX_KEY(0x03, 0x05, KEY_F1)
+					MATRIX_KEY(0x03, 0x06, KEY_T)
+					MATRIX_KEY(0x03, 0x07, KEY_Y)
+					MATRIX_KEY(0x03, 0x08, KEY_O)
+					MATRIX_KEY(0x03, 0x0a, KEY_F6)
+					MATRIX_KEY(0x03, 0x0b, KEY_F9)
+					MATRIX_KEY(0x03, 0x0d, KEY_F12)
+
+					/* Row 4 */
+					MATRIX_KEY(0x04, 0x02, KEY_GRAVE)
+					MATRIX_KEY(0x04, 0x04, KEY_CAPSLOCK)
+					MATRIX_KEY(0x04, 0x05, KEY_S)
+					MATRIX_KEY(0x04, 0x06, KEY_5)
+					MATRIX_KEY(0x04, 0x07, KEY_6)
+					MATRIX_KEY(0x04, 0x08, KEY_F10)
+					MATRIX_KEY(0x04, 0x0a, KEY_F5)
+					MATRIX_KEY(0x04, 0x0d, KEY_0)
+					MATRIX_KEY(0x04, 0x0e, KEY_EQUAL)
+
+					/* Row 5 */
+					MATRIX_KEY(0x05, 0x02, KEY_1)
+					MATRIX_KEY(0x05, 0x04, KEY_3)
+					MATRIX_KEY(0x05, 0x05, KEY_2)
+					MATRIX_KEY(0x05, 0x06, KEY_4)
+					MATRIX_KEY(0x05, 0x07, KEY_7)
+					MATRIX_KEY(0x05, 0x08, KEY_9)
+					MATRIX_KEY(0x05, 0x0a, KEY_8)
+					MATRIX_KEY(0x05, 0x0b, KEY_102ND)
+					MATRIX_KEY(0x05, 0x0d, KEY_P)
+					MATRIX_KEY(0x05, 0x0e, KEY_BACKSPACE)
+
+					/* Row 6 */
+					MATRIX_KEY(0x06, 0x04, KEY_F3)
+					MATRIX_KEY(0x06, 0x05, KEY_W)
+					MATRIX_KEY(0x06, 0x06, KEY_R)
+					MATRIX_KEY(0x06, 0x07, KEY_U)
+					MATRIX_KEY(0x06, 0x08, KEY_F11)
+					MATRIX_KEY(0x06, 0x0a, KEY_I)
+					MATRIX_KEY(0x06, 0x0b, KEY_LEFT)
+					MATRIX_KEY(0x06, 0x0d, KEY_LEFTBRACE)
+					MATRIX_KEY(0x06, 0x0e, KEY_RIGHTBRACE)
+
+					/* Row 7 */
+					MATRIX_KEY(0x07, 0x02, KEY_A)
+					MATRIX_KEY(0x07, 0x05, KEY_ESC)
+					MATRIX_KEY(0x07, 0x06, KEY_F)
+					MATRIX_KEY(0x07, 0x07, KEY_J)
+					MATRIX_KEY(0x07, 0x08, KEY_L)
+					MATRIX_KEY(0x07, 0x0a, KEY_K)
+					MATRIX_KEY(0x07, 0x0d, KEY_SEMICOLON)
+					MATRIX_KEY(0x07, 0x0e, KEY_D)
+
+					/* Fn layer (row + 8). */
+					MATRIX_KEY(0x08, 0x01, KEY_INSERT)        /* Fn+Delete */
+					MATRIX_KEY(0x09, 0x08, KEY_PAGEDOWN)      /* Fn+Down */
+					MATRIX_KEY(0x09, 0x0d, KEY_PAGEUP)        /* Fn+Up */
+					MATRIX_KEY(0x09, 0x0f, KEY_BRIGHTNESSUP)  /* Fn+F8 */
+					MATRIX_KEY(0x0a, 0x05, KEY_VOLUMEDOWN)    /* Fn+F2 */
+					MATRIX_KEY(0x0a, 0x0a, KEY_BRIGHTNESSDOWN) /* Fn+F7 */
+					MATRIX_KEY(0x0a, 0x0f, KEY_END)           /* Fn+Right */
+					MATRIX_KEY(0x0b, 0x04, KEY_PREVIOUSSONG)  /* Fn+F4 */
+					MATRIX_KEY(0x0b, 0x05, KEY_MUTE)          /* Fn+F1 */
+					MATRIX_KEY(0x0b, 0x0a, KEY_NEXTSONG)      /* Fn+F6 */
+					MATRIX_KEY(0x0b, 0x0b, KEY_SWITCHVIDEOMODE) /* Fn+F9 */
+					MATRIX_KEY(0x0b, 0x0d, KEY_CONFIG)        /* Fn+F12 */
+					MATRIX_KEY(0x0c, 0x08, KEY_RFKILL)        /* Fn+F10 */
+					MATRIX_KEY(0x0c, 0x0a, KEY_PLAYPAUSE)     /* Fn+F5 */
+					MATRIX_KEY(0x0e, 0x04, KEY_VOLUMEUP)      /* Fn+F3 */
+					MATRIX_KEY(0x0e, 0x08, KEY_SYSRQ)         /* Fn+F11 */
+					MATRIX_KEY(0x0e, 0x0b, KEY_HOME)          /* Fn+Left */
+					>;
+		};
+	};
+};
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 9/9] riscv: defconfig: Enable the FML13V05 EC keyboard modules
  2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
                   ` (7 preceding siblings ...)
  2026-11-18  8:57 ` [PATCH 8/9] riscv: dts: spacemit: Enable the FML13V05 EC keyboard Wang Yang
@ 2026-11-18  8:57 ` Wang Yang
  8 siblings, 0 replies; 12+ messages in thread
From: Wang Yang @ 2026-11-18  8:57 UTC (permalink / raw)
  To: Yixun Lan, Benson Leung
  Cc: Troy Mitchell, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Sandie Cao, devicetree,
	chrome-platform, linux-riscv, spacemit, linux-kernel

Enable the eSPI controller and Chrome platform configuration menu. Build
the EC core, memory transport and keyboard driver as modules so OF
modaliases can load them on boards that describe this hardware.

Keep all configuration choices in this final standalone patch.

Prepared with Codex assistance from the existing DC-linux EC support.

Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
 arch/riscv/configs/defconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 383fdd07a..1ddb8cd5f 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -145,7 +145,9 @@ CONFIG_MICREL_PHY=y
 CONFIG_MICROSEMI_PHY=y
 CONFIG_MOTORCOMM_PHY=y
 CONFIG_INPUT_MOUSEDEV=y
+CONFIG_SPACEMIT_ESPI_BUS=y
 CONFIG_INPUT_EVDEV=y
+CONFIG_KEYBOARD_CROS_EC=m
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_KEYBOARD_SUN4I_LRADC=m
 CONFIG_SERIAL_8250=y
@@ -277,6 +279,9 @@ CONFIG_PHY_SUN4I_USB=m
 CONFIG_PHY_STARFIVE_JH7110_DPHY_RX=m
 CONFIG_PHY_STARFIVE_JH7110_PCIE=m
 CONFIG_PHY_STARFIVE_JH7110_USB=m
+CONFIG_CHROME_PLATFORMS=y
+CONFIG_CROS_EC=m
+CONFIG_CROS_EC_SPACEMIT_K3=m
 CONFIG_LIBNVDIMM=y
 CONFIG_NVMEM_SUNXI_SID=y
 CONFIG_EXT4_FS=y
-- 
2.43.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/9] dt-bindings: bus: Add SpacemiT K3 eSPI controller
  2026-11-18  8:57 ` [PATCH 1/9] dt-bindings: bus: Add SpacemiT K3 eSPI controller Wang Yang
@ 2026-11-18 17:51   ` Conor Dooley
  0 siblings, 0 replies; 12+ messages in thread
From: Conor Dooley @ 2026-11-18 17:51 UTC (permalink / raw)
  To: Wang Yang
  Cc: Yixun Lan, Benson Leung, Troy Mitchell, Tzung-Bi Shih,
	Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Sandie Cao, devicetree, chrome-platform, linux-riscv, spacemit,
	linux-kernel, linux-spi, broonie

[-- Attachment #1: Type: text/plain, Size: 5410 bytes --]

+CC Mark, spi,

On Wed, Nov 18, 2026 at 04:57:34PM +0800, Wang Yang wrote:
> window, clocks, resets and link configuration. The EC uses this memory
> window rather than the ordinary SPI transfer interface.
> 
> The controller implementation is carried as a separate prerequisite so
> that the hardware vendor can review it independently.
> 
> Prepared with Codex assistance from the existing DC-linux EC support.
> 
> Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
> ---
>  .../bindings/bus/spacemit,k3-espi.yaml        | 146 ++++++++++++++++++
>  1 file changed, 146 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
> 
> diff --git a/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml b/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
> new file mode 100644
> index 000000000..30985ee0a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
> @@ -0,0 +1,146 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/bus/spacemit,k3-espi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: SpacemiT K3 eSPI controller

How is this "eSPI" different to the eSPI described in fsl,espi.yaml and
implemented by a driver in drivers/spi?

Cheers,
Conor.

> +
> +maintainers:
> +  - Yixun Lan <dlan@kernel.org>
> +
> +description: |
> +  The K3 eSPI controller connects the application processor to an embedded
> +  controller. Child registers are accessed through a peripheral shared-memory
> +  window, translated by ranges. The controller manages clocks, resets and
> +  channel negotiation, including link recovery after an EC reboot.
> +
> +properties:
> +  compatible:
> +    const: spacemit,k3-espi
> +
> +  reg:
> +    maxItems: 1
> +
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 1
> +
> +  ranges:
> +    maxItems: 1
> +
> +  clocks:
> +    items:
> +      - description: Serial clock source
> +      - description: Serial clock
> +      - description: Bus clock
> +
> +  clock-names:
> +    items:
> +      - const: sclk_src
> +      - const: sclk
> +      - const: mclk
> +
> +  resets:
> +    items:
> +      - description: Bus reset
> +      - description: Serial clock reset
> +
> +  pr-mem-base0:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: First peripheral memory translation base.
> +
> +  pr-mem-base1:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Second peripheral memory translation base.
> +
> +  operating-frequency:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Requested link clock frequency in MHz.
> +    enum: [20, 25, 33, 50, 66]
> +    default: 20
> +
> +  io-mode:
> +    $ref: /schemas/types.yaml#/definitions/string
> +    description: Requested number of eSPI data lines.
> +    enum: [single, dual, quad]
> +    default: single
> +
> +  alert-mode:
> +    $ref: /schemas/types.yaml#/definitions/string
> +    description: Use the shared IO1 line or the dedicated alert pin.
> +    enum: [io1, pin]
> +    default: io1
> +
> +  alert-type:
> +    $ref: /schemas/types.yaml#/definitions/string
> +    description: Electrical mode of the dedicated alert pin.
> +    enum: [open-drain, push-pull]
> +    default: open-drain
> +
> +  watchdog-timeout:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Controller watchdog counter value.
> +    maximum: 65535
> +    default: 65535
> +
> +  crc-enable:
> +    type: boolean
> +    description: Enable link CRC checking.
> +
> +  auto-gating-enable:
> +    type: boolean
> +    description: Enable automatic controller clock gating.
> +
> +  peripheral-channel-enable:
> +    type: boolean
> +    description: Enable the peripheral channel.
> +
> +  vwire-channel-enable:
> +    type: boolean
> +    description: Enable the virtual-wire channel.
> +
> +  oob-channel-enable:
> +    type: boolean
> +    description: Enable the out-of-band channel.
> +
> +  flash-channel-enable:
> +    type: boolean
> +    description: Enable the flash access channel.
> +
> +patternProperties:
> +  '^ec@[0-9a-f]+$':
> +    $ref: /schemas/embedded-controller/google,cros-ec.yaml#
> +
> +required:
> +  - compatible
> +  - reg
> +  - '#address-cells'
> +  - '#size-cells'
> +  - ranges
> +  - clocks
> +  - clock-names
> +  - resets
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/spacemit,k3-clocks.h>
> +    #include <dt-bindings/reset/spacemit,k3-resets.h>
> +
> +    espi@cac8c000 {
> +        compatible = "spacemit,k3-espi";
> +        reg = <0xcac8c000 0x1000>;
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        ranges = <0 0x84000000 0x1000>;
> +        clocks = <&syscon_apmu CLK_APMU_ESPI_SCLK_SRC>,
> +                 <&syscon_apmu CLK_APMU_ESPI_SCLK>,
> +                 <&syscon_apmu CLK_APMU_ESPI_MCLK>;
> +        clock-names = "sclk_src", "sclk", "mclk";
> +        resets = <&syscon_apmu RESET_APMU_ESPI_MCLK>,
> +                 <&syscon_apmu RESET_APMU_ESPI_SCLK>;
> +    };
> 
> base-commit: 749a4de370409464cf8501ec5b2451df45c84eb4
> -- 
> 2.43.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/9] bus: Add SpacemiT K3 eSPI controller support
  2026-11-18  8:57 ` [PATCH 3/9] bus: Add SpacemiT K3 eSPI controller support Wang Yang
@ 2026-11-18 21:10   ` Aurelien Jarno
  0 siblings, 0 replies; 12+ messages in thread
From: Aurelien Jarno @ 2026-11-18 21:10 UTC (permalink / raw)
  To: Wang Yang
  Cc: Yixun Lan, Benson Leung, Troy Mitchell, Tzung-Bi Shih,
	Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Sandie Cao, devicetree, chrome-platform, linux-riscv, spacemit,
	linux-kernel

Hi,

On 2026-11-18 16:57, Wang Yang wrote:
> Initialize and recover the K3 eSPI peripheral channel before populating
> its children. Keep controller register programming, clock and reset
> handling in the controller driver rather than in the EC transport.
> 
> Port the existing vendor-derived implementation separately from the EC
> client. The controller logic comes from the vendor BSP at revision
> 29b78afb484b, authored by goumin <min.gou@spacemit.com>. Preserve its
> register programming and link-recovery behavior.
> 
> No matching SpacemiT eSPI submission was found in the archived SPI,
> RISC-V and Chrome platform searches used for this port.

While this is correct, please note that there was a try from AMD to 
define a eSPI bus framework back in August [1]. However I haven't 
spotted any further progress.

Anyway thanks for your work, I guess this can also be useful for the EC 
controller on the K3 Pico-ITX boards, which drives among other things 
the fan PWM.

Regards
Aurelien

[1] https://lore.kernel.org/all/20260804115259.4065638-1-krishnamoorthi.m@amd.com/

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-18 21:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18  8:57 [PATCH 0/9] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
2026-11-18  8:57 ` [PATCH 1/9] dt-bindings: bus: Add SpacemiT K3 eSPI controller Wang Yang
2026-11-18 17:51   ` Conor Dooley
2026-11-18  8:57 ` [PATCH 2/9] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
2026-11-18  8:57 ` [PATCH 3/9] bus: Add SpacemiT K3 eSPI controller support Wang Yang
2026-11-18 21:10   ` Aurelien Jarno
2026-11-18  8:57 ` [PATCH 4/9] platform/chrome: Allow ChromeOS platform support on RISC-V Wang Yang
2026-11-18  8:57 ` [PATCH 5/9] platform/chrome: Add SpacemiT K3 eSPI EC transport Wang Yang
2026-11-18  8:57 ` [PATCH 6/9] riscv: dts: spacemit: Add K3 eSPI pin group Wang Yang
2026-11-18  8:57 ` [PATCH 7/9] riscv: dts: spacemit: Describe the K3 eSPI controller Wang Yang
2026-11-18  8:57 ` [PATCH 8/9] riscv: dts: spacemit: Enable the FML13V05 EC keyboard Wang Yang
2026-11-18  8:57 ` [PATCH 9/9] riscv: defconfig: Enable the FML13V05 EC keyboard modules Wang Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®