Skip to content

Commit 123971a

Browse files
nxpfrankliLorenzo Pieralisi
authored andcommitted
PCI: layerscape: Add function pointer for exit_from_l2()
Since different SoCs require different sequences for exiting L2, let's add a separate "exit_from_l2()" callback to handle SoC specific sequences. Change ls_pcie_exit_from_l2() return value from void to int in order to propagate errors. Return an error if the exit_from_l2() callback fails in the resume flow. Link: https://lore.kernel.org/r/20231204160829.2498703-2-Frank.Li@nxp.com Signed-off-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Acked-by: Roy Zang <Roy.Zang@nxp.com>
1 parent b85ea95 commit 123971a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/pci/controller/dwc/pci-layerscape.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
struct ls_pcie_drvdata {
4141
const u32 pf_off;
42+
int (*exit_from_l2)(struct dw_pcie_rp *pp);
4243
bool pm_support;
4344
};
4445

@@ -125,7 +126,7 @@ static void ls_pcie_send_turnoff_msg(struct dw_pcie_rp *pp)
125126
dev_err(pcie->pci->dev, "PME_Turn_off timeout\n");
126127
}
127128

128-
static void ls_pcie_exit_from_l2(struct dw_pcie_rp *pp)
129+
static int ls_pcie_exit_from_l2(struct dw_pcie_rp *pp)
129130
{
130131
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
131132
struct ls_pcie *pcie = to_ls_pcie(pci);
@@ -150,6 +151,8 @@ static void ls_pcie_exit_from_l2(struct dw_pcie_rp *pp)
150151
10000);
151152
if (ret)
152153
dev_err(pcie->pci->dev, "L2 exit timeout\n");
154+
155+
return ret;
153156
}
154157

155158
static int ls_pcie_host_init(struct dw_pcie_rp *pp)
@@ -180,6 +183,7 @@ static const struct ls_pcie_drvdata ls1021a_drvdata = {
180183
static const struct ls_pcie_drvdata layerscape_drvdata = {
181184
.pf_off = 0xc0000,
182185
.pm_support = true,
186+
.exit_from_l2 = ls_pcie_exit_from_l2,
183187
};
184188

185189
static const struct of_device_id ls_pcie_of_match[] = {
@@ -247,11 +251,14 @@ static int ls_pcie_suspend_noirq(struct device *dev)
247251
static int ls_pcie_resume_noirq(struct device *dev)
248252
{
249253
struct ls_pcie *pcie = dev_get_drvdata(dev);
254+
int ret;
250255

251256
if (!pcie->drvdata->pm_support)
252257
return 0;
253258

254-
ls_pcie_exit_from_l2(&pcie->pci->pp);
259+
ret = pcie->drvdata->exit_from_l2(&pcie->pci->pp);
260+
if (ret)
261+
return ret;
255262

256263
return dw_pcie_resume_noirq(pcie->pci);
257264
}

0 commit comments

Comments
 (0)