]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: amd-mdb: Assert PERST# on shutdown
authorSai Krishna Musham <sai.krishna.musham@amd.com>
Mon, 27 Apr 2026 12:12:27 +0000 (17:42 +0530)
committerManivannan Sadhasivam <mani@kernel.org>
Tue, 12 May 2026 13:13:21 +0000 (18:43 +0530)
Add a shutdown handler for the AMD MDB PCIe host controller that
asserts the PERST# signal via GPIO before the system powers off or
reboots. This ensures the connected PCIe endpoint is held in reset
during shutdown.

Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
[mani: removed conditional check since GPIO APIs return safely if desc is NULL]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20260427121227.290604-1-sai.krishna.musham@amd.com
drivers/pci/controller/dwc/pcie-amd-mdb.c

index 7e50e11fbffda24400ad46ea76738f725c8f2053..fe568d8715797e0a421a96b53ec750be16e7b1bb 100644 (file)
@@ -507,6 +507,13 @@ static int amd_mdb_pcie_probe(struct platform_device *pdev)
        return amd_mdb_add_pcie_port(pcie, pdev);
 }
 
+static void amd_mdb_pcie_shutdown(struct platform_device *pdev)
+{
+       struct amd_mdb_pcie *pcie = platform_get_drvdata(pdev);
+
+       gpiod_set_value_cansleep(pcie->perst_gpio, 1);
+}
+
 static const struct of_device_id amd_mdb_pcie_of_match[] = {
        {
                .compatible = "amd,versal2-mdb-host",
@@ -521,6 +528,7 @@ static struct platform_driver amd_mdb_pcie_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = amd_mdb_pcie_probe,
+       .shutdown = amd_mdb_pcie_shutdown,
 };
 
 builtin_platform_driver(amd_mdb_pcie_driver);