From: Yu-Che Hsieh <yc_hsieh@aspeedtech.com>
To: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
"Joel Stanley" <joel@jms.id.au>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Chia-Wei Wang <chiawei_wang@aspeedtech.com>,
Corey Minyard <corey@minyard.net>
Cc: Andrew Jeffery <andrew@aj.id.au>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
<openipmi-developer@lists.sourceforge.net>,
Yu-Che Hsieh <yc_hsieh@aspeedtech.com>
Subject: [PATCH RFC 0/2] ipmi: kcs_bmc_aspeed: Support multiple LPC controller instances
Date: Thu, 23 Jul 2026 13:31:36 +0800 [thread overview]
Message-ID: <20260723-upstream_kcs_multiple_lpc-v1-0-d918b5270b86@aspeedtech.com> (raw)
Hi,
Aspeed AST2700 SoC exposes more than one physical LPC controller
(e.g. lpc0@14c31000, lpc1@14c32000, plus pcie_lpc0@12c19000 and
pcie_lpc1@12c19800 for the PCIe-facing path), each instantiating
its own KCS1-KCS4 with identical IDR/ODR/STR register offsets:
lpc0: lpc@14c31000 {
compatible = "aspeed,ast2700-lpc", "simple-mfd", "syscon";
lpc0_kcs1: lpc-kcs@24 {
compatible = "aspeed,ast2600-kcs-bmc";
...
};
...
};
lpc1: lpc@14c32000 {
compatible = "aspeed,ast2700-lpc", "simple-mfd", "syscon";
lpc1_kcs1: kcs@24 {
compatible = "aspeed,ast2600-kcs-bmc";
...
};
...
};
kcs_bmc_device::channel currently serves two purposes at once:
1. Selecting which HICR0/HICR2/HICRB bit-group to touch within a single
LPC controller's register file (aspeed_kcs_of_get_channel() derives
this purely from the KCS node's register offset, 1..4).
2. Naming the misc chardev (/dev/ipmi-kcsN) exposed to userspace, which
must be unique system-wide (kcs_bmc_cdev_ipmi.c uses "ipmi-kcs%u").
Both happen to be the same value only because this driver has only ever
had to support SoCs with a single LPC controller. On AST2700, KCS1 on
every LPC controller computes to the same channel number, and whichever
instance probes second fails outright.
This series keeps a driver-private `channel` (1..4) in
struct aspeed_kcs_bmc for register access, and computes a
globally-unique kcs_bmc_device::channel as `bank * KCS_CHANNEL_MAX +
channel`, where `bank` identifies which LPC controller instance a KCS
device belongs to.
Before settling on how `bank` is derived, I considered a few options
with different tradeoffs and no clearly "correct" answer from existing
driver conventions:
(a) Dynamic discovery: keep a driver-global list (protected by a
mutex), keyed by the LPC controller's device_node pointer, and
assign bank indices in first-seen-during-probe order. No DT
changes required, but bank numbering depends on probe order,
which is not deterministic across boots/reprobes.
(b) Tree walk by compatible: for_each_compatible_node() over the
whole DT matching the LPC node's own compatible string, counting
position. Deterministic and requires no DT changes, but AST2700's
four LPC-compatible instances (lpc0/lpc1/pcie_lpc0/pcie_lpc1)
don't share a common parent node and don't share a consistent
child-node naming scheme, which also rules out parent-based or
node-name-based tree walks I looked at.
(c) of_alias_get_id(): require board DTs to declare
/aliases { lpc0 = &lpc0; lpc1 = &lpc1; ... }, and read the index
back from there. This is the pattern already used by mmc/i2c/spi/
serial for "which instance is this" numbering, including the same
"absent alias -> fall back to previous behaviour" compatibility
guarantee for existing DTBs.
This series implements (c), since it puts the numbering under DT-author
control rather than driver inference, generalizes across however many
LPC-compatible instances a future SoC exposes (regardless of tree
placement), and existing single-LPC-controller boards need no DT
changes at all - of_alias_get_id() returns an error when no alias is
present and the driver falls back to bank 0, which is exactly today's
behaviour.
Patches:
Patch 1: dt-bindings: mfd: aspeed-lpc: Document lpcN alias for
multi-instance SoCs
Patch 2: ipmi: kcs_bmc_aspeed: Support multiple LPC controller
instances
Before dropping the RFC tag and posting the AST2700 follow-up patches,
I'd particularly appreciate review feedback on the bank-numbering approach.
In particular, does option (c) seem like an acceptable use of DT aliases
for identifying LPC controller instances, or would the community prefer a
different approach?
Any guidance would be very helpful.
Signed-off-by: Yu-Che Hsieh <yc_hsieh@aspeedtech.com>
---
Yu-Che Hsieh (2):
dt-bindings: mfd: aspeed-lpc: Document lpcN alias for multi-instance SoCs
ipmi: kcs_bmc_aspeed: Support multiple LPC controller instances
.../devicetree/bindings/mfd/aspeed-lpc.yaml | 7 ++++
drivers/char/ipmi/kcs_bmc_aspeed.c | 37 ++++++++++++++++------
2 files changed, 34 insertions(+), 10 deletions(-)
---
base-commit: f0e6f20cb52b14c2c441f04e21cef0c95d498cac
change-id: 20260722-upstream_kcs_multiple_lpc-735942211508
Best regards,
--
Yu-Che Hsieh <yc_hsieh@aspeedtech.com>
next reply other threads:[~2026-07-23 5:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 5:31 Yu-Che Hsieh [this message]
2026-07-23 5:31 ` [PATCH RFC 1/2] dt-bindings: mfd: aspeed-lpc: Document lpcN alias for multi-instance SoCs Yu-Che Hsieh
2026-08-06 13:31 ` Lee Jones
2026-08-10 6:24 ` YC Hsieh
2026-07-23 5:31 ` [PATCH RFC 2/2] ipmi: kcs_bmc_aspeed: Support multiple LPC controller instances Yu-Che Hsieh
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=20260723-upstream_kcs_multiple_lpc-v1-0-d918b5270b86@aspeedtech.com \
--to=yc_hsieh@aspeedtech.com \
--cc=andrew@aj.id.au \
--cc=andrew@codeconstruct.com.au \
--cc=chiawei_wang@aspeedtech.com \
--cc=conor+dt@kernel.org \
--cc=corey@minyard.net \
--cc=devicetree@vger.kernel.org \
--cc=joel@jms.id.au \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®