Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wang Yang" <yang.wang@deepcomputing.io>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 7/9] riscv: dts: spacemit: Describe the K3 eSPI controller
Date: Wed, 18 Nov 2026 09:25:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-220555@kernel.org> (raw)
In-Reply-To: <20261118085742.1817536-8-yang.wang@deepcomputing.io>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] riscv: dts: spacemit: espi0 sets pr-mem-base1 to MMIO base in
  k3.dtsi
- [Medium] bus: spacemit-k3-espi: spacemit_espi_property_enabled()
  always returns true
- [Medium] bus: spacemit-k3-espi: spacemit_espi_init_locked() sets rate
  on sclk mux
- [Medium] riscv: dts: spacemit: espi0-0-pins uses bare bias-pull-up in
  k3-pinctrl.dtsi
--

commit 39603178b0636a387372665a38106a9b79fae1a8
Author: Wang Yang <yang.wang@deepcomputing.io>

riscv: dts: spacemit: Describe the K3 eSPI controller

This commit adds the disabled eSPI controller device node to the SpacemiT
K3 SoC devicetree.

> diff --git a/arch/riscv/boot/dts/spacemit/k3.dtsi b/arch/riscv/boot/dts/spacemit/k3.dtsi
> index e89d2cc5ca8cc..d859c84bbaa1d 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>;

[Severity: Medium]
Should pr-mem-base1 be 0x85000000 (or omitted so the driver defaults to
pr-mem-base0 + SZ_16M) instead of 0xcac8c000?

0xcac8c000 is the eSPI controller's own MMIO control register block, and
spacemit_espi_program_window() writes pr-mem-base1 into
ESPI_PR_BASE_ADDR_MEM1 as the second peripheral memory translation window
base.  Setting it to 0xcac8c000 breaks peripheral channel accesses that use
the second memory translation window and points them at the controller's
own registers.

> +			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";

[Severity: Medium]
Does setting the serial clock rate via espi->sclk work when
operating-frequency differs from the initial parent clock rate?

In commit "bus: Add SpacemiT K3 eSPI controller support",
spacemit_espi_probe() only acquires "sclk", and
spacemit_espi_init_locked() calls clk_set_rate() on espi->sclk before link
frequency negotiation:

drivers/bus/spacemit-k3-espi.c:spacemit_espi_init_locked() {
    ...
	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);
	}
    ...
}

In drivers/clk/spacemit/ccu-k3.c, espi_sclk is defined without
CLK_SET_RATE_PARENT, while espi_sclk_src holds the 20/25/33/50/66 MHz parent
mux.  Calling clk_set_rate() on espi->sclk does not switch espi_sclk_src,
and if slave negotiation lowers the frequency, the controller and slave are
configured for a rate that does not match the actual serial clock.

> +			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;

[Severity: Medium]
Can a board devicetree disable any of these six boolean properties?

In commit "bus: Add SpacemiT K3 eSPI controller support",
spacemit_espi_parse_dt() parses these properties with default_value = true:

drivers/bus/spacemit-k3-espi.c:spacemit_espi_property_enabled() {
	if (of_find_property(np, name, NULL))
		return of_property_read_bool(np, name);

	return default_value;
}

When a boolean property is present, of_property_read_bool() returns true;
when it is omitted or removed with /delete-property/ in a board dts,
of_find_property() is NULL and spacemit_espi_property_enabled() returns
default_value, which is also true.

[Severity: Medium]
Also, in commit "riscv: dts: spacemit: Add K3 eSPI pin group", does
espi0-0-pins configure a strong pull-up instead of the intended normal
pull-up?

arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi:
		espi0-0-pins {
			pinctrl-single,pins = <
				K3_PADCONF(GPIO_115, MUX_MODE2)	/* espi_dat0 */
				...
			>;
			bias-pull-up;			/* normal pull-up */
			drive-strength = <25>;		/* DS8 */
			power-source = <1800>;
		};

The spacemit,k1-pinctrl binding requires a u32 argument (0 for normal
pull-up, 1 for strong pull-up), as used elsewhere in k3-pinctrl.dtsi with
bias-pull-up = <0>.  With a bare bias-pull-up property, pinconf-generic
passes the default argument of 1, causing spacemit_pinconf_generate_config()
to set PAD_STRONG_PULL and failing dtbs_check.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118085742.1817536-1-yang.wang@deepcomputing.io?part=7

  reply	other threads:[~2026-11-18  9:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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  9:18   ` sashiko-bot
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  9:23   ` sashiko-bot
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  9:33   ` sashiko-bot
2026-11-18  8:57 ` [PATCH 6/9] riscv: dts: spacemit: Add K3 eSPI pin group Wang Yang
2026-11-18  9:08   ` sashiko-bot
2026-11-18  8:57 ` [PATCH 7/9] riscv: dts: spacemit: Describe the K3 eSPI controller Wang Yang
2026-11-18  9:25   ` sashiko-bot [this message]
2026-11-18  8:57 ` [PATCH 8/9] riscv: dts: spacemit: Enable the FML13V05 EC keyboard Wang Yang
2026-11-18  9:20   ` sashiko-bot
2026-11-18  8:57 ` [PATCH 9/9] riscv: defconfig: Enable the FML13V05 EC keyboard modules Wang Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-220555@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yang.wang@deepcomputing.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox