Re: [PATCH 2/2] PCI: imx6: Add code to request/control "pcie_aux" clock for i.MX8MQ

From: Lucas Stach
Date: Tue Feb 12 2019 - 04:36:15 EST


Am Montag, den 11.02.2019, 17:51 -0800 schrieb Andrey Smirnov:
> PCIe IP block has additional clock, "pcie_aux", that needs to be
> controlled by the driver. Add code to support that.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Cc: Fabio Estevam <fabio.estevam@xxxxxxx>
> Cc: Chris Healy <cphealy@xxxxxxxxx>
> Cc: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
> Cc: Leonard Crestez <leonard.crestez@xxxxxxx>
> Cc: "A.s. Dong" <aisheng.dong@xxxxxxx>
> Cc: Richard Zhu <hongxing.zhu@xxxxxxx>
> Cc: linux-imx@xxxxxxx
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: linux-pci@xxxxxxxxxxxxxxx
> Cc: Rob Herring <robh@xxxxxxxxxx>
> Cc: devicetree@xxxxxxxxxxxxxxx

Reviewed-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>

> ---
> Âdrivers/pci/controller/dwc/pci-imx6.c | 16 ++++++++++++++++
> Â1 file changed, 16 insertions(+)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 7cdf8f9ab244..1a7031782846 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -65,6 +65,7 @@ struct imx6_pcie {
> Â struct clk *pcie_phy;
> Â struct clk *pcie_inbound_axi;
> Â struct clk *pcie;
> + struct clk *pcie_aux;
> Â struct regmap *iomuxc_gpr;
> Â u32 controller_id;
> Â struct reset_control *pciephy_reset;
> @@ -421,6 +422,12 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
> Â case IMX7D:
> Â break;
> Â case IMX8MQ:
> + ret = clk_prepare_enable(imx6_pcie->pcie_aux);
> + if (ret) {
> + dev_err(dev, "unable to enable pcie_aux clock\n");
> + break;
> + }
> +
> Â offset = imx6_pcie_grp_offset(imx6_pcie);
> Â /*
> Â Â* Set the over ride low and enabled
> @@ -904,6 +911,9 @@ static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie)
> Â ÂÂÂIMX7D_GPR12_PCIE_PHY_REFCLK_SEL,
> Â ÂÂÂIMX7D_GPR12_PCIE_PHY_REFCLK_SEL);
> Â break;
> + case IMX8MQ:
> + clk_disable_unprepare(imx6_pcie->pcie_aux);
> + break;
> Â default:
> Â break;
> Â }
> @@ -1049,6 +1059,12 @@ static int imx6_pcie_probe(struct platform_device *pdev)
> Â dev_err(dev, "Failed to get PCIE APPS reset control\n");
> Â return PTR_ERR(imx6_pcie->apps_reset);
> Â }
> +
> + imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux");
> + if (IS_ERR(imx6_pcie->pcie_aux)) {
> + dev_err(dev, "pcie_aux clock source missing or invalid\n");
> + return PTR_ERR(imx6_pcie->pcie_aux);
> + }
> Â break;
> Â default:
> Â break;