QPS615 is the PCIe switch which has one upstream and three downstream ports. To one of the downstream ports ethernet MAC is connected as endpoint device. Other two downstream ports are supposed to connect to external device. One Host can connect to QPS615 by upstream port. QPS615 switch power is controlled by the GPIO's. After powering on the switch will immediately participate in the link training. if the host is also ready by that time PCIe link will established. The QPS615 needs to configured certain parameters like de-emphasis, disable unused port etc before link is established. As the controller starts link training before the probe of pwrctl driver, the PCIe link may come up as soon as we power on the switch. Due to this configuring the switch itself through i2c will not have any effect as this configuration needs to done before link training. To avoid this introduce two functions in pci_ops to start_link() & stop_link() which will disable the link training if the PCIe link is not up yet. Signed-off-by: Krishna chaitanya chundru <quic_krichai@xxxxxxxxxxx> --- Changes in v2: - As per offline discussions with rob i2c-parent is best suitable to use i2c client device. So use i2c-parent as suggested and remove i2c client node reference from the dt-bindings & devicetree. - Remove "PCI: Change the parent to correctly represent pcie hierarchy" as this requires seperate discussions. - Remove bdf logic to identify the dsp's and usp's to make it generic by using the logic that downstream devices will always child of upstream node and dsp1, dsp2 will always in same order (dmitry) - Remove recursive function for parsing devicetree instead parse only for required devicetree nodes (dmitry) - Fix the issue in be & le conversion (dmitry). - Call put_device for i2c device once done with the usage (dmitry) - Use $defs to describe common properties between upstream port and downstream properties. and remove unneccessary if then. (Krzysztof) - Place the qcom,qps615 compatibility in dt-binding document in alphabatic order (Krzysztof) - Rename qcom,no-dfe to describe it as hardware capability and change qcom,nfts description to reflect hardware details (Krzysztof) - Fix the indentation in the example in dt binding (dmitry) - Add more description to qcom,nfts (dmitry) - Remove nanosec from the property description (dmitry) - Link to v2: https://lore.kernel.org/r/linux-arm-msm/20240803-qps615-v2-0-9560b7c71369@xxxxxxxxxxx/T/ Changes in v1: - Instead of referencing whole i2c-bus add i2c-client node and reference it (Dmitry) - Change the regulator's as per the schematics as per offline review (bjorn Andresson) - Remove additional host check in bus.c (Bart) - For stop_link op change return type from int to void (Bart) - Remove firmware based approach for configuring sequence as suggested by multiple reviewers. - Introduce new dt-properties for the switch to configure the switch as we are replacing the firmware based approach. - The downstream ports add properties in the child nodes which will represented in PCIe hierarchy format. - Removed D3cold D0 sequence in suspend resume for now as it needs separate discussion. - Link to v1: https://lore.kernel.org/linux-pci/20240626-qps615-v1-4-2ade7bd91e02@xxxxxxxxxxx/T/ --- Krishna chaitanya chundru (6): dt-bindings: PCI: Add binding for qps615 arm64: dts: qcom: qcs6490-rb3gen2: Add node for qps615 PCI: Add new start_link() & stop_link function ops PCI: dwc: Add support for new pci function op PCI: qcom: Add support for host_stop_link() & host_start_link() PCI: pwrctl: Add power control driver for qps615 .../devicetree/bindings/pci/qcom,qps615.yaml | 205 +++++++ arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 115 ++++ arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- drivers/pci/controller/dwc/pcie-designware-host.c | 18 + drivers/pci/controller/dwc/pcie-designware.h | 16 + drivers/pci/controller/dwc/pcie-qcom.c | 39 ++ drivers/pci/pwrctl/Kconfig | 8 + drivers/pci/pwrctl/Makefile | 1 + drivers/pci/pwrctl/pci-pwrctl-qps615.c | 630 +++++++++++++++++++++ include/linux/pci.h | 2 + 10 files changed, 1035 insertions(+), 1 deletion(-) --- base-commit: ae43de0875223d271eb6004cfb08be697520f55c change-id: 20241022-qps615_pwr-8d3837f61aec Best regards, -- Krishna chaitanya chundru <quic_krichai@xxxxxxxxxxx>