Re: [PATCH v7 4/4] PCI: qcom: Switch pcie_1_pipe_clk_src after PHY init in SC7280

From: Bjorn Helgaas
Date: Tue Sep 14 2021 - 14:52:34 EST


On Tue, Sep 14, 2021 at 11:49:10PM +0530, Prasad Malisetty wrote:
> On the SC7280, the clock source for gcc_pcie_1_pipe_clk_src
> must be the TCXO while gdsc is enabled. After PHY init successful
> clock source should switch to pipe clock for gcc_pcie_1_pipe_clk_src.
>
> Signed-off-by: Prasad Malisetty <pmaliset@xxxxxxxxxxxxxx>
> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 90 +++++++++++++++++++++++++++++-----
> 1 file changed, 79 insertions(+), 11 deletions(-)
>
> +struct qcom_pcie_cfg {
> + const struct qcom_pcie_ops *ops;
> + bool pcie_1_pipe_clk_src_switch;

This is OK, but all things being equal I like "unsigned int x:1" a
little better. Here's some background:

https://lore.kernel.org/r/CA+55aFzKQ6Pj18TB8p4Yr0M4t+S+BsiHH=BJNmn=76-NcjTj-g@xxxxxxxxxxxxxx/
https://lore.kernel.org/r/CA+55aFxnePDimkVKVtv3gNmRGcwc8KQ5mHYvUxY8sAQg6yvVYg@xxxxxxxxxxxxxx/

> @@ -1467,6 +1531,7 @@ static int qcom_pcie_probe(struct platform_device *pdev)
> struct pcie_port *pp;
> struct dw_pcie *pci;
> struct qcom_pcie *pcie;
> + const struct qcom_pcie_cfg *pcie_cfg = NULL;

No need to initialize this, since you always assign it before using
it.

> int ret;
>
> pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
> @@ -1488,7 +1553,9 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>
> pcie->pci = pci;
>
> - pcie->ops = of_device_get_match_data(dev);
> + pcie_cfg = of_device_get_match_data(dev);
> + pcie->ops = pcie_cfg->ops;
> + pcie->pcie_1_pipe_clk_src_switch = pcie_cfg->pcie_1_pipe_clk_src_switch;
>
> pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_HIGH);
> if (IS_ERR(pcie->reset)) {

Looks good, thanks for working on this!