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

From: Prasad Malisetty
Date: Wed Sep 15 2021 - 03:24:09 EST


On 2021-09-15 00:22, Bjorn Helgaas wrote:
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:


Hi Bjorn,

Thanks for sharing the details.

Sure, I will replace bool with unsigned int in next patch version.

Thanks
-Prasad

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.

Agree, I will remove initialization in next patch series.

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!

Thanks Bjorn for the review.