linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] PCI: imx6: Fix the clock for PCIe
Date: Fri, 11 Oct 2013 04:12:32 +0200	[thread overview]
Message-ID: <1381457552-6575-2-git-send-email-marex@denx.de> (raw)
In-Reply-To: <1381457552-6575-1-git-send-email-marex@denx.de>

The clk #205 are lvds_sel, not lvds_gate , so fix this. Moreover,
the PCIe needs lvds_gate for successful operation, so make the PCIe
driver enable (set as output) the lvds_gate .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Frank Li <lznuaa@gmail.com>
Cc: Richard Zhu <r65037@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Sean Cross <xobs@kosagi.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Yinghai Lu <yinghai@kernel.org>
---
 arch/arm/boot/dts/imx6qdl.dtsi |  6 +++---
 drivers/pci/host/pci-imx6.c    | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 3d8874a..b8601ea 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -127,9 +127,9 @@
 				  0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
 			num-lanes = <1>;
 			interrupts = <0 123 0x04>;
-			clocks = <&clks 189>, <&clks 187>, <&clks 205>, <&clks 144>;
-			clock-names = "pcie_ref_125m", "sata_ref_100m", "lvds_gate", "pcie_axi";
-			status = "disabled";
+			clocks = <&clks 189>, <&clks 187>, <&clks 205>, <&clks 144>, <&clks 207>;
+			clock-names = "pcie_ref_125m", "sata_ref_100m", "lvds_sel", "pcie_axi", "lvds_gate";
+			status = "okay";
 		};
 
 		pmu {
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 8e7adce..32b30ca 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -35,6 +35,7 @@ struct imx6_pcie {
 	int			power_on_gpio;
 	int			wake_up_gpio;
 	int			disable_gpio;
+	struct clk		*lvds_sel;
 	struct clk		*lvds_gate;
 	struct clk		*sata_ref_100m;
 	struct clk		*pcie_ref_125m;
@@ -255,6 +256,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 		goto err_pcie_ref;
 	}
 
+	ret = clk_prepare_enable(imx6_pcie->lvds_sel);
+	if (ret) {
+		dev_err(pp->dev, "unable to enable lvds_sel\n");
+		goto err_lvds_sel;
+	}
+
 	ret = clk_prepare_enable(imx6_pcie->lvds_gate);
 	if (ret) {
 		dev_err(pp->dev, "unable to enable lvds_gate\n");
@@ -273,8 +280,10 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	return 0;
 
 err_pcie_axi:
-	clk_disable_unprepare(imx6_pcie->lvds_gate);
+	clk_disable_unprepare(imx6_pcie->lvds_sel);
 err_lvds_gate:
+	clk_disable_unprepare(imx6_pcie->lvds_gate);
+err_lvds_sel:
 	clk_disable_unprepare(imx6_pcie->pcie_ref_125m);
 err_pcie_ref:
 	clk_disable_unprepare(imx6_pcie->sata_ref_100m);
@@ -498,6 +507,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
 	}
 
 	/* Fetch clocks */
+	imx6_pcie->lvds_sel = devm_clk_get(&pdev->dev, "lvds_sel");
+	if (IS_ERR(imx6_pcie->lvds_sel)) {
+		dev_err(&pdev->dev,
+			"lvds_sel clock select missing or invalid\n");
+		ret = PTR_ERR(imx6_pcie->lvds_sel);
+		goto err;
+	}
+
 	imx6_pcie->lvds_gate = devm_clk_get(&pdev->dev, "lvds_gate");
 	if (IS_ERR(imx6_pcie->lvds_gate)) {
 		dev_err(&pdev->dev,
-- 
1.8.4.rc3

  reply	other threads:[~2013-10-11  2:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26  3:24 [PATCH v7 0/2] Add PCIe support for i.MX6q Shawn Guo
2013-09-26  3:24 ` [PATCH v7 1/2] ARM: imx6q: Add PCIe bits to GPR syscon definition Shawn Guo
2013-09-26  3:24 ` [PATCH v7 2/2] PCI: imx6: Add support for i.MX6 PCIe controller Shawn Guo
2013-09-27 19:24 ` [PATCH v7 0/2] Add PCIe support for i.MX6q Bjorn Helgaas
2013-09-28  6:56   ` Shawn Guo
2013-10-08 20:56   ` Marek Vasut
2013-10-09  5:23     ` Zhu Richard-R65037
2013-10-10 10:25       ` Marek Vasut
2013-10-10 10:40         ` Zhu Richard-R65037
2013-10-10 12:59           ` Marek Vasut
2013-10-10 20:33           ` Tim Harvey
2013-10-10 20:40             ` Marek Vasut
2013-10-10 13:27         ` Bjorn Helgaas
2013-10-10 13:43           ` Marek Vasut
2013-10-10 15:58           ` Marek Vasut
2013-10-10 17:17             ` Bjorn Helgaas
2013-10-10 17:39               ` Marek Vasut
2013-10-10 17:56                 ` Bjorn Helgaas
2013-10-11  2:12                   ` [PATCH 1/2] PCI: imx6: Make reset-gpio optional Marek Vasut
2013-10-11  2:12                     ` Marek Vasut [this message]
2013-10-11  7:20                       ` [PATCH 2/2] PCI: imx6: Fix the clock for PCIe Jingoo Han
2013-10-11 11:55                         ` Marek Vasut
2013-10-12  7:13                           ` Shawn Guo
2013-10-11  7:09                     ` [PATCH 1/2] PCI: imx6: Make reset-gpio optional Jingoo Han
2013-10-12  7:20                     ` Shawn Guo
2013-10-12  9:28                       ` Marek Vasut
2013-10-14  0:02                         ` Jingoo Han
2013-10-14  0:44                           ` Marek Vasut
2013-10-14  1:17                             ` Marek Vasut
2013-10-14  2:33                               ` Jingoo Han
2013-10-14  3:23                                 ` Marek Vasut
2013-10-11  2:13                   ` [PATCH v7 0/2] Add PCIe support for i.MX6q Marek Vasut
2013-10-11  2:18                     ` Marek Vasut
2013-10-11  2:29                       ` Zhu Richard-R65037
2013-10-11  4:44                       ` Yinghai Lu
2013-10-11 14:44                         ` Marek Vasut
2013-10-11 15:24                           ` Tim Harvey
2013-10-11 20:13                             ` Marek Vasut
2013-10-12  2:16                             ` Zhu Richard-R65037
2013-10-12  2:30                               ` Marek Vasut

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=1381457552-6575-2-git-send-email-marex@denx.de \
    --to=marex@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).