Skip to content

Commit fddebfa

Browse files
FROMLIST: PCI: qcom: Add support for host_stop_link() & host_start_link()
Add support for host_stop_link() and host_start_link() for switches like TC956x, which require configuration before the PCIe link is established. Assert PERST# and disable LTSSM bit to prevent the PCIe controller from participating in link training during host_stop_link(). De-assert PERST# and enable LTSSM bit during host_start_link(). Introduce ltssm_disable function op to stop link training. For the switches like TC956x, which needs to configure it before the PCIe link is established. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Krishna Chaitanya Chundru <[email protected]>
1 parent eab34c8 commit fddebfa

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

drivers/pci/controller/dwc/pcie-qcom.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ struct qcom_pcie_ops {
249249
int (*post_init)(struct qcom_pcie *pcie);
250250
void (*deinit)(struct qcom_pcie *pcie);
251251
void (*ltssm_enable)(struct qcom_pcie *pcie);
252+
void (*ltssm_disable)(struct qcom_pcie *pcie);
252253
int (*config_sid)(struct qcom_pcie *pcie);
253254
};
254255

@@ -640,6 +641,37 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
640641
return 0;
641642
}
642643

644+
static int qcom_pcie_host_start_link(struct dw_pcie *pci)
645+
{
646+
struct qcom_pcie *pcie = to_qcom_pcie(pci);
647+
648+
qcom_ep_reset_deassert(pcie);
649+
650+
if (pcie->cfg->ops->ltssm_enable)
651+
pcie->cfg->ops->ltssm_enable(pcie);
652+
653+
return 0;
654+
}
655+
656+
static void qcom_pcie_host_stop_link(struct dw_pcie *pci)
657+
{
658+
struct qcom_pcie *pcie = to_qcom_pcie(pci);
659+
660+
qcom_ep_reset_assert(pcie);
661+
662+
if (pcie->cfg->ops->ltssm_disable)
663+
pcie->cfg->ops->ltssm_disable(pcie);
664+
}
665+
666+
static void qcom_pcie_2_3_2_ltssm_disable(struct qcom_pcie *pcie)
667+
{
668+
u32 val;
669+
670+
val = readl(pcie->parf + PARF_LTSSM);
671+
val &= ~LTSSM_EN;
672+
writel(val, pcie->parf + PARF_LTSSM);
673+
}
674+
643675
static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie)
644676
{
645677
u32 val;
@@ -1378,6 +1410,7 @@ static const struct qcom_pcie_ops ops_1_9_0 = {
13781410
.post_init = qcom_pcie_post_init_2_7_0,
13791411
.deinit = qcom_pcie_deinit_2_7_0,
13801412
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
1413+
.ltssm_disable = qcom_pcie_2_3_2_ltssm_disable,
13811414
.config_sid = qcom_pcie_config_sid_1_9_0,
13821415
};
13831416

@@ -1448,6 +1481,8 @@ static const struct qcom_pcie_cfg cfg_fw_managed = {
14481481
static const struct dw_pcie_ops dw_pcie_ops = {
14491482
.link_up = qcom_pcie_link_up,
14501483
.start_link = qcom_pcie_start_link,
1484+
.host_start_link = qcom_pcie_host_start_link,
1485+
.host_stop_link = qcom_pcie_host_stop_link,
14511486
};
14521487

14531488
static int qcom_pcie_icc_init(struct qcom_pcie *pcie)

0 commit comments

Comments
 (0)