* [PATCH v2 00/13] Add SpacemiT K3 FML13V05 EC keyboard support
@ 2026-12-04 4:20 Wang Yang
2026-12-04 4:21 ` [PATCH v2 05/13] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Wang Yang @ 2026-12-04 4:20 UTC (permalink / raw)
To: linux-kernel
Cc: Benson Leung, Tzung-Bi Shih, Guenter Roeck, chrome-platform,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Yixun Lan,
Troy Mitchell, devicetree, linux-riscv, spacemit, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Aurelien Jarno, Conor Dooley, Krishnamoorthi M, yh_chung
This series enables the built-in keyboard on the DeepComputing FML13V05.
The SpacemiT K3 host exposes the EC command window through the eSPI
Peripheral Channel. The EC implements the Chrome EC host protocol, and
the existing Chrome EC keyboard driver reports input events.
Changes since v1:
- Share LPC-style polling, protocol v2/v3 transfers and readmem between
the LPC and K3 transports. Keep the K3 window mapping and recovery in
the K3 transport. A command that times out is not replayed.
- Let the EC core request the IRQ. Existing transports keep their
low-level default and K3 uses the rising edge specified by the board.
- Add the EC binding before the controller binding that references it.
Derive the CPU window from ranges and specify the link frequency in Hz.
The second peripheral base retains the vendor board value, 0xcac8c000.
- Correct the pin pull settings, command status clearing and negotiated
clock selection. Check packet bounds and EC readiness. On resume,
check a pending recovery before enabling the EC event IRQ.
- Order the five RISC-V configuration entries using savedefconfig.
The AMD host RFC models chip-select targets and controller operations.
K3 needs a CPU-mapped Peripheral Channel window and a way to recover the
host link following a timeout. The Aspeed series covers the BMC side.
On next-20261202, an earlier revision booted on FML13V05 from NVMe with
test-only PCIe and DT additions. After a mainboard reset with the EC
still powered, the EC reported FML13V05-V01.06. The built-in keyboard
reported a left Shift press and release, and the EC IRQ count rose from
zero to two. The change since that test is confined to the K3 EC
transport's link check at probe and resume.
OpenAI Codex assisted with refactoring, review of v1 feedback, commit
messages and test preparation.
v1: https://lore.kernel.org/all/20261118085742.1817536-1-yang.wang@deepcomputing.io/
AMD RFC: https://lore.kernel.org/all/20260804115259.4065638-1-krishnamoorthi.m@amd.com/
Aspeed: https://lore.kernel.org/all/20260313-upstream_espi-v1-0-9504428e1f43@aspeedtech.com/
Wang Yang (13):
platform/chrome: Correct LPC EC readmem bounds
platform/chrome: Extract LPC-style EC protocol helpers
platform/chrome: Allow transport-specific LPC response timeouts
platform/chrome: Allow transports to select EC IRQ flags
dt-bindings: embedded-controller: Add SpacemiT K3 EC window
dt-bindings: bus: Add SpacemiT K3 Intel eSPI controller
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 | 149 ++++
.../spacemit,k3-cros-ec.yaml | 77 ++
.../spacemit/k3-deepcomputing-fml13v05.dts | 137 +++
arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi | 24 +
arch/riscv/boot/dts/spacemit/k3.dtsi | 30 +
arch/riscv/configs/defconfig | 5 +
drivers/bus/Kconfig | 10 +
drivers/bus/Makefile | 1 +
drivers/bus/spacemit-k3-espi.c | 799 ++++++++++++++++++
drivers/platform/chrome/Kconfig | 20 +-
drivers/platform/chrome/Makefile | 4 +-
drivers/platform/chrome/cros_ec.c | 3 +-
.../platform/chrome/cros_ec_espi_spacemit.c | 568 +++++++++++++
drivers/platform/chrome/cros_ec_lpc.c | 239 +-----
drivers/platform/chrome/cros_ec_lpc_proto.c | 246 ++++++
drivers/platform/chrome/cros_ec_lpc_proto.h | 36 +
include/linux/platform_data/cros_ec_proto.h | 2 +
include/linux/spacemit-k3-espi.h | 20 +
18 files changed, 2152 insertions(+), 218 deletions(-)
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_espi_spacemit.c
create mode 100644 drivers/platform/chrome/cros_ec_lpc_proto.c
create mode 100644 drivers/platform/chrome/cros_ec_lpc_proto.h
create mode 100644 include/linux/spacemit-k3-espi.h
base-commit: 799dd936553182df5770dde7f38d94c8337df75a
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 05/13] dt-bindings: embedded-controller: Add SpacemiT K3 EC window
2026-12-04 4:20 [PATCH v2 00/13] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
@ 2026-12-04 4:21 ` Wang Yang
2026-12-04 4:32 ` sashiko-bot
2026-12-04 4:21 ` [PATCH v2 06/13] dt-bindings: bus: Add SpacemiT K3 Intel eSPI controller Wang Yang
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Wang Yang @ 2026-12-04 4:21 UTC (permalink / raw)
To: linux-kernel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Benson Leung,
Guenter Roeck, Yixun Lan, Troy Mitchell, devicetree,
chrome-platform, linux-riscv, spacemit
Describe the K3 non-linear peripheral window before the controller
binding references it. Reuse the existing keyboard and I2C tunnel
schemas. Keep the Google EC binding unchanged.
Prepared with OpenAI Codex assistance.
Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
.../spacemit,k3-cros-ec.yaml | 77 +++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100644 Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml
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 000000000000..fa9343e3ebf7
--- /dev/null
+++ b/Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml
@@ -0,0 +1,77 @@
+# 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. Child
+ functions use the common ChromeOS EC host-command interface. Devices on
+ an EC-controlled I2C bus are described below an I2C tunnel child.
+
+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#
+
+patternProperties:
+ "^i2c-tunnel[0-9]*$":
+ type: object
+ $ref: /schemas/i2c/google,cros-ec-i2c-tunnel.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>;
+
+ i2c-tunnel {
+ compatible = "google,cros-ec-i2c-tunnel";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ google,remote-bus = <4>;
+
+ battery@b {
+ compatible = "sbs,sbs-battery";
+ reg = <0xb>;
+ };
+ };
+ };
+ };
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 06/13] dt-bindings: bus: Add SpacemiT K3 Intel eSPI controller
2026-12-04 4:20 [PATCH v2 00/13] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
2026-12-04 4:21 ` [PATCH v2 05/13] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
@ 2026-12-04 4:21 ` Wang Yang
2026-12-04 4:21 ` [PATCH v2 10/13] riscv: dts: spacemit: Add K3 eSPI pin group Wang Yang
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Wang Yang @ 2026-12-04 4:21 UTC (permalink / raw)
To: linux-kernel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Yixun Lan,
Troy Mitchell, devicetree, linux-riscv, spacemit
Describe the Intel eSPI protocol replacing LPC and its CPU-accessible
peripheral window. Reference the already-added K3 EC schema from
the first commit. Use vendor properties and frequency units in Hz.
Prepared with OpenAI Codex assistance.
Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
.../bindings/bus/spacemit,k3-espi.yaml | 149 ++++++++++++++++++
1 file changed, 149 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 000000000000..4bd13cc33c90
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/spacemit,k3-espi.yaml
@@ -0,0 +1,149 @@
+# 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 controller implements the Intel Enhanced Serial Peripheral Interface
+ (eSPI), which replaces LPC. This is a different protocol from the ordinary
+ SPI bus implemented by the Freescale/NXP controller called eSPI.
+
+ The controller connects the application processor to an embedded controller.
+ It exposes a CPU-accessible peripheral-channel window, translated by ranges.
+ EC clients access command, response and memory-map registers through this
+ window. The controller manages clocks, resets, channel negotiation and 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
+
+ spacemit,pr-mem-base1:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Base address programmed into the controller's second peripheral-channel memory base register.
+
+ max-frequency:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Maximum eSPI serial clock frequency in Hz.
+ enum: [20000000, 25000000, 33333333, 50000000, 66666666]
+ default: 20000000
+
+ spacemit,io-mode:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: Requested number of eSPI data lines.
+ enum: [single, dual, quad]
+ default: single
+
+ spacemit,alert-mode:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: Use the shared IO1 line or the dedicated alert pin.
+ enum: [io1, pin]
+ default: io1
+
+ spacemit,alert-type:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: Electrical mode of the dedicated alert pin.
+ enum: [open-drain, push-pull]
+ default: open-drain
+
+ spacemit,watchdog-timeout:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Controller watchdog counter value.
+ maximum: 65535
+ default: 65535
+
+ spacemit,crc-enable:
+ type: boolean
+ description: Enable link CRC checking.
+
+ spacemit,auto-gating-enable:
+ type: boolean
+ description: Enable automatic controller clock gating.
+
+ spacemit,peripheral-channel-enable:
+ type: boolean
+ description: Enable the peripheral channel. Required for an enabled EC child.
+
+ spacemit,vwire-channel-enable:
+ type: boolean
+ description: Enable the virtual-wire channel.
+
+ spacemit,oob-channel-enable:
+ type: boolean
+ description: Enable the out-of-band channel.
+
+ spacemit,flash-channel-enable:
+ type: boolean
+ description: Enable the flash access channel.
+
+patternProperties:
+ '^ec@[0-9a-f]+$':
+ $ref: /schemas/embedded-controller/spacemit,k3-cros-ec.yaml#
+
+required:
+ - compatible
+ - reg
+ - '#address-cells'
+ - '#size-cells'
+ - ranges
+ - clocks
+ - clock-names
+ - resets
+ - spacemit,pr-mem-base1
+
+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>;
+ 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>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spacemit,pr-mem-base1 = <0xcac8c000>;
+ };
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 10/13] riscv: dts: spacemit: Add K3 eSPI pin group
2026-12-04 4:20 [PATCH v2 00/13] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
2026-12-04 4:21 ` [PATCH v2 05/13] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
2026-12-04 4:21 ` [PATCH v2 06/13] dt-bindings: bus: Add SpacemiT K3 Intel eSPI controller Wang Yang
@ 2026-12-04 4:21 ` Wang Yang
2026-12-04 4:21 ` [PATCH v2 11/13] riscv: dts: spacemit: Describe the K3 eSPI controller Wang Yang
2026-12-04 4:21 ` [PATCH v2 12/13] riscv: dts: spacemit: Enable the FML13V05 EC keyboard Wang Yang
4 siblings, 0 replies; 7+ messages in thread
From: Wang Yang @ 2026-12-04 4:21 UTC (permalink / raw)
To: linux-kernel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Yixun Lan,
Troy Mitchell, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, devicetree, linux-riscv, spacemit
Use normal pull-up explicitly and describe 25 mA drive as DS10 at 1.8 V.
Prepared with OpenAI Codex assistance.
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 cb4f4f4e33af..90f2de7a5c07 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 = <0>; /* normal pull-up */
+ drive-strength = <25>; /* DS10 at 1.8V */
+ power-source = <1800>;
+ };
+
+ espi0-1-pins {
+ pinmux = <K3_PADCONF(96, 4)>; /* espi0 clk */
+
+ bias-pull-down; /* normal pull-down */
+ drive-strength = <25>; /* DS10 at 1.8V */
+ 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 related [flat|nested] 7+ messages in thread
* [PATCH v2 11/13] riscv: dts: spacemit: Describe the K3 eSPI controller
2026-12-04 4:20 [PATCH v2 00/13] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
` (2 preceding siblings ...)
2026-12-04 4:21 ` [PATCH v2 10/13] riscv: dts: spacemit: Add K3 eSPI pin group Wang Yang
@ 2026-12-04 4:21 ` Wang Yang
2026-12-04 4:21 ` [PATCH v2 12/13] riscv: dts: spacemit: Enable the FML13V05 EC keyboard Wang Yang
4 siblings, 0 replies; 7+ messages in thread
From: Wang Yang @ 2026-12-04 4:21 UTC (permalink / raw)
To: linux-kernel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Yixun Lan,
Troy Mitchell, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, devicetree, linux-riscv, spacemit
Describe the controller resources and corrected link properties.
Require explicit MEM1 configuration; retain the BSP value until vendor
register documentation establishes a different interpretation.
Prepared with OpenAI Codex assistance.
Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
---
arch/riscv/boot/dts/spacemit/k3.dtsi | 30 ++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/arch/riscv/boot/dts/spacemit/k3.dtsi b/arch/riscv/boot/dts/spacemit/k3.dtsi
index e89d2cc5ca8c..88a265973d13 100644
--- a/arch/riscv/boot/dts/spacemit/k3.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k3.dtsi
@@ -648,6 +648,36 @@ 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>;
+ 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>;
+ max-frequency = <20000000>;
+ spacemit,pr-mem-base1 = <0xcac8c000>;
+ spacemit,io-mode = "single";
+ spacemit,alert-mode = "io1";
+ spacemit,alert-type = "open-drain";
+ spacemit,watchdog-timeout = <0xffff>;
+ spacemit,crc-enable;
+ spacemit,auto-gating-enable;
+ spacemit,peripheral-channel-enable;
+ spacemit,vwire-channel-enable;
+ spacemit,oob-channel-enable;
+ spacemit,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 related [flat|nested] 7+ messages in thread
* [PATCH v2 12/13] riscv: dts: spacemit: Enable the FML13V05 EC keyboard
2026-12-04 4:20 [PATCH v2 00/13] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
` (3 preceding siblings ...)
2026-12-04 4:21 ` [PATCH v2 11/13] riscv: dts: spacemit: Describe the K3 eSPI controller Wang Yang
@ 2026-12-04 4:21 ` Wang Yang
4 siblings, 0 replies; 7+ messages in thread
From: Wang Yang @ 2026-12-04 4:21 UTC (permalink / raw)
To: linux-kernel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Yixun Lan,
Troy Mitchell, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, devicetree, linux-riscv, spacemit
Enable the EC window, GPIO event IRQ and existing EC keyboard driver.
Prepared with OpenAI Codex assistance.
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 a80d32fe6f7f..6b292cca70cd 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"
@@ -32,6 +34,141 @@ reg_aux_vcc5v: regulator-aux-vcc5v {
};
};
+&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 */
+ >;
+ };
+ };
+};
+
&i2c8 {
pinctrl-names = "default";
pinctrl-0 = <&i2c8_cfg>;
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 05/13] dt-bindings: embedded-controller: Add SpacemiT K3 EC window
2026-12-04 4:21 ` [PATCH v2 05/13] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
@ 2026-12-04 4:32 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-04 4:32 UTC (permalink / raw)
To: Wang Yang; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] dt-bindings: spacemit,k3-cros-ec duplicates schema and blocks EC
sub-devices
- [Low] dt-bindings: commit message omits rationale for separate K3 EC
schema
--
commit 4f4efb4e453c6a6ced3361059125c9028c2520f6
Author: Wang Yang <yang.wang@deepcomputing.io>
> dt-bindings: embedded-controller: Add SpacemiT K3 EC window
>
> Describe the K3 non-linear peripheral window before the controller
> binding references it. Reuse the existing keyboard and I2C tunnel
> schemas. Keep the Google EC binding unchanged.
>
> Prepared with OpenAI Codex assistance.
>
> Signed-off-by: Wang Yang <yang.wang@deepcomputing.io>
[Severity: Low]
Could the commit message explain why google,cros-ec.yaml is kept unchanged
instead of extending it or sharing a common schema?
Right now it only states what the patch does without explaining why a
standalone schema is needed, why only keyboard-controller and i2c-tunnel
children are permitted, or why a SoC-specific spacemit,k3-cros-ec
compatible is used for the ChromeOS EC interface.
> 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 0000000000000..fa9343e3ebf7b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/embedded-controller/spacemit,k3-cros-ec.yaml
> @@ -0,0 +1,77 @@
[ ... ]
> + keyboard-controller:
> + $ref: /schemas/input/google,cros-ec-keyb.yaml#
> +
> +patternProperties:
> + "^i2c-tunnel[0-9]*$":
> + type: object
> + $ref: /schemas/i2c/google,cros-ec-i2c-tunnel.yaml#
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> +
> +additionalProperties: false
[Severity: Low]
Does closing this standalone schema with additionalProperties: false block
valid ChromeOS EC sub-devices that the driver populates?
cros_ec_register() populates all DT children via devm_of_platform_populate(),
so dtbs_check will reject standard sub-nodes such as pwm, typec, extcon,
regulator, or gpio-controller on boards using this binding.
Every property and requirement here is already a subset of
google,cros-ec.yaml, whose allOf rules already require reg and interrupts
while forbidding SPI-, RPMSG-, and FPMCU-only properties without new
conditionals. Controller bindings like mtk,scp.yaml reference it directly.
Adding spacemit,k3-cros-ec to google,cros-ec.yaml, or factoring the shared
ChromeOS EC properties and child nodes into a common schema referenced by
both, would avoid duplicating the binding and keep all EC sub-devices valid.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204042112.2985112-1-yang.wang@deepcomputing.io?part=5
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-12-04 4:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 4:20 [PATCH v2 00/13] Add SpacemiT K3 FML13V05 EC keyboard support Wang Yang
2026-12-04 4:21 ` [PATCH v2 05/13] dt-bindings: embedded-controller: Add SpacemiT K3 EC window Wang Yang
2026-12-04 4:32 ` sashiko-bot
2026-12-04 4:21 ` [PATCH v2 06/13] dt-bindings: bus: Add SpacemiT K3 Intel eSPI controller Wang Yang
2026-12-04 4:21 ` [PATCH v2 10/13] riscv: dts: spacemit: Add K3 eSPI pin group Wang Yang
2026-12-04 4:21 ` [PATCH v2 11/13] riscv: dts: spacemit: Describe the K3 eSPI controller Wang Yang
2026-12-04 4:21 ` [PATCH v2 12/13] riscv: dts: spacemit: Enable the FML13V05 EC keyboard Wang Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox