All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Wang Yang <yang.wang@deepcomputing.io>
Cc: Yixun Lan <dlan@kernel.org>, Benson Leung <bleung@chromium.org>,
	Troy Mitchell <troy.mitchell@linux.spacemit.com>,
	Guenter Roeck <groeck@chromium.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Sandie Cao <sandie.cao@deepcomputing.io>,
	devicetree@vger.kernel.org, chrome-platform@lists.linux.dev,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/9] platform/chrome: Add SpacemiT K3 eSPI EC transport
Date: Fri, 27 Nov 2026 11:56:19 +0000	[thread overview]
Message-ID: <awlv4wDjNQ8nXYiH@google.com> (raw)
In-Reply-To: <20261118085742.1817536-6-yang.wang@deepcomputing.io>

On Wed, Nov 18, 2026 at 04:57:38PM +0800, Wang Yang wrote:
> 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.

I haven't done a detailed review as some functions in this patch
(ec_response_timed_out, pkt_xfer, cmd_xfer, readmem) are based on (and
very similar to) cros_ec_lpc.c.  Is it possible to refactor
cros_ec_lpc.c to extract the common logic first so that this driver can
reuse it?

E.g.:
- cros_ec_lpc_proto.c and cros_ec_lpc_proto.h for the common logic.
- cros_ec_lpc uses the common logic.
- This driver (consider renaming to cros_ec_espi_spacemit) reuses the
  common logic.

Similarly, instead of handling ec->irq in the driver, refactor
cros_ec_register() first and reuse the logic in the driver.

E.g., only set it to IRQF_TRIGGER_LOW if it was unset:
    unsigned long irqflags = IRQF_ONESHOT;
    if (irq_get_trigger_type(ec_dev->irq) == IRQ_TYPE_NONE)
        irqflags |= IRQF_TRIGGER_LOW;

Or introduce an ec_dev->irqflags field:
    if (ec_dev->irqflags == 0)
        ec_dev->irqflags = IRQF_TRIGGER_LOW | IRQF_ONESHOT;

WARNING: multiple messages have this Message-ID (diff)
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Wang Yang <yang.wang@deepcomputing.io>
Cc: Yixun Lan <dlan@kernel.org>, Benson Leung <bleung@chromium.org>,
	Troy Mitchell <troy.mitchell@linux.spacemit.com>,
	Guenter Roeck <groeck@chromium.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Sandie Cao <sandie.cao@deepcomputing.io>,
	devicetree@vger.kernel.org, chrome-platform@lists.linux.dev,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/9] platform/chrome: Add SpacemiT K3 eSPI EC transport
Date: Fri, 27 Nov 2026 11:56:19 +0000	[thread overview]
Message-ID: <awlv4wDjNQ8nXYiH@google.com> (raw)
In-Reply-To: <20261118085742.1817536-6-yang.wang@deepcomputing.io>

On Wed, Nov 18, 2026 at 04:57:38PM +0800, Wang Yang wrote:
> 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.

I haven't done a detailed review as some functions in this patch
(ec_response_timed_out, pkt_xfer, cmd_xfer, readmem) are based on (and
very similar to) cros_ec_lpc.c.  Is it possible to refactor
cros_ec_lpc.c to extract the common logic first so that this driver can
reuse it?

E.g.:
- cros_ec_lpc_proto.c and cros_ec_lpc_proto.h for the common logic.
- cros_ec_lpc uses the common logic.
- This driver (consider renaming to cros_ec_espi_spacemit) reuses the
  common logic.

Similarly, instead of handling ec->irq in the driver, refactor
cros_ec_register() first and reuse the logic in the driver.

E.g., only set it to IRQF_TRIGGER_LOW if it was unset:
    unsigned long irqflags = IRQF_ONESHOT;
    if (irq_get_trigger_type(ec_dev->irq) == IRQ_TYPE_NONE)
        irqflags |= IRQF_TRIGGER_LOW;

Or introduce an ec_dev->irqflags field:
    if (ec_dev->irqflags == 0)
        ec_dev->irqflags = IRQF_TRIGGER_LOW | IRQF_ONESHOT;

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2026-11-27 11:56 UTC|newest]

Thread overview: 46+ 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 ` 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  9:18   ` sashiko-bot
2026-11-18 17:51   ` Conor Dooley
2026-11-18 17:51     ` Conor Dooley
2026-11-18 22:10     ` Aurelien Jarno
2026-11-18 22:10       ` Aurelien Jarno
2026-11-19  9:05       ` Wang Yang
2026-11-19  9:05         ` Wang Yang
2026-11-19 11:02         ` Conor Dooley
2026-11-19 11:02           ` Conor Dooley
2026-11-19 11:10           ` Conor Dooley
2026-11-19 11:10             ` 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   ` Wang Yang
2026-11-30  8:32   ` Troy Mitchell
2026-11-30  8:32     ` Troy Mitchell
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  9:23   ` sashiko-bot
2026-11-18 21:10   ` Aurelien Jarno
2026-11-18 21:10     ` Aurelien Jarno
2026-11-19  9:40     ` Wang Yang
2026-11-19  9:40       ` Wang Yang
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 5/9] platform/chrome: Add SpacemiT K3 eSPI EC transport Wang Yang
2026-11-18  8:57   ` Wang Yang
2026-11-18  9:33   ` sashiko-bot
2026-11-27 11:56   ` Tzung-Bi Shih [this message]
2026-11-27 11:56     ` Tzung-Bi Shih
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  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  8:57   ` Wang Yang
2026-11-18  9:25   ` sashiko-bot
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
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
2026-11-18  8:57   ` Wang Yang
2026-12-02  6:09   ` Troy Mitchell
2026-12-02  6:09     ` Troy Mitchell

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=awlv4wDjNQ8nXYiH@google.com \
    --to=tzungbi@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@kernel.org \
    --cc=groeck@chromium.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=sandie.cao@deepcomputing.io \
    --cc=spacemit@lists.linux.dev \
    --cc=troy.mitchell@linux.spacemit.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.