From patchwork Thu Nov 28 10:46:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 180398 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7346827ilf; Thu, 28 Nov 2019 02:48:14 -0800 (PST) X-Google-Smtp-Source: APXvYqysqsI3T4FnBKamz4P2dP6Tq6FlRkpAWPlQxr9EkSCybqiDMfo+pxImH6Gh9JwAKckQlqdS X-Received: by 2002:a50:f612:: with SMTP id c18mr38159821edn.285.1574938093951; Thu, 28 Nov 2019 02:48:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574938093; cv=none; d=google.com; s=arc-20160816; b=TEPn+g1DwqNm0hDj73OHdrZOJxFsjME9tORp27KUoDc30ZM7fYyREnQNJE2v/v0mhG W6XJkFCJR3KXXK2+m9t8VhBJXrwz43Xf1Taw6ksWthSDjZgw92vA1fNNLHrvn1YP6Ioc TGm4qQvJLZ/IWMrR30wT6b1AVnru+1upPZVEbrERu13t2nSRqF6ERBhOMQg6ZeVhrcGs GPBo6Lcj/+ES2kCZX2buzQMVOKcQV/HNZvFrgQs/Oq9i9hOCEKTAKOC8t7nJ0fWgqjOV M9JykYRP773M0NodaxNye79dwD64jkHBFjuNoSD0WfKu6k2OuUPcerXQ37DmQ5f3HsWY m/rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=hOJHDmL6AFhdHJjk4PXU1SdyLIBqNQCFUPS9hn289rg=; b=N7BnJO4gOhOFfxLubltdhW6SzW+G3LGIBjKve/14XgBwH4SsbQq3H1IEuUxuU2dmM5 ECFGOqBIuxfRREfEVbx9B2KLhmnmesygBXgdA4c9a8wTwO9w/pzC0RdBoRhMIj65jpdq VExhIccTQHErxnVhCmXPznlPKYU+YRxpJvnaXhkC05D520IXp06loscOcrlig7LsvY8p /p4pt4X7rTm/uotrI1KGMU/Ty8TJjsBQXZzTrESIwBHVoQdHTu9rD5guXIEe7Vjrt8hM aCcgt8+02DMD2ehFSPQdJgW54NB3UotiJso/Q5+epCWF7ZDPfW2QNSpN1Q9iQUtmDPf8 SeZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=hgdAwN8e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15si11287897ejd.187.2019.11.28.02.48.13; Thu, 28 Nov 2019 02:48:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=hgdAwN8e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727258AbfK1KsK (ORCPT + 26 others); Thu, 28 Nov 2019 05:48:10 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:52848 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727230AbfK1KsJ (ORCPT ); Thu, 28 Nov 2019 05:48:09 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id xASAm6gY114676; Thu, 28 Nov 2019 04:48:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574938086; bh=hOJHDmL6AFhdHJjk4PXU1SdyLIBqNQCFUPS9hn289rg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=hgdAwN8eh+t3k3UEvu7HX8YbGcgi6f817P1ZaYdxKreP1IExtX8nuDgNcQaNzNJZG xskP9sk1ycITzFjZDpyFSRLwiVKeuFHH25GrFBJh8JToK81VmJ+UpKUICpYP+U/jr+ Tzjz0ptUIMqL/cGhQIwWEobwWkjvuVq/0aDD+LQs= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xASAm64N118738; Thu, 28 Nov 2019 04:48:06 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 28 Nov 2019 04:48:06 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 28 Nov 2019 04:48:05 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xASAlX48098163; Thu, 28 Nov 2019 04:48:03 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Rob Herring , Anil Varughese , Roger Quadros , Jyri Sarha CC: , Subject: [PATCH v3 11/14] phy: cadence: Sierra: Set cmn_refclk_dig_div/cmn_refclk1_dig_div frequency to 25MHz Date: Thu, 28 Nov 2019 16:16:45 +0530 Message-ID: <20191128104648.21894-12-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191128104648.21894-1-kishon@ti.com> References: <20191128104648.21894-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set cmn_refclk_dig_div/cmn_refclk1_dig_div frequency to 25MHz as specified in "Common Module Clock Configurations" of the Cadence Sierra 16FFC Multi-Protocol PHY PMA Specification. It is set to 25MHz since the only user of Cadence Sierra SERDES, TI J721E SoC provides input clock frequency of 100MHz. For other frequencies, cmn_refclk_dig_div/cmn_refclk1_dig_div should be configured based on the "Common Module Clock Configurations". Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 665a6dbc7816..82466d0e9b38 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -198,6 +198,8 @@ struct cdns_sierra_phy { struct regmap_field *phy_pll_cfg_1; struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES]; struct clk *clk; + struct clk *cmn_refclk_dig_div; + struct clk *cmn_refclk1_dig_div; int nsubnodes; u32 num_lanes; bool autoconf; @@ -279,6 +281,8 @@ static int cdns_sierra_phy_init(struct phy *gphy) if (phy->autoconf) return 0; + clk_set_rate(phy->cmn_refclk_dig_div, 25000000); + clk_set_rate(phy->cmn_refclk1_dig_div, 25000000); if (ins->phy_type == PHY_TYPE_PCIE) { num_cmn_regs = phy->init_data->pcie_cmn_regs; num_ln_regs = phy->init_data->pcie_ln_regs; @@ -468,6 +472,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) struct resource *res; int i, ret, node = 0; void __iomem *base; + struct clk *clk; struct device_node *dn = dev->of_node, *child; if (of_get_child_count(dn) == 0) @@ -523,6 +528,22 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) return PTR_ERR(sp->apb_rst); } + clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); + if (IS_ERR(clk)) { + dev_err(dev, "cmn_refclk_dig_div clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->cmn_refclk_dig_div = clk; + + clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); + if (IS_ERR(clk)) { + dev_err(dev, "cmn_refclk1_dig_div clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->cmn_refclk1_dig_div = clk; + ret = clk_prepare_enable(sp->clk); if (ret) return ret;