]> www.infradead.org Git - users/hch/xfs.git/commitdiff
PCI: rockship-ep: Implement the pci_epc_ops::stop_link() operation
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 17 Oct 2024 01:58:46 +0000 (10:58 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 25 Nov 2024 19:18:36 +0000 (13:18 -0600)
Define the EPC operation ->stop() for the Rockchip endpoint driver with
the function rockchip_pcie_ep_stop(). This function disables link
training and the controller configuration, as the reverse to what
the start operation defined with rockchip_pcie_ep_start() does.

Link: https://lore.kernel.org/r/20241017015849.190271-12-dlemoal@kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/controller/pcie-rockchip-ep.c
drivers/pci/controller/pcie-rockchip.h

index 6c4169b7930e6b4a01048f4ed6eefe900113c977..13755e4ed59defb66d01df1af2cb63400efe0e84 100644 (file)
@@ -476,6 +476,18 @@ static int rockchip_pcie_ep_start(struct pci_epc *epc)
        return 0;
 }
 
+static void rockchip_pcie_ep_stop(struct pci_epc *epc)
+{
+       struct rockchip_pcie_ep *ep = epc_get_drvdata(epc);
+       struct rockchip_pcie *rockchip = &ep->rockchip;
+
+       /* Stop link training and disable configuration */
+       rockchip_pcie_write(rockchip,
+                           PCIE_CLIENT_CONF_DISABLE |
+                           PCIE_CLIENT_LINK_TRAIN_DISABLE,
+                           PCIE_CLIENT_CONFIG);
+}
+
 static const struct pci_epc_features rockchip_pcie_epc_features = {
        .linkup_notifier = false,
        .msi_capable = true,
@@ -500,6 +512,7 @@ static const struct pci_epc_ops rockchip_pcie_epc_ops = {
        .get_msi        = rockchip_pcie_ep_get_msi,
        .raise_irq      = rockchip_pcie_ep_raise_irq,
        .start          = rockchip_pcie_ep_start,
+       .stop           = rockchip_pcie_ep_stop,
        .get_features   = rockchip_pcie_ep_get_features,
 };
 
index 30398156095f91cd19f9296de86b0a5f9c17e030..0263f158ee8de845700f9968d2be97f3a3e5357c 100644 (file)
@@ -32,6 +32,7 @@
 #define   PCIE_CLIENT_CONF_ENABLE        HIWORD_UPDATE_BIT(0x0001)
 #define   PCIE_CLIENT_CONF_DISABLE       HIWORD_UPDATE(0x0001, 0)
 #define   PCIE_CLIENT_LINK_TRAIN_ENABLE          HIWORD_UPDATE_BIT(0x0002)
+#define   PCIE_CLIENT_LINK_TRAIN_DISABLE  HIWORD_UPDATE(0x0002, 0)
 #define   PCIE_CLIENT_ARI_ENABLE         HIWORD_UPDATE_BIT(0x0008)
 #define   PCIE_CLIENT_CONF_LANE_NUM(x)   HIWORD_UPDATE(0x0030, ENCODE_LANES(x))
 #define   PCIE_CLIENT_MODE_RC            HIWORD_UPDATE_BIT(0x0040)