From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4D90456E18 for ; Tue, 18 Aug 2026 10:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787049112; cv=none; b=HQrVP2fhXbvBuucnibKt6+fZ4c1P7ZDyv6y/f3TcAUTz6EgrL17encOyqtwtt9sUkyyhqmc+XADjFuoKIGg1X8lomn+Lzffxa8FNHJDhrOnsHc46GZ2m6+Sevh0oUMocOx6MurKZeKg2w8tWZJ+DDzFiQLTtNPWCbXMnXgvo0bg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787049112; c=relaxed/simple; bh=/ZnDVyFXyOMlnp+4kOKxjkZE8/hrh/AgeryTNVSXcuo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ghSdKoEoQJl8sBJhBJZA59Fl5/LeBMQqIH8t1xJ/m3ZfzDXWfabtknJ7T4oiPNGQoCrCW8bcEoRmciyl9gMLLA6kOe+kx8PU5qZ8qvhloiIMFI/Uaw+GW03oBh1v6aHdQ0p3DKlGdR863OsPYXJvG6+JOUm0vYEPbrAdnnvQM/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=9elements.com; spf=pass smtp.mailfrom=9elements.com; dkim=pass (2048-bit key) header.d=9elements.com header.i=@9elements.com header.b=RvoR4Z9U; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=9elements.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=9elements.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=9elements.com header.i=@9elements.com header.b="RvoR4Z9U" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-493b966dd74so29945915e9.3 for ; Tue, 18 Aug 2026 03:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1787049107; x=1787653907; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qjRJ6CK8+10XxSw1IIq1k9Y5+IsaxjCnKt7BPw+fxxg=; b=RvoR4Z9UvM+sMGDd3enlJN2ZTXOo5Y9aGUHxPelaphJ8xyF54+XpWlyabPRfY4v+Ho 7iuQgja95neLs55EzFdPOCWDEt+WZMc/MY8OklkbirzxMSL5ejmS2Bs8sC80O82hmh1s +2DOpNIYi6B/0mAOpPOMmjvNbxcRYHEV7rCuN6Jw+3VCmYndW1lbia8JZ3a1c3mUSbiL bTWuK0kM6xoxMH8Z3ecB7P3DzvoHCGgWdBGmgtuiuKvo3DUcTLqbouzBHULgfwxMY/Ep SzAcmgTbXj5OHAFwbYqkyecaUIVNiTLI9S6cizdUyxQIy9inKNiLSUc5x/SC9Tew/Fzu X2Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787049107; x=1787653907; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qjRJ6CK8+10XxSw1IIq1k9Y5+IsaxjCnKt7BPw+fxxg=; b=jlcHgp0tDUkeVKA8LM6Q6YfySuZvyOxbqQ4c9VMhHv+qUmSzbtyeit6o+btRb/m5nc FIk3lV96Vhlh4beLw+A9Z3r2fqCDr2cu0VVDQaL6w3j7MdtFiKYkJTWHRbiqN3v5qM9s 44+QAoQReCseOZlAfi1mAAWNrphZ0rtGfcTHWiPCB69k7SAgKs1aRgVZVhFR9K3dIVqs zIWDd2GGpJi13ACs4tiWRe5GjndpZqcXa7dvJB7VQ8olMrqhYVHEjiNCxCjFKMtqNXgr lB/XFnKr+SBBdCdpCLO9ZhbLyFZYxVInm9gKL9WYzRHHovqIv8R6Nf7ustFZc7aqI95E e7iQ== X-Gm-Message-State: AOJu0YzhYse6odXuNTV18DpFOv46XQAosMYMQtEv0J7v4IkxVjyS9RmP 37lTqjIZpcls5F8rxxuGLy8I5bO1TAgXUx4jwfOlAvaJkHO+kDvyKHyYifh4G7tVHEk= X-Gm-Gg: AR+sD11qAemHqsr1gAeMcgIlyj60YzmFcv2GTTT6h8svjzQhgqUfWkVhaXkzqdhlG7I ifJy8JFt3wkE/VgDG9klgSfQtervwgTf9xm13lP3K9i88VF/P2REEfV7vHqCN6Od7/QlzGJzL31 YjKjw0fL43ZaygVOxxaO+pUi8Tn/WLZFeQTfkENYnTzDmvabSE+oMWEm8Q503IWxtpkMjoEySPQ H1Q/Umg2LeWDyH5TV1HS3zWJluyUYAOy6qBDMuSsCCo4JXudZcgxme8yzj2k9e5+wHvccEFkI/Z BEWJPZEIId2eTr+JBeEiyfLjJbwT5Km/q22gXZO+4DuHCR0P8zSsZgvmlgXC/IB+2a+ZHJNBV9U zqG3nzwXDrX7jB7ca3G5SOaGcYV9aYwsjgS5GhUGIu76bAGC7ZfGJe3IuXFvhplBKWpkF6eGVmZ c3HBTYFHX5evjzYnU8SUknklsB2HSv/QmnOmEaZixVw4u25DufgkVYZR3aD75Q6gOzTi/NVl81O jMSiTkoGqK2TRQXblFqqBI2FjEeEKBZ743BCU5Gh9N9zUejQUDNwQPKcY24 X-Received: by 2002:a05:600c:3b1d:b0:499:79b9:e226 with SMTP id 5b1f17b1804b1-49988057986mr490766875e9.0.1787049107156; Tue, 18 Aug 2026 03:31:47 -0700 (PDT) Received: from [127.0.0.2] ([188.111.3.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499960988c6sm246025575e9.0.2026.08.18.03.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 03:31:46 -0700 (PDT) From: =?utf-8?q?Gr=C3=A9goire_Layet?= Date: Tue, 18 Aug 2026 10:29:16 +0000 Subject: [PATCH v6 3/6] serial: 8250_aspeed_vuart: add VUART over PCI 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: 8bit Message-Id: <20260818-aspeed-driver-v6-v6-3-fd7cc0b338ea@9elements.com> References: <20260818-aspeed-driver-v6-v6-0-fd7cc0b338ea@9elements.com> In-Reply-To: <20260818-aspeed-driver-v6-v6-0-fd7cc0b338ea@9elements.com> To: Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lubomir Rintel , devicetree@vger.kernel.org, Joel Stanley , Andrew Jeffery , Lee Jones , =?utf-8?q?Gr=C3=A9goire_Layet?= , Tan Siewert Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, mfd@lists.linux.dev, andrew@lunn.ch, jacky_chou@aspeedtech.com, yh_chung@aspeedtech.com, ninad@linux.ibm.com, anirudhsriniv@gmail.com, =?utf-8?q?Gr=C3=A9goire_Layet?= X-Mailer: b4 0.15.2 Enable the VUART over PCI for the AST2600. Activate it only if the 'aspeed,vuart-over-pci' property flag is set on an 'ast2600-vuart' compatible node. The AST2600 has 2 VUART that are usable over PCI. These are already defined as the VUART3 and VUART4 in the 'aspeed-g6.dtsi'. Sets the BMC PCI device enable bits, sets the PCI class code to unassgined/device specific, and configures MSI interrupts. There is no disable function. Removing this driver should not disable the BMC PCI device, as other drivers could use it. However, if all the drivers using it are removed, the BMC PCI device will still be activated, which is not ideal. But in reality, this is not a use case for a BMC, the drivers will never be removed. This is useful on PCIe BMC expansion cards that use the AST2600, such as the ASUS Kommando IPMI Expansion Card. Register initialisation taken from ASPEED 6.18 Kernel SDK. Add return code checks to each register write. Simplify the code and add macros. The ASPEED_SCUC24 regmap update is use an undefined reserved register ASPEED_SCUC24_RESERVED_14. I was unable to determine the purpose of this bit. In the AST2600 A3 datasheet it is marked as 'reserved'. It is only used on the other revision. As I only have the AST2600A3, I was unable to try this code path. This BIT14 was set in the ASPEED SDK so I kept it. I can remove it and the untested path if necessary. Signed-off-by: Jacky Chou Signed-off-by: aspeedyh Reviewed-by: Tan Siewert Signed-off-by: Grégoire Layet --- drivers/tty/serial/8250/8250_aspeed_vuart.c | 91 +++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index 6afa2f4057e1..2360d37139bf 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -32,6 +32,28 @@ #define ASPEED_VUART_DEFAULT_SIRQ 4 #define ASPEED_VUART_DEFAULT_SIRQ_POLARITY IRQ_TYPE_LEVEL_LOW +#define ASPEED_SCU_SILICON_REVISION_ID 0x04 +#define AST2600A3_REVISION_ID 0x05030303 + +#define ASPEED_SCU_PCIE_CONF_CTRL 0xC20 +#define SCU_PCIE_CONF_BMC_DEV_EN BIT(8) +#define SCU_PCIE_CONF_BMC_DEV_EN_MMIO BIT(9) +#define SCU_PCIE_CONF_BMC_DEV_EN_MSI BIT(11) +#define SCU_PCIE_CONF_BMC_DEV_EN_IRQ BIT(13) +#define SCU_PCIE_CONF_BMC_DEV_EN_PCIE_BUS_MASTER BIT(14) +#define SCU_PCIE_CONF_BMC_DEV_EN_E2L BIT(15) +#define SCU_PCIE_CONF_BMC_DEV_EN_LPC_DECODE BIT(21) + +#define ASPEED_SCUC24 0xC24 +#define ASPEED_SCUC24_MSI_ROUTING_MASK GENMASK(11, 10) +#define ASPEED_SCUC24_MSI_ROUTING_PCIE2LPC_PCIDEV1 \ + FIELD_PREP(ASPEED_SCUC24_MSI_ROUTING_MASK, 2) +#define ASPEED_SCUC24_RESERVED_14 BIT(14) +#define ASPEED_SCUC24_PCIDEV1_INTX_MSI_SCU560_EN BIT(17) +#define ASPEED_SCUC24_PCIDEV1_INTX_MSI_HOST2BMC_EN BIT(18) + +#define ASPEED_SCU_BMC_DEV_CLASS 0xC68 + struct aspeed_vuart { struct device *dev; int line; @@ -412,6 +434,66 @@ static int aspeed_vuart_map_irq_polarity(u32 dt) } } +static int aspeed_ast2600_vuart_over_pci_set_enabled(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + u32 silicon_revision_id; + struct regmap *scu; + int rc; + + u32 pcie_config_ctl = SCU_PCIE_CONF_BMC_DEV_EN_IRQ | + SCU_PCIE_CONF_BMC_DEV_EN_MMIO | + SCU_PCIE_CONF_BMC_DEV_EN_MSI | + SCU_PCIE_CONF_BMC_DEV_EN_PCIE_BUS_MASTER | + SCU_PCIE_CONF_BMC_DEV_EN_E2L | + SCU_PCIE_CONF_BMC_DEV_EN_LPC_DECODE | + SCU_PCIE_CONF_BMC_DEV_EN; + + scu = syscon_regmap_lookup_by_phandle(dev->of_node, "aspeed,scu-syscon"); + if (IS_ERR(scu)) { + dev_err(dev, "failed to find SCU regmap\n"); + return PTR_ERR(scu); + } + + /* update class code to be an Unassigned/device specific class device */ + if (regmap_write(scu, ASPEED_SCU_BMC_DEV_CLASS, 0xff000000)) { + dev_err(dev, "could not set PCIe class code\n"); + return -EIO; + } + + if (regmap_update_bits(scu, ASPEED_SCU_PCIE_CONF_CTRL, + pcie_config_ctl, pcie_config_ctl)) { + dev_err(dev, "could not set PCIe configuration\n"); + return -EIO; + } + + if (regmap_read(scu, ASPEED_SCU_SILICON_REVISION_ID, &silicon_revision_id)) { + dev_err(dev, "could not read silicon revision\n"); + return -EIO; + } + + if (silicon_revision_id == AST2600A3_REVISION_ID) + rc = regmap_update_bits(scu, ASPEED_SCUC24, + ASPEED_SCUC24_PCIDEV1_INTX_MSI_HOST2BMC_EN | + ASPEED_SCUC24_MSI_ROUTING_MASK, + ASPEED_SCUC24_PCIDEV1_INTX_MSI_HOST2BMC_EN | + ASPEED_SCUC24_MSI_ROUTING_PCIE2LPC_PCIDEV1); + else + rc = regmap_update_bits(scu, ASPEED_SCUC24, + ASPEED_SCUC24_PCIDEV1_INTX_MSI_SCU560_EN | + ASPEED_SCUC24_RESERVED_14 | + ASPEED_SCUC24_MSI_ROUTING_MASK, + ASPEED_SCUC24_PCIDEV1_INTX_MSI_SCU560_EN | + ASPEED_SCUC24_RESERVED_14 | + ASPEED_SCUC24_MSI_ROUTING_PCIE2LPC_PCIDEV1); + if (rc) { + dev_err(dev, "could not set PCI device 1 MSI interrupt routing\n"); + return -EIO; + } + + return 0; +} + static int aspeed_vuart_probe(struct platform_device *pdev) { struct of_phandle_args sirq_polarity_sense_args; @@ -540,6 +622,15 @@ static int aspeed_vuart_probe(struct platform_device *pdev) aspeed_vuart_set_host_tx_discard(vuart, true); platform_set_drvdata(pdev, vuart); + if (of_device_is_compatible(dev->of_node, "aspeed,ast2600-vuart") && + of_property_read_bool(dev->of_node, "aspeed,vuart-over-pci")) { + rc = aspeed_ast2600_vuart_over_pci_set_enabled(pdev); + if (rc < 0) { + dev_err_probe(dev, rc, "could not enable VUART over PCI\n"); + goto err_sysfs_remove; + } + } + return 0; err_sysfs_remove: -- 2.54.0