Skip to content

Commit 00080d0

Browse files
damien-lemoalbjorn-helgaas
authored andcommitted
PCI: rockship-ep: Implement the pci_epc_ops::stop_link() operation
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>
1 parent 091022f commit 00080d0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/pci/controller/pcie-rockchip-ep.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,18 @@ static int rockchip_pcie_ep_start(struct pci_epc *epc)
476476
return 0;
477477
}
478478

479+
static void rockchip_pcie_ep_stop(struct pci_epc *epc)
480+
{
481+
struct rockchip_pcie_ep *ep = epc_get_drvdata(epc);
482+
struct rockchip_pcie *rockchip = &ep->rockchip;
483+
484+
/* Stop link training and disable configuration */
485+
rockchip_pcie_write(rockchip,
486+
PCIE_CLIENT_CONF_DISABLE |
487+
PCIE_CLIENT_LINK_TRAIN_DISABLE,
488+
PCIE_CLIENT_CONFIG);
489+
}
490+
479491
static const struct pci_epc_features rockchip_pcie_epc_features = {
480492
.linkup_notifier = false,
481493
.msi_capable = true,
@@ -500,6 +512,7 @@ static const struct pci_epc_ops rockchip_pcie_epc_ops = {
500512
.get_msi = rockchip_pcie_ep_get_msi,
501513
.raise_irq = rockchip_pcie_ep_raise_irq,
502514
.start = rockchip_pcie_ep_start,
515+
.stop = rockchip_pcie_ep_stop,
503516
.get_features = rockchip_pcie_ep_get_features,
504517
};
505518

drivers/pci/controller/pcie-rockchip.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define PCIE_CLIENT_CONF_ENABLE HIWORD_UPDATE_BIT(0x0001)
3333
#define PCIE_CLIENT_CONF_DISABLE HIWORD_UPDATE(0x0001, 0)
3434
#define PCIE_CLIENT_LINK_TRAIN_ENABLE HIWORD_UPDATE_BIT(0x0002)
35+
#define PCIE_CLIENT_LINK_TRAIN_DISABLE HIWORD_UPDATE(0x0002, 0)
3536
#define PCIE_CLIENT_ARI_ENABLE HIWORD_UPDATE_BIT(0x0008)
3637
#define PCIE_CLIENT_CONF_LANE_NUM(x) HIWORD_UPDATE(0x0030, ENCODE_LANES(x))
3738
#define PCIE_CLIENT_MODE_RC HIWORD_UPDATE_BIT(0x0040)

0 commit comments

Comments
 (0)