Message ID | 20241112-qps615_pwr-v3-3-29a1e98aa2b0@quicinc.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | PCI: Enable Power and configure the QPS615 PCIe switch | expand |
On Tue, Nov 12, 2024 at 08:31:35PM +0530, Krishna chaitanya chundru wrote: > Certain devices like QPS615 which uses PCI pwrctl framework > needs to configure the device before PCI link is up. > > If the controller driver already enables link training as part of > its probe, after the device is powered on, controller and device > participates in the link training and link can come up immediately > and maynot have time to configure the device. > > So we need to stop the link training by using stop_link() and enable > them back after device is configured by using start_link(). s/maynot/may not/ I think I'm missing the point here. My assumption is this: - device starts as powered off - pwrctl turns on the power - link trains automatically - qcom driver claims device - qcom needs to configure things that need to happen before link train but that can't be quite right because you wouldn't be able to fix it by changing the qcom driver because it's not in the picture until the link is already trained. So maybe you can add a little more context here? > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > --- > include/linux/pci.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/linux/pci.h b/include/linux/pci.h > index 573b4c4c2be6..fe6a9b4b22ee 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -806,6 +806,8 @@ 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 (*start_link)(struct pci_bus *bus); > + void (*stop_link)(struct pci_bus *bus); > }; > > /* > > -- > 2.34.1 >
On 11/13/2024 5:11 AM, Bjorn Helgaas wrote: > On Tue, Nov 12, 2024 at 08:31:35PM +0530, Krishna chaitanya chundru wrote: >> Certain devices like QPS615 which uses PCI pwrctl framework >> needs to configure the device before PCI link is up. >> >> If the controller driver already enables link training as part of >> its probe, after the device is powered on, controller and device >> participates in the link training and link can come up immediately >> and maynot have time to configure the device. >> >> So we need to stop the link training by using stop_link() and enable >> them back after device is configured by using start_link(). > > s/maynot/may not/ > > I think I'm missing the point here. My assumption is this: > > - device starts as powered off > - pwrctl turns on the power > - link trains automatically > - qcom driver claims device > - qcom needs to configure things that need to happen before link > train > The flow is this way - device starts as powered off - qcom controller driver probes - qcom controller driver enables resources and starts link training - As device is powered off link will not be up - qcom/dwc driver starts enumeration even if the link is not up - pci detects root complex device and creates pci_dev for it - As part of pci_dev creation pwrctl frameworks comes into picture - pwrctl turns on the power. The pwrctl driver is coming up only after qcom driver enables link training. Due to this flow we are trying add these stop_link() & start_link() so that before powering on the device stop the link training so that hw will not participate in the link training. Then power on the device do the required configurations and again start the link training. - Krishna Chaitanya. > but that can't be quite right because you wouldn't be able to fix it > by changing the qcom driver because it's not in the picture until the > link is already trained. > > So maybe you can add a little more context here? > >> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> >> --- >> include/linux/pci.h | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/include/linux/pci.h b/include/linux/pci.h >> index 573b4c4c2be6..fe6a9b4b22ee 100644 >> --- a/include/linux/pci.h >> +++ b/include/linux/pci.h >> @@ -806,6 +806,8 @@ 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 (*start_link)(struct pci_bus *bus); >> + void (*stop_link)(struct pci_bus *bus); >> }; >> >> /* >> >> -- >> 2.34.1 >>
On Tue, Nov 12, 2024 at 05:41:49PM -0600, Bjorn Helgaas wrote: > On Tue, Nov 12, 2024 at 08:31:35PM +0530, Krishna chaitanya chundru wrote: > > Certain devices like QPS615 which uses PCI pwrctl framework > > needs to configure the device before PCI link is up. > > > > If the controller driver already enables link training as part of > > its probe, after the device is powered on, controller and device > > participates in the link training and link can come up immediately > > and maynot have time to configure the device. > > > > So we need to stop the link training by using stop_link() and enable > > them back after device is configured by using start_link(). > > s/maynot/may not/ > > I think I'm missing the point here. My assumption is this: > First controller driver probes, enables link training and scans the bus. When the PCI bridge is found, its child DT nodes will be scanned and pwrctl devices will be created if needed. > - device starts as powered off > - pwrctl turns on the power > - link trains automatically > - qcom driver claims device QPS615 driver will claim this device not controller driver. > - qcom needs to configure things that need to happen before link > train > QPS615 driver needs to configure the switch before link training. So at this point, it stops the link training, configures the switch and starts it again. Patch description could be improved. - Mani > but that can't be quite right because you wouldn't be able to fix it > by changing the qcom driver because it's not in the picture until the > link is already trained. > > So maybe you can add a little more context here? > > > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > > --- > > include/linux/pci.h | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/include/linux/pci.h b/include/linux/pci.h > > index 573b4c4c2be6..fe6a9b4b22ee 100644 > > --- a/include/linux/pci.h > > +++ b/include/linux/pci.h > > @@ -806,6 +806,8 @@ 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 (*start_link)(struct pci_bus *bus); > > + void (*stop_link)(struct pci_bus *bus); > > }; > > > > /* > > > > -- > > 2.34.1 > >
diff --git a/include/linux/pci.h b/include/linux/pci.h index 573b4c4c2be6..fe6a9b4b22ee 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -806,6 +806,8 @@ 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 (*start_link)(struct pci_bus *bus); + void (*stop_link)(struct pci_bus *bus); }; /*
Certain devices like QPS615 which uses PCI pwrctl framework needs to configure the device before PCI link is up. If the controller driver already enables link training as part of its probe, after the device is powered on, controller and device participates in the link training and link can come up immediately and maynot have time to configure the device. So we need to stop the link training by using stop_link() and enable them back after device is configured by using start_link(). Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> --- include/linux/pci.h | 2 ++ 1 file changed, 2 insertions(+)