All of lore.kernel.org
 help / color / mirror / Atom feed
From: tyler@opensourcefoundries.com (tyler at opensourcefoundries.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 8/8] PCIe: imx6: imx7d: add support for phy refclk source
Date: Thu, 30 Nov 2017 12:14:34 -0800	[thread overview]
Message-ID: <20171130201434.14122-9-tyler@opensourcefoundries.com> (raw)
In-Reply-To: <20171130201434.14122-1-tyler@opensourcefoundries.com>

From: Tyler Baker <tyler@opensourcefoundries.com>

In the i.MX7D the PCIe PHY can use either externel oscillator or
internal PLL as a reference clock source.
Add support for the PHY Reference Clock source including
device tree property phy-ref-clk.
External oscillator is used as a default reference clock source.

Signed-off-by: Tyler Baker <tyler@opensourcefoundries.com>
Signed-off-by: Ilya Ledvich <ilya@compulab.co.il>
---
 drivers/pci/dwc/pci-imx6.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
index b734835..e935db4 100644
--- a/drivers/pci/dwc/pci-imx6.c
+++ b/drivers/pci/dwc/pci-imx6.c
@@ -45,6 +45,7 @@ enum imx6_pcie_variants {
 struct imx6_pcie {
 	struct dw_pcie		*pci;
 	int			reset_gpio;
+	u32			phy_refclk;
 	bool			gpio_active_high;
 	struct clk		*pcie_bus;
 	struct clk		*pcie_phy;
@@ -474,7 +475,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
 	switch (imx6_pcie->variant) {
 	case IMX7D:
 		regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
-				   IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0);
+				   BIT(5), imx6_pcie->phy_refclk ? BIT(5) : 0);
 		break;
 	case IMX6SX:
 		regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
@@ -733,6 +734,11 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 	if (IS_ERR(pci->dbi_base))
 		return PTR_ERR(pci->dbi_base);
 
+	/* Fetch PHY Reference Clock */
+	if (of_property_read_u32(node, "phy-ref-clk", &imx6_pcie->phy_refclk))
+		imx6_pcie->phy_refclk = 0;
+	pr_info("%s: phy_refclk = %d\n", __func__, imx6_pcie->phy_refclk);
+
 	/* Fetch GPIOs */
 	imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0);
 	imx6_pcie->gpio_active_high = of_property_read_bool(node,
-- 
2.9.3

WARNING: multiple messages have this Message-ID (diff)
From: tyler@opensourcefoundries.com
To: shawnguo@kernel.org, fabio.estevam@nxp.com, kernel@pengutronix.de
Cc: robh+dt@kernel.org, mark.rutland@arm.com,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Tyler Baker <tyler@opensourcefoundries.com>,
	Ilya Ledvich <ilya@compulab.co.il>
Subject: [PATCH 8/8] PCIe: imx6: imx7d: add support for phy refclk source
Date: Thu, 30 Nov 2017 12:14:34 -0800	[thread overview]
Message-ID: <20171130201434.14122-9-tyler@opensourcefoundries.com> (raw)
In-Reply-To: <20171130201434.14122-1-tyler@opensourcefoundries.com>

From: Tyler Baker <tyler@opensourcefoundries.com>

In the i.MX7D the PCIe PHY can use either externel oscillator or
internal PLL as a reference clock source.
Add support for the PHY Reference Clock source including
device tree property phy-ref-clk.
External oscillator is used as a default reference clock source.

Signed-off-by: Tyler Baker <tyler@opensourcefoundries.com>
Signed-off-by: Ilya Ledvich <ilya@compulab.co.il>
---
 drivers/pci/dwc/pci-imx6.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
index b734835..e935db4 100644
--- a/drivers/pci/dwc/pci-imx6.c
+++ b/drivers/pci/dwc/pci-imx6.c
@@ -45,6 +45,7 @@ enum imx6_pcie_variants {
 struct imx6_pcie {
 	struct dw_pcie		*pci;
 	int			reset_gpio;
+	u32			phy_refclk;
 	bool			gpio_active_high;
 	struct clk		*pcie_bus;
 	struct clk		*pcie_phy;
@@ -474,7 +475,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
 	switch (imx6_pcie->variant) {
 	case IMX7D:
 		regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
-				   IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0);
+				   BIT(5), imx6_pcie->phy_refclk ? BIT(5) : 0);
 		break;
 	case IMX6SX:
 		regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
@@ -733,6 +734,11 @@ static int imx6_pcie_probe(struct platform_device *pdev)
 	if (IS_ERR(pci->dbi_base))
 		return PTR_ERR(pci->dbi_base);
 
+	/* Fetch PHY Reference Clock */
+	if (of_property_read_u32(node, "phy-ref-clk", &imx6_pcie->phy_refclk))
+		imx6_pcie->phy_refclk = 0;
+	pr_info("%s: phy_refclk = %d\n", __func__, imx6_pcie->phy_refclk);
+
 	/* Fetch GPIOs */
 	imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0);
 	imx6_pcie->gpio_active_high = of_property_read_bool(node,
-- 
2.9.3

  parent reply	other threads:[~2017-11-30 20:14 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 20:14 [PATCH 0/8] ARM: dts: introduce Compulab IoT Gateway tyler at opensourcefoundries.com
2017-11-30 20:14 ` tyler
2017-11-30 20:14 ` [PATCH 1/8] ARM: dts: imx7d-sbc-iot: add initial iot gateway dts tyler at opensourcefoundries.com
2017-11-30 20:14   ` tyler
2017-11-30 20:14   ` tyler-yzvPICuk2AAEdKtRPRuaE5USO3DlRtUf
2017-12-01 20:10   ` Fabio Estevam
2017-12-01 20:10     ` Fabio Estevam
2017-12-01 20:10     ` Fabio Estevam
2017-12-05 20:58     ` Tyler Baker
2017-12-05 20:58       ` Tyler Baker
2017-12-05 20:58       ` Tyler Baker
2017-11-30 20:14 ` [PATCH 2/8] ARM: dts: imx7: build imx7d-sbc-iot-imx7 dtb tyler at opensourcefoundries.com
2017-11-30 20:14   ` tyler
2017-12-01 20:11   ` Fabio Estevam
2017-12-01 20:11     ` Fabio Estevam
2017-12-05 20:58     ` Tyler Baker
2017-12-05 20:58       ` Tyler Baker
2017-11-30 20:14 ` [PATCH 3/8] ARM: dts: imx7d-cl-som: add nodes for usbh, and usbotg2 tyler at opensourcefoundries.com
2017-11-30 20:14   ` tyler
2017-12-01 20:13   ` Fabio Estevam
2017-12-01 20:13     ` Fabio Estevam
2017-12-05 20:59     ` Tyler Baker
2017-12-05 20:59       ` Tyler Baker
2017-11-30 20:14 ` [PATCH 4/8] ARM: dts: imx7s: add dma support tyler at opensourcefoundries.com
2017-11-30 20:14   ` tyler
2017-11-30 20:14   ` tyler-yzvPICuk2AAEdKtRPRuaE5USO3DlRtUf
2017-12-01 20:17   ` Fabio Estevam
2017-12-01 20:17     ` Fabio Estevam
2017-12-01 20:17     ` Fabio Estevam
2017-12-05 20:59     ` Tyler Baker
2017-12-05 20:59       ` Tyler Baker
2017-11-30 20:14 ` [PATCH 5/8] ARM: dts: imx7s: add node and supplies for vdd1p2 tyler at opensourcefoundries.com
2017-11-30 20:14   ` tyler
2017-11-30 20:14 ` [PATCH 6/8] ARM: dts: imx7d-sbc-iot: enable PCIe peripheral tyler at opensourcefoundries.com
2017-11-30 20:14   ` tyler
2017-11-30 20:14 ` [PATCH 7/8] ARM: dts: imx7s: add usb hsic phy domain tyler at opensourcefoundries.com
2017-11-30 20:14   ` tyler
2017-11-30 20:14   ` tyler-yzvPICuk2AAEdKtRPRuaE5USO3DlRtUf
2017-11-30 20:14 ` tyler at opensourcefoundries.com [this message]
2017-11-30 20:14   ` [PATCH 8/8] PCIe: imx6: imx7d: add support for phy refclk source tyler
2017-12-01 20:21   ` Fabio Estevam
2017-12-01 20:21     ` Fabio Estevam
2017-12-01 20:21     ` Fabio Estevam
2017-12-05 20:58     ` Tyler Baker
2017-12-05 20:58       ` Tyler Baker
2017-12-05 20:58       ` Tyler Baker

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=20171130201434.14122-9-tyler@opensourcefoundries.com \
    --to=tyler@opensourcefoundries.com \
    --cc=linux-arm-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.