Message ID | 20250412-qps615_v4_1-v5-4-5b6a06132fec@oss.qualcomm.com |
---|---|
State | New |
Headers | show |
Series | PCI: Enable Power and configure the TC9563 PCIe switch | expand |
On Sat, Apr 12, 2025 at 07:19:53AM +0530, Krishna Chaitanya Chundru wrote: > Add host_start_link() and host_stop_link() functions to dwc glue drivers to > register with start_link() and stop_link() of pci ops, allowing for better > control over the link initialization and shutdown process. what's difference .host_start_link and .start_link ? what's reason why need .host_start_link. Frank > > Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> > --- > drivers/pci/controller/dwc/pcie-designware.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index 56aafdbcdacaff6b738800fb03ae60eb13c9a0f2..f3f520d65c92ed5ceae5b33f0055c719a9b60f0e 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -466,6 +466,8 @@ struct dw_pcie_ops { > enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie); > int (*start_link)(struct dw_pcie *pcie); > void (*stop_link)(struct dw_pcie *pcie); > + int (*host_start_link)(struct dw_pcie *pcie); > + void (*host_stop_link)(struct dw_pcie *pcie); > }; > > struct debugfs_info { > @@ -720,6 +722,20 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci) > pci->ops->stop_link(pci); > } > > +static inline int dw_pcie_host_start_link(struct dw_pcie *pci) > +{ > + if (pci->ops && pci->ops->host_start_link) > + return pci->ops->host_start_link(pci); > + > + return 0; > +} > + > +static inline void dw_pcie_host_stop_link(struct dw_pcie *pci) > +{ > + if (pci->ops && pci->ops->host_stop_link) > + pci->ops->host_stop_link(pci); > +} > + > static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) > { > u32 val; > > -- > 2.34.1 >
On 4/16/2025 12:43 AM, Frank Li wrote: > On Sat, Apr 12, 2025 at 07:19:53AM +0530, Krishna Chaitanya Chundru wrote: >> Add host_start_link() and host_stop_link() functions to dwc glue drivers to >> register with start_link() and stop_link() of pci ops, allowing for better >> control over the link initialization and shutdown process. > > what's difference .host_start_link and .start_link ? > > what's reason why need .host_start_link. > > Frank host_start_link are registered with new pci_ops which are added as part of this series, whereas start_link() is dwc function op. we use host_stop_link & host_start_link to stop link training from pci pwrctrl driver before powering on PCIe endpoints/switch if required. QCOM is trying to power up the switch, switch needs certain configurations before link is up, If we power on the switch the link may come up before link training we are stopping by using these function ops we added these details in the PCI core patch 3/9 commit. - Krishna Chaitanya. >> >> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> >> --- >> drivers/pci/controller/dwc/pcie-designware.h | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h >> index 56aafdbcdacaff6b738800fb03ae60eb13c9a0f2..f3f520d65c92ed5ceae5b33f0055c719a9b60f0e 100644 >> --- a/drivers/pci/controller/dwc/pcie-designware.h >> +++ b/drivers/pci/controller/dwc/pcie-designware.h >> @@ -466,6 +466,8 @@ struct dw_pcie_ops { >> enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie); >> int (*start_link)(struct dw_pcie *pcie); >> void (*stop_link)(struct dw_pcie *pcie); >> + int (*host_start_link)(struct dw_pcie *pcie); >> + void (*host_stop_link)(struct dw_pcie *pcie); >> }; >> >> struct debugfs_info { >> @@ -720,6 +722,20 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci) >> pci->ops->stop_link(pci); >> } >> >> +static inline int dw_pcie_host_start_link(struct dw_pcie *pci) >> +{ >> + if (pci->ops && pci->ops->host_start_link) >> + return pci->ops->host_start_link(pci); >> + >> + return 0; >> +} >> + >> +static inline void dw_pcie_host_stop_link(struct dw_pcie *pci) >> +{ >> + if (pci->ops && pci->ops->host_stop_link) >> + pci->ops->host_stop_link(pci); >> +} >> + >> static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) >> { >> u32 val; >> >> -- >> 2.34.1 >>
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 56aafdbcdacaff6b738800fb03ae60eb13c9a0f2..f3f520d65c92ed5ceae5b33f0055c719a9b60f0e 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -466,6 +466,8 @@ struct dw_pcie_ops { enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie); int (*start_link)(struct dw_pcie *pcie); void (*stop_link)(struct dw_pcie *pcie); + int (*host_start_link)(struct dw_pcie *pcie); + void (*host_stop_link)(struct dw_pcie *pcie); }; struct debugfs_info { @@ -720,6 +722,20 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci) pci->ops->stop_link(pci); } +static inline int dw_pcie_host_start_link(struct dw_pcie *pci) +{ + if (pci->ops && pci->ops->host_start_link) + return pci->ops->host_start_link(pci); + + return 0; +} + +static inline void dw_pcie_host_stop_link(struct dw_pcie *pci) +{ + if (pci->ops && pci->ops->host_stop_link) + pci->ops->host_stop_link(pci); +} + static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) { u32 val;
Add host_start_link() and host_stop_link() functions to dwc glue drivers to register with start_link() and stop_link() of pci ops, allowing for better control over the link initialization and shutdown process. Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> --- drivers/pci/controller/dwc/pcie-designware.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)