From patchwork Sun Dec 31 08:31:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Ledvich X-Patchwork-Id: 854187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=compulab.co.il header.i=@compulab.co.il header.b="Sdh+kduw"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z8YTZ2xqzz9s7n for ; Sun, 31 Dec 2017 19:32:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750935AbdLaIcA (ORCPT ); Sun, 31 Dec 2017 03:32:00 -0500 Received: from softlayer.compulab.co.il ([50.23.254.55]:56717 "EHLO compulab.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750880AbdLaIb7 (ORCPT ); Sun, 31 Dec 2017 03:31:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=compulab.co.il; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=P3v6JLu3zs/qFKYzpvB93im1ZX8Z6ArWL46ICRiLb7Q=; b=Sdh+kduwHcr5N4rky/U0w3YcE 3RnNFRdjGsjqwGiN/h2sr6/SDGlZQWR1QfXEhei8d7he1obUGsQ9OYVuzFDAOogtLzIQvR8vzTZ4+ O9wg72l2AQrg1zTYDKWQGbgexPSqYT1NVfqx6B+Mju0UHxq4AD4hHG8F0rjBqFMcYzasQsNVNReK0 wmLcJlELzaqsL4KZbRzFSTXjLdlLDFyEIIzYyxR5pXYZnD3Zv0BZFZVANiv6WD/+5DSzZklORUKNV FuMNzizUAgp7O2uFrmaLM/zaTiwu6ycWbQhFQ5a0tSaPlblYc1Zuo7hSfF2xbKcWC1GbLAnMBnYI0 hCrj2guFA==; Received: from [37.142.126.90] (port=49260 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.87) (envelope-from ) id 1eVZ2D-000627-BF; Sun, 31 Dec 2017 10:31:57 +0200 Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 85596480FDD; Sun, 31 Dec 2017 10:31:56 +0200 (IST) Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id DcKO8qjHQ4ad; Sun, 31 Dec 2017 10:31:56 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 0904E480FDB; Sun, 31 Dec 2017 10:31:56 +0200 (IST) X-Virus-Scanned: amavisd-new at zimbra-mta.compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id tnYpwRm1x62s; Sun, 31 Dec 2017 10:31:55 +0200 (IST) Received: from compulab.co.il (ilya-linux [192.168.11.24]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id D9D30480E24; Sun, 31 Dec 2017 10:31:55 +0200 (IST) Received: by compulab.co.il (Postfix, from userid 1000) id 46866940C52; Sun, 31 Dec 2017 10:31:51 +0200 (IST) From: Ilya Ledvich To: Richard Zhu , Lucas Stach Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ilya Ledvich Subject: [PATCH v2] PCI: imx6: Add PHY reference clock source support Date: Sun, 31 Dec 2017 10:31:34 +0200 Message-Id: <1514709094-4110-1-git-send-email-ilya@compulab.co.il> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Get-Message-Sender-Via: softlayer.compulab.co.il: acl_c_recent_authed_mail_ips_text_entry: ilya@compulab.co.il|compulab.co.il X-Authenticated-Sender: softlayer.compulab.co.il: ilya@compulab.co.il Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org i.MX7D variant of the IP can use either Crystal Oscillator input or internal clock input as a Reference Clock input for PCIe PHY. Add support for an optional property 'pcie-phy-refclk-internal'. If present then an internal clock input is used as PCIe PHY reference clock source. By default an external oscillator input is still used. Verified on Compulab SBC-iMX7 Single Board Computer. Signed-off-by: Ilya Ledvich --- Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt | 5 +++++ drivers/pci/dwc/pci-imx6.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt index 7b1e48b..581bc09 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt @@ -50,6 +50,11 @@ Additional required properties for imx7d-pcie: - "pciephy" - "apps" +Additional optional properties for imx7d-pcie: +- pcie-phy-refclk-internal: If present then an internal PLL input is used as + PCIe PHY reference clock source. By default an external oscillator input + is used. + Example: pcie@0x01000000 { diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c index b734835..a616192 100644 --- a/drivers/pci/dwc/pci-imx6.c +++ b/drivers/pci/dwc/pci-imx6.c @@ -61,6 +61,7 @@ struct imx6_pcie { u32 tx_swing_low; int link_gen; struct regulator *vpcie; + bool pciephy_refclk_sel; }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ @@ -474,7 +475,9 @@ 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); + IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, + imx6_pcie->pciephy_refclk_sel ? + IMX7D_GPR12_PCIE_PHY_REFCLK_SEL : 0); break; case IMX6SX: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, @@ -840,6 +843,9 @@ static int imx6_pcie_probe(struct platform_device *pdev) imx6_pcie->vpcie = NULL; } + imx6_pcie->pciephy_refclk_sel = + of_property_read_bool(node, "pcie-phy-refclk-internal"); + platform_set_drvdata(pdev, imx6_pcie); ret = imx6_add_pcie_port(imx6_pcie, pdev);