From patchwork Thu Dec 28 10:05:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxing Zhu X-Patchwork-Id: 10134517 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 86B4A60212 for ; Thu, 28 Dec 2017 10:06:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 787282CCE4 for ; Thu, 28 Dec 2017 10:06:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A3492D5B5; Thu, 28 Dec 2017 10:06:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3C662CCE4 for ; Thu, 28 Dec 2017 10:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752877AbdL1KF7 (ORCPT ); Thu, 28 Dec 2017 05:05:59 -0500 Received: from mail-eopbgr00070.outbound.protection.outlook.com ([40.107.0.70]:22752 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752763AbdL1KF6 (ORCPT ); Thu, 28 Dec 2017 05:05:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=h3nZLwuQIgxW+uSN9o+eeWqbzB5+qzrNvbn5hPdtGYY=; b=H5Z0K+sf7PLfvbmQrNF0MiECJadxNp8O3h2fcFru3KIZ8tz1n3h5h0gU21kpSVwBBzar/Q6YgP0eFk9beYbQm6DzgxNdY/pxnOONwMVUQaaWPuN1ek/Cl0mLAPXYl2rXRCYXOmPkXhmAzaIgX0ZJVBVZxfU2FdUSLSCbnsTfVP4= Received: from AM5PR0402MB2850.eurprd04.prod.outlook.com (10.175.41.145) by AM5PR0402MB2849.eurprd04.prod.outlook.com (10.175.41.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Thu, 28 Dec 2017 10:05:55 +0000 Received: from AM5PR0402MB2850.eurprd04.prod.outlook.com ([fe80::d455:3f51:16d3:e6bf]) by AM5PR0402MB2850.eurprd04.prod.outlook.com ([fe80::d455:3f51:16d3:e6bf%17]) with mapi id 15.20.0366.007; Thu, 28 Dec 2017 10:05:55 +0000 From: Richard Zhu To: Ilya Ledvich , Lucas Stach CC: Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] PCI: imx6: Add PHY reference clock source support Thread-Topic: [PATCH] PCI: imx6: Add PHY reference clock source support Thread-Index: AQHTfvpxf5TClriy6ku4BK4wsN4ikaNYiGVQ Date: Thu, 28 Dec 2017 10:05:55 +0000 Message-ID: References: <1514369154-21105-1-git-send-email-ilya@compulab.co.il> In-Reply-To: <1514369154-21105-1-git-send-email-ilya@compulab.co.il> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=hongxing.zhu@nxp.com; x-originating-ip: [192.158.241.86] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5PR0402MB2849; 6:44Lg6LiLWB1dmp/xh6v3Mi0LOGrDRP1SnIi0Mf7pXmj1YAgRzLt8weBndJXPIiwhGVUmWf7+B1UTkkUA0XRPKDElciyKxIG+LKgd+MLb5whWISpIF2jmTVqO1ZkHc+s4sRKF3L5dzHevPLXF8ETotk5Ol7wW5eZDZo62PsU4lewcUQOVQl4Afmt9Idwdeyol+Q9DsOCIFxTOgQ6LTYTxei8OTvA9BiBwtGKA2T+TGKYCBsYm2H+Kjx5gdwugiBeXDRW+AG10MLri9RSwQ+q0p0eiKeoqQ/4b8ndxAFCsu6om1fgNU09tZJ0bcymts6xNR/NFemZjy6zhO/Ol4Gbd0uRPmaGsc6xojMBd2TmVMPQY0mAFiGYcG2QzwWfijj0+; 5:eJacJyyKxhsmYQeMz6Ns0PcN7qCpicu+SzKeLF/bk6HHdIkEi3nZoQmyW7At48U+nRjj/A7+YnRc+i956wa5aaEHbrSXge4Vylt3zkiwjIHR00FlWmF/K5xcrmZWc09bDtG1LHGP6gc/e9dFOPhht+fbsYeCOdc/yn5DakdY0Og=; 24:coLlixuN7PRxdQwca/qMZEhweRpxJoYe1nPE2d6YtFWgEmklJqQNy0aCipAxGUv5hwYodBMfOBYH533lwCHzm9lWPxCuxsAktRvkjjiSgG0=; 7:bNJ5FprZPWxyIrPol9KiUsC8659rN0+eUNYuB7qShdIcTKC6eWGQY6QPRq8yog5dfXlmbcf5SEkaVrJOhT6fQ6kL3D4HhZzGyDIGeACDt06oJ443XOP6FvTartL698S6tBkvWJvw8oPdTxbPsuBv9CK2+n6D7gNsxgDGPYDL5g8lwg6SBPFM7mjsPA+PMea5CbuVHedRyod2ayu58/svWpRPlVwL0SzTlIvCZkQJfF2cpOf7saiTbVegKU5AVIbd x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 397fed7c-34f5-4d1c-11a9-08d54dda95a3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060); SRVR:AM5PR0402MB2849; x-ms-traffictypediagnostic: AM5PR0402MB2849: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197)(258649278758335)(211936372134217)(153496737603132); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(920507027)(944501075)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM5PR0402MB2849; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM5PR0402MB2849; x-forefront-prvs: 05352A48BE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39380400002)(376002)(396003)(39860400002)(346002)(366004)(199004)(189003)(13464003)(252514010)(74316002)(68736007)(5250100002)(102836004)(34040400001)(2900100001)(5660300001)(99286004)(105586002)(106356001)(478600001)(81166006)(2950100002)(8676002)(53936002)(14454004)(6246003)(66066001)(59450400001)(3846002)(6116002)(53546011)(25786009)(81156014)(76176011)(4326008)(7696005)(86362001)(7736002)(316002)(229853002)(6506007)(2906002)(33656002)(8936002)(97736004)(9686003)(55016002)(3660700001)(3280700002)(54906003)(110136005)(305945005)(6436002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0402MB2849; H:AM5PR0402MB2850.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5iVAIi2Rub06G3a/OD7EsUmScG7VzUE2oU0xmpCrVgR8jAa+Pnmfv9Mryct9MCI2dAJ6HEbUKb1G9lF+7XPskg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 397fed7c-34f5-4d1c-11a9-08d54dda95a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Dec 2017 10:05:55.1025 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0402MB2849 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Ilya: I think the "ocsillator" in the binding document should be oscillator. Thanks. Best Regards Richard Best Regards hongxing zhu Linux BSP team Office: 86-21-28937189 Email: hongxing.zhu@nxp.com -----Original Message----- From: Ilya Ledvich [mailto:ilya@compulab.co.il] Sent: Wednesday, December 27, 2017 6:06 PM 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] PCI: imx6: Add PHY reference clock source support 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(-) 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); -- 1.9.1 diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt index 7b1e48b..f9cf11e 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 ocsillator +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)