[PATCH v3 6/7] PCI: qcom: Drop the assert_perst() callbacks

Manivannan Sadhasivam via B4 Relay posted 7 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v3 6/7] PCI: qcom: Drop the assert_perst() callbacks
Posted by Manivannan Sadhasivam via B4 Relay 1 month, 1 week ago
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

Now that the TC9563 Pwrctrl driver is converted to use the new Pwrctrl
design, there is no need for these assert_perst() callbacks. With the new
design, TC9563 will be powered on before PERST# deassert. So explicit
PERST# handling from the TC9563 driver is not needed.

Hence, drop the callbacks.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 drivers/pci/controller/dwc/pcie-designware-host.c |  9 ---------
 drivers/pci/controller/dwc/pcie-designware.h      |  8 --------
 drivers/pci/controller/dwc/pcie-qcom.c            | 13 -------------
 include/linux/pci.h                               |  1 -
 4 files changed, 31 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 372207c33a85..4862a3a059c7 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -857,19 +857,10 @@ static void __iomem *dw_pcie_ecam_conf_map_bus(struct pci_bus *bus, unsigned int
 	return pci->dbi_base + where;
 }
 
-static int dw_pcie_op_assert_perst(struct pci_bus *bus, bool assert)
-{
-	struct dw_pcie_rp *pp = bus->sysdata;
-	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
-
-	return dw_pcie_assert_perst(pci, assert);
-}
-
 static struct pci_ops dw_pcie_ops = {
 	.map_bus = dw_pcie_own_conf_map_bus,
 	.read = pci_generic_config_read,
 	.write = pci_generic_config_write,
-	.assert_perst = dw_pcie_op_assert_perst,
 };
 
 static struct pci_ops dw_pcie_ecam_ops = {
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 31685951a080..d24abdb9edaa 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -798,14 +798,6 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci)
 		pci->ops->stop_link(pci);
 }
 
-static inline int dw_pcie_assert_perst(struct dw_pcie *pci, bool assert)
-{
-	if (pci->ops && pci->ops->assert_perst)
-		return pci->ops->assert_perst(pci, assert);
-
-	return 0;
-}
-
 static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci)
 {
 	u32 val;
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 198befb5be2c..6de3ff555b9d 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -650,18 +650,6 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
 	return 0;
 }
 
-static int qcom_pcie_assert_perst(struct dw_pcie *pci, bool assert)
-{
-	struct qcom_pcie *pcie = to_qcom_pcie(pci);
-
-	if (assert)
-		qcom_ep_reset_assert(pcie);
-	else
-		qcom_ep_reset_deassert(pcie);
-
-	return 0;
-}
-
 static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie)
 {
 	u32 val;
@@ -1523,7 +1511,6 @@ static const struct qcom_pcie_cfg cfg_fw_managed = {
 static const struct dw_pcie_ops dw_pcie_ops = {
 	.link_up = qcom_pcie_link_up,
 	.start_link = qcom_pcie_start_link,
-	.assert_perst = qcom_pcie_assert_perst,
 };
 
 static int qcom_pcie_icc_init(struct qcom_pcie *pcie)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 864775651c6f..3eb8fd975ad9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -854,7 +854,6 @@ struct pci_ops {
 	void __iomem *(*map_bus)(struct pci_bus *bus, unsigned int devfn, int where);
 	int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val);
 	int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
-	int (*assert_perst)(struct pci_bus *bus, bool assert);
 };
 
 /*

-- 
2.48.1
Re: [PATCH v3 6/7] PCI: qcom: Drop the assert_perst() callbacks
Posted by Niklas Cassel 1 month, 1 week ago
On Mon, Dec 29, 2025 at 10:56:57PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> 
> Now that the TC9563 Pwrctrl driver is converted to use the new Pwrctrl
> design, there is no need for these assert_perst() callbacks. With the new
> design, TC9563 will be powered on before PERST# deassert. So explicit
> PERST# handling from the TC9563 driver is not needed.

The commit message is a little bit confusing IMO.
The explicit PERST# handling in the TC9563 driver was removed in the
previous commit, so perhaps it is better to not mention TC9563 driver
explicitly (all pwrctrl drivers need to stop using the assert_perst(),
that TC9563 was the only pwrctrl driver user of this API is a detail).


Perhaps phrase the commit message something like:
""
Previously, the controller drivers probed first, toggled PERST#, and
enabled link training and scanned the bus. By the time the pwrctrl driver
probe got called, link training was already enabled by the controller driver.

The pwrctrl drivers thus had to call the .assert_perst() callback, to assert
PERST#, power on the needed resources, and then call the .assert_perst()
callback to deassert PERST#.

Now when all pwrctrl drivers have been converted to new pwrctrl design,
there is no need for the .assert_perst() callback in the controller drivers,
because with the new design, the actual work by the pwrctrl driver will have
been done before the controller driver enumerates the bus. There is thus no
longer any need for .assert_perst() callbacks in the controller drivers.
""

Perhaps also split this commit in two.
Because with the "PCI: qcom:" prefix it is not clear that you are also
removing the callbacks from pci.h

So perhaps create a second patch with only "PCI: " prefix:
""
Now when all .assert_callback() implementations have been removed from
the controller drivers, drop the .assert_callback callback from pci.h.
""


Kind regards,
Niklas
Re: [PATCH v3 6/7] PCI: qcom: Drop the assert_perst() callbacks
Posted by Niklas Cassel 1 month, 1 week ago
On Tue, Dec 30, 2025 at 01:31:50PM +0100, Niklas Cassel wrote:
> On Mon, Dec 29, 2025 at 10:56:57PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> 
> Now when all pwrctrl drivers have been converted to new pwrctrl design,
> there is no need for the .assert_perst() callback in the controller drivers,
> because with the new design, the actual work by the pwrctrl driver will have
> been done before the controller driver enumerates the bus. There is thus no
> longer any need for .assert_perst() callbacks in the controller drivers.

s/before the controller driver enumerates the bus/before the controller driver
asserts + desserts PERST# and starts link training/


Kind regards,
Niklas