mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 1/7] PCI: imx6: Add code to request/control "pcie_aux" clock for i.MX8MQ
Date: Tue, 26 Feb 2019 19:16:51 -0800	[thread overview]
Message-ID: <20190227031657.19896-2-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20190227031657.19896-1-andrew.smirnov@gmail.com>

Port of a Linux commit 29d6b80bc36be62ae38ed8ac3f7a426975fe7dfa

  The PCIe IP block has an additional clock, "pcie_aux", that needs to
  be controlled by the driver. Add code to support it.

  Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
  Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
  Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
  Cc: Bjorn Helgaas <bhelgaas@google.com>
  Cc: Fabio Estevam <fabio.estevam@nxp.com>
  Cc: Chris Healy <cphealy@gmail.com>
  Cc: Lucas Stach <l.stach@pengutronix.de>
  Cc: Leonard Crestez <leonard.crestez@nxp.com>
  Cc: "A.s. Dong" <aisheng.dong@nxp.com>
  Cc: Richard Zhu <hongxing.zhu@nxp.com>
  Cc: linux-imx@nxp.com
  Cc: linux-arm-kernel@lists.infradead.org
  Cc: linux-kernel@vger.kernel.org
  Cc: linux-pci@vger.kernel.org
  Cc: Rob Herring <robh@kernel.org>
  Cc: devicetree@vger.kernel.org

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/pci/pci-imx6.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/pci/pci-imx6.c b/drivers/pci/pci-imx6.c
index 138b4ca8b..85307bad3 100644
--- a/drivers/pci/pci-imx6.c
+++ b/drivers/pci/pci-imx6.c
@@ -65,6 +65,7 @@ struct imx6_pcie {
 	struct clk		*pcie_bus;
 	struct clk		*pcie_phy;
 	struct clk		*pcie;
+	struct clk              *pcie_aux;
 	void __iomem		*iomuxc_gpr;
 	u32			controller_id;
 	struct reset_control	*pciephy_reset;
@@ -299,8 +300,10 @@ static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie)
 
 static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 {
+	struct device_d *dev = imx6_pcie->pci->dev;
 	u32 gpr1, gpr1x;
 	unsigned int offset;
+	int ret;
 
 	switch (imx6_pcie->drvdata->variant) {
 	case IMX6QP:
@@ -323,6 +326,12 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
 	case IMX7D:
 		break;
 	case IMX8MQ:
+		ret = clk_enable(imx6_pcie->pcie_aux);
+		if (ret) {
+			dev_err(dev, "unable to enable pcie_aux clock\n");
+			return ret;
+		}
+
 		offset = imx6_pcie_grp_offset(imx6_pcie);
 		/*
 		 * Set the over ride low and enabled
@@ -742,6 +751,13 @@ static int imx6_pcie_probe(struct device_d *dev)
 		if (iores->start == IMX8MQ_PCIE2_BASE_ADDR)
 			imx6_pcie->controller_id = 1;
 
+		imx6_pcie->pcie_aux = 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);
+		}
+
 		goto imx7d_init;
 	case IMX7D:
 		imx6_pcie->iomuxc_gpr = IOMEM(MX7_IOMUXC_GPR_BASE_ADDR);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-02-27  3:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27  3:16 [PATCH 0/7] i.MX8MQ PCIe/USB DT changes Andrey Smirnov
2019-02-27  3:16 ` Andrey Smirnov [this message]
2019-02-27  3:16 ` [PATCH 2/7] ARM: imx8mq: Add node for SRC IP block Andrey Smirnov
2019-02-27  3:16 ` [PATCH 3/7] ARM: imx8mq: Add node for GPC " Andrey Smirnov
2019-02-27  3:16 ` [PATCH 4/7] ARM: imx8mq: Add nodes for PCIE1 and PCIE2 IP blocks Andrey Smirnov
2019-02-27  3:16 ` [PATCH 5/7] ARM: imx8mq-zii-ultra: Enable PCIE1 and PCIE2 Andrey Smirnov
2019-02-27 11:18   ` Lucas Stach
2019-02-28  2:42     ` Andrey Smirnov
2019-02-27  3:16 ` [PATCH 6/7] ARM: dts: imx8mq: Add nodes for USB IP blocks Andrey Smirnov
2019-02-27  3:16 ` [PATCH 7/7] ARM: imx8mq-zii-ultra: Add USB related nodes Andrey Smirnov
2019-02-27 11:10   ` Lucas Stach
2019-02-28  2:43     ` Andrey Smirnov
2019-02-27  7:43 ` [PATCH 0/7] i.MX8MQ PCIe/USB DT changes Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190227031657.19896-2-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox