Some QMP PHYs need to remux to their pipe clock input to the pipe clock output generated by the PHY before powering on the PHY and restore the default source during power down. +---------------+ | PHY block |<<---------------------------------------+ | | +-----+ | | +-------+ | | GCC | | I/P---^-->| PLL |---^--->pipe_clksrc--->|-\ | | clk | +-------+ | | +--|--->pipe_clk---+ | | xo--->|-/ | +---------------+ +-----| This series moves the pipe clock mux handling from PCIe controller driver into the PHY driver which already manages the pipe clock as the PHY is both the producer of the pipe clock as well as its (primary) consumer. This is an alternative to the series posted here https://lore.kernel.org/r/20220413233144.275926-1-dmitry.baryshkov@xxxxxxxxxx which instead moves the mux handling into the clock drivers and ties remuxing to the gating/ungating of the pipe clock in the GCC. That approach means that it is still possible to have the pipe clock ungated without providing a valid source, somethings which can cause hangs when enabling/disabling the GDSC (presumably as some entity is consuming the pipe clock). Implementing this in the clock drivers also means that the implementation is spread out over multiple files and makes it harder to add support for new SoCs as it may not be clear that every pipe clock mux definition needs to be updated with safe and non-safe parent-clock indexes and an ad-hoc mux ops implementation. The custom mux implementation currently also hides the actual topology of the clock tree by always reporting the pipe mux source as being provided by the PHY (e.g. as reported by debugfs). This series, by contrast, ties the muxing to when the pipe clock source is enabled, that is, when the PHY is powered on, so that the GCC pipe clock always has a valid source. The implementation is more straight-forward, avoids the one-off clock mux implementation, and allows for documenting this once and for all in the PHY driver. Note that the devicetree bindings remains to be updated but that this was left out of this RFC. This series depends on the two qcom-qmp fixlets posted here: https://lore.kernel.org/all/20220420152331.5527-1-johan+linaro@xxxxxxxxxx/ Johan Dmitry Baryshkov (1): PCI: qcom: Remove unnecessary pipe_clk handling Johan Hovold (4): phy: qcom-qmp: add support for pipe clock muxing arm64: dts: qcom: sc7280: move pipe mux handling to phy PCI: qcom: Drop pipe clock muxing PCI: qcom: Drop unused post-init callbacks arch/arm64/boot/dts/qcom/sc7280.dtsi | 18 ++--- drivers/pci/controller/dwc/pcie-qcom.c | 96 ++------------------------ drivers/phy/qualcomm/phy-qcom-qmp.c | 71 +++++++++++++++++-- 3 files changed, 76 insertions(+), 109 deletions(-) -- 2.35.1