From nobody Fri Jul 24 05:22:57 2026 Received: from twmbx01.aspeedtech.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEBDA3A5452; Thu, 23 Jul 2026 05:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784784710; cv=none; b=YITR8MuVnCRF2uPRDBf85r6nIcp1v0ISMZs87UIpM9LpelYR6uNDmQlmd9GumWZ9EtDXu1JRLQP9Sy9sVFxDQu/VJdk2WXR9pOld5Aq66op1z+i9aRniM/YCUA79mqWVWSe0KeIS1Xwcfvfwfjyf4W27RfyfFCI6y7B4T9zs4+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784784710; c=relaxed/simple; bh=3fvCknCwajnOMYIUp1uHwU+nFkwRbCJkD6DOdmYgiUU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Vclb05wX4ymGAeH0zNrSYSgrC43UdjeUkA9fPYC8NMqpKh5zz2sAFapY3giWRSc+xh1SzlqSrjyWrquEQGpazSDtFx7rtDl70nt0j59nW3K2U9YCp8dwom0oz9uyisPHbiQB0Z8WmgKhgVmx4oI/0J3NlObZzoQ9EwQ0FGeYASs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Thu, 23 Jul 2026 13:31:42 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Thu, 23 Jul 2026 13:31:42 +0800 From: Yu-Che Hsieh Date: Thu, 23 Jul 2026 13:31:37 +0800 Subject: [PATCH RFC 1/2] dt-bindings: mfd: aspeed-lpc: Document lpcN alias for multi-instance SoCs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260723-upstream_kcs_multiple_lpc-v1-1-d918b5270b86@aspeedtech.com> References: <20260723-upstream_kcs_multiple_lpc-v1-0-d918b5270b86@aspeedtech.com> In-Reply-To: <20260723-upstream_kcs_multiple_lpc-v1-0-d918b5270b86@aspeedtech.com> To: Lee Jones , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Joel Stanley" , Andrew Jeffery , Chia-Wei Wang , Corey Minyard CC: Andrew Jeffery , , , , , , Yu-Che Hsieh X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784784702; l=1505; i=yc_hsieh@aspeedtech.com; s=20260721; h=from:subject:message-id; bh=3fvCknCwajnOMYIUp1uHwU+nFkwRbCJkD6DOdmYgiUU=; b=54NDWFbpmjgTCayZVRksXExIbQ2rB7HOlCxNsWWxw8M7S7h+43hSKjtyzudtnvt8nN6bDg724 36wWYyTZKN7BWGSuOe/vc5BmPefUhb24zUV6FnBQslj5WmsmhjEU5rM X-Developer-Key: i=yc_hsieh@aspeedtech.com; a=ed25519; pk=7KnU2ozXGF2IATT+Hvu7RbRwPxBA3/b+zhfM+UsPJMs= Some SoCs (e.g. AST2700) expose more than one physical LPC controller instance. Downstream devices such as KCS channels need a stable, globally-unique index derived from which LPC controller instance they belong to, so document the "lpcN" alias convention on the LPC controller node that lets DT authors assign a fixed index per instance, mirroring the existing alias-based numbering convention used by mmc/i2c/spi/serial. Signed-off-by: Yu-Che Hsieh --- Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml b/Docume= ntation/devicetree/bindings/mfd/aspeed-lpc.yaml index cbc3a2485a2f..81c12e0fb312 100644 --- a/Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +++ b/Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml @@ -35,6 +35,13 @@ description: configuration, therefore the host portion of the controller is exposed a= s a syscon as a means to arbitrate access. =20 + On SoCs that expose more than one LPC controller instance, it is possibl= e to + assign a fixed index to a given instance (and thus to downstream devices + such as KCS channels that must be uniquely identified system-wide) by + defining an "lpcN" alias for it in the /aliases device tree node. If no = such + alias is present, the SoC is treated as having a single LPC controller + instance. + properties: compatible: items: --=20 2.34.1 From nobody Fri Jul 24 05:22:57 2026 Received: from twmbx01.aspeedtech.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B89A93A5435; Thu, 23 Jul 2026 05:31:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784784713; cv=none; b=kcCi6OKr6HDncje/rgdyRYUEpRZuPOZBJi5qGvRSEQRrWStyFj2C423gUi/s361646Oq/ovPyV57RSb7t2+OC4ZYIAXojX/1TOLtWuYSwgb7tT62GguNluIc9WowDuyJscoBqFg6Db2IsMbNIzhHtXU2ftUQKhasAx2Zio/TaO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784784713; c=relaxed/simple; bh=WCkY6ru4QaUOU33knVeXbs5BBFO1adD73YX6nr6ufaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=LST/gLbMtrC4aEMnFUW6cWhz6J1D7+X/rBlq54ZiM5fuJi8qA0ijWNjGj54TW39giP5ylgKNOYbp/EeCes5EaP3gBgTQHOiwiIMRcjVrepSQraeNkr7OB4lZ32tRr8TwuACUGXVIknObKGMmbaleESCUv8kPUJhengV9ds+rAqw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Thu, 23 Jul 2026 13:31:42 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Thu, 23 Jul 2026 13:31:42 +0800 From: Yu-Che Hsieh Date: Thu, 23 Jul 2026 13:31:38 +0800 Subject: [PATCH RFC 2/2] ipmi: kcs_bmc_aspeed: Support multiple LPC controller instances Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260723-upstream_kcs_multiple_lpc-v1-2-d918b5270b86@aspeedtech.com> References: <20260723-upstream_kcs_multiple_lpc-v1-0-d918b5270b86@aspeedtech.com> In-Reply-To: <20260723-upstream_kcs_multiple_lpc-v1-0-d918b5270b86@aspeedtech.com> To: Lee Jones , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Joel Stanley" , Andrew Jeffery , Chia-Wei Wang , Corey Minyard CC: Andrew Jeffery , , , , , , Yu-Che Hsieh X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784784702; l=6125; i=yc_hsieh@aspeedtech.com; s=20260721; h=from:subject:message-id; bh=WCkY6ru4QaUOU33knVeXbs5BBFO1adD73YX6nr6ufaE=; b=qu3mKDSW024Lstm35DdVqbd5L/9osovxUg4aLC1RhM91zWU5pAcLSM3Ve5NV8KmLvLiOIYBnc kLGcSjXCcLPBi+RO4zDu5VLMol13Xw2XyHWOIh4XOPQ+wxRrbAT+OP+ X-Developer-Key: i=yc_hsieh@aspeedtech.com; a=ed25519; pk=7KnU2ozXGF2IATT+Hvu7RbRwPxBA3/b+zhfM+UsPJMs= Some SoCs (e.g. AST2700) expose more than one physical LPC controller, each instantiating its own independent set of KCS0-KCS3 channels using identical IDR/ODR/STR register offsets. kcs_bmc_device::channel is currently overloaded to serve two distinct purposes: selecting which HICR0/HICR2/HICRB bit-group to touch within a single LPC controller's register file, and naming the misc chardev (/dev/ipmi-kcsN) exposed to userspace, which must be unique system-wide. The two purposes happen to share the same value only because the driver has so far only had to support SoCs with a single LPC controller. On a multi-controller SoC, KCS0 on every LPC controller computes to the same channel number, and whichever instance probes second fails to register its chardev. Split the two roles: keep a new driver-private `channel` field (1..4) in struct aspeed_kcs_bmc for register access, leaving all the HICR/IBFIE/LPCxE switch statements operating on it, and derive kcs_bmc_device::channel as `bank * KCS_CHANNEL_MAX + channel`, where `bank` identifies which LPC controller instance a KCS device belongs to. `bank` is obtained from an optional "lpcN" alias on the LPC controller node via of_alias_get_id(), following the same convention already used by mmc/i2c/spi/serial for instance numbering. SoCs with a single LPC controller, and existing DTs that don't declare the alias, fall back to bank 0, so /dev/ipmi-kcsN naming is unchanged for all existing boards. Signed-off-by: Yu-Che Hsieh --- drivers/char/ipmi/kcs_bmc_aspeed.c | 37 +++++++++++++++++++++++++++-------= --- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc= _aspeed.c index a13a3470c17a..591c11a44503 100644 --- a/drivers/char/ipmi/kcs_bmc_aspeed.c +++ b/drivers/char/ipmi/kcs_bmc_aspeed.c @@ -125,6 +125,8 @@ struct aspeed_kcs_bmc { bool remove; struct timer_list timer; } obe; + + u32 channel; }; =20 static inline struct aspeed_kcs_bmc *to_aspeed_kcs_bmc(struct kcs_bmc_devi= ce *kcs_bmc) @@ -167,7 +169,7 @@ static void aspeed_kcs_outb(struct kcs_bmc_device *kcs_= bmc, u32 reg, u8 data) if (priv->upstream_irq.mode !=3D aspeed_kcs_irq_serirq) return; =20 - switch (kcs_bmc->channel) { + switch (priv->channel) { case 1: switch (priv->upstream_irq.id) { case 12: @@ -232,7 +234,7 @@ static int aspeed_kcs_set_address(struct kcs_bmc_device= *kcs_bmc, u32 addrs[2], if (WARN_ON(nr_addrs < 1 || nr_addrs > 2)) return -EINVAL; =20 - switch (priv->kcs_bmc.channel) { + switch (priv->channel) { case 1: regmap_update_bits(priv->map, LPC_HICR4, LPC_HICR4_LADR12AS, 0); regmap_write(priv->map, LPC_LADR12H, addrs[0] >> 8); @@ -315,7 +317,7 @@ static int aspeed_kcs_config_upstream_irq(struct aspeed= _kcs_bmc *priv, u32 id, u priv->upstream_irq.mode =3D aspeed_kcs_irq_serirq; priv->upstream_irq.id =3D id; =20 - switch (priv->kcs_bmc.channel) { + switch (priv->channel) { case 1: /* Needs IRQxE1 rather than (ID1IRQX, SEL1IRQX, IRQXE1) before AST2600 A= 3 */ break; @@ -347,7 +349,7 @@ static int aspeed_kcs_config_upstream_irq(struct aspeed= _kcs_bmc *priv, u32 id, u default: dev_warn(priv->kcs_bmc.dev, "SerIRQ configuration not supported on KCS channel %d\n", - priv->kcs_bmc.channel); + priv->channel); return -EINVAL; } =20 @@ -358,7 +360,7 @@ static void aspeed_kcs_enable_channel(struct kcs_bmc_de= vice *kcs_bmc, bool enabl { struct aspeed_kcs_bmc *priv =3D to_aspeed_kcs_bmc(kcs_bmc); =20 - switch (kcs_bmc->channel) { + switch (priv->channel) { case 1: regmap_update_bits(priv->map, LPC_HICR0, LPC_HICR0_LPC1E, enable * LPC_H= ICR0_LPC1E); return; @@ -374,7 +376,7 @@ static void aspeed_kcs_enable_channel(struct kcs_bmc_de= vice *kcs_bmc, bool enabl regmap_update_bits(priv->map, LPC_HICRB, LPC_HICRB_LPC4E, enable * LPC_H= ICRB_LPC4E); return; default: - pr_warn("%s: Unsupported channel: %d", __func__, kcs_bmc->channel); + pr_warn("%s: Unsupported channel: %d", __func__, priv->channel); return; } } @@ -435,7 +437,7 @@ static void aspeed_kcs_irq_mask_update(struct kcs_bmc_d= evice *kcs_bmc, u8 mask, if (mask & KCS_BMC_EVENT_TYPE_IBF) { const bool enable =3D !!(state & KCS_BMC_EVENT_TYPE_IBF); =20 - switch (kcs_bmc->channel) { + switch (priv->channel) { case 1: regmap_update_bits(priv->map, LPC_HICR2, LPC_HICR2_IBFIE1, enable * LPC_HICR2_IBFIE1); @@ -453,7 +455,7 @@ static void aspeed_kcs_irq_mask_update(struct kcs_bmc_d= evice *kcs_bmc, u8 mask, enable * LPC_HICRB_IBFIE4); return; default: - pr_warn("%s: Unsupported channel: %d", __func__, kcs_bmc->channel); + pr_warn("%s: Unsupported channel: %d", __func__, priv->channel); return; } } @@ -526,6 +528,17 @@ static int aspeed_kcs_of_get_channel(struct platform_d= evice *pdev) return -EINVAL; } =20 +static int aspeed_kcs_of_get_bank(struct device_node *lpc_np) +{ + int id; + + id =3D of_alias_get_id(lpc_np, "lpc"); + if (id < 0) + return 0; + + return id; +} + static int aspeed_kcs_of_get_io_address(struct platform_device *pdev, u32 addrs[2]) { @@ -559,7 +572,7 @@ static int aspeed_kcs_probe(struct platform_device *pde= v) struct device_node *np; bool have_upstream_irq; u32 upstream_irq[2]; - int rc, channel; + int rc, channel, bank; int nr_addrs; u32 addrs[2]; =20 @@ -575,6 +588,8 @@ static int aspeed_kcs_probe(struct platform_device *pde= v) if (channel < 0) return channel; =20 + bank =3D aspeed_kcs_of_get_bank(np); + nr_addrs =3D aspeed_kcs_of_get_io_address(pdev, addrs); if (nr_addrs < 0) return nr_addrs; @@ -590,9 +605,11 @@ static int aspeed_kcs_probe(struct platform_device *pd= ev) if (!priv) return -ENOMEM; =20 + priv->channel =3D channel; + kcs_bmc =3D &priv->kcs_bmc; kcs_bmc->dev =3D &pdev->dev; - kcs_bmc->channel =3D channel; + kcs_bmc->channel =3D bank * KCS_CHANNEL_MAX + channel; kcs_bmc->ioreg =3D ast_kcs_bmc_ioregs[channel - 1]; kcs_bmc->ops =3D &aspeed_kcs_ops; =20 --=20 2.34.1