From patchwork Thu Mar 4 04:41:10 2021 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: 392720 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348576jai; Thu, 4 Mar 2021 14:16:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7Kh8CQqogswMibKbcSNKiddJG0mxaVOeZpWn3Iq60wYtVrcMb4iY5adHhebPJDQel4flA X-Received: by 2002:a05:6402:1a4f:: with SMTP id bf15mr6768400edb.304.1614896182148; Thu, 04 Mar 2021 14:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896182; cv=none; d=google.com; s=arc-20160816; b=EIEhoE/VgP6qA9XyoXm9bg3RyzaS9d93WJOB8VqDCYBEzqZ+Yp/HKl3KA3opFKD5lI rR6AMoNzrDgZGFhp2COhkTP3vz+Jh3mbxnMJ6+YtIziNvEJiC4b6fmyMtid/7AsxrNmt jfPSbaDin2kex9/OFDs/W5K+PmxcCfOhKbss3t8Erq7ztJyKvuTkyrTlu2w4J7EU8EST 1rNI1tm4MAPFbHKMezbE/tWS6ifleC5hn2N3MssaS4lwhveIIomag2SU25PwDRwcLJG4 S5fIIYJeerpjDNHNMAdk1vTltPYxHU+dmEeTl4PUiTHS8UMALIalixJFQ8iMImhtK7Gs xc/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HHTvmMjtTJRPNFpN3zkcx0PIiGXY1RMP1eK0a1ouBO4=; b=slzKtEte8PzgbNGG8yR8ytPjI7rAvHb6wRX4YjN4Ef0T0UimlP7LMcY3YSNJrrdlFz XNr5Bu0WKSdkj3J8CnD8359n8z83zcvzyYdmpiboFDcu962KgmG2VpblSdNwajM6R5iA HjHphlVE6Tl/KMolk5ZgTg7vzltZYl4yk1CHt6pIELdjsnxG3i0/bdxWwKtnNyOWFwsV G8dAh26W3CJDHrnJLHw9g6CUUWgIHHOOAZhNlfGKOxOc18NszssJ1igWZD5N4bjk2PFq vLsWVaVenWwg0TuMYCzYxdun88d1Qirr5k144sVds4PvCZC8X2KHkxCYCeaVGeqnbxxU fXpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Q+sF68pn; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.22; Thu, 04 Mar 2021 14:16:22 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Q+sF68pn; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233580AbhCDEm5 (ORCPT + 6 others); Wed, 3 Mar 2021 23:42:57 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47100 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233557AbhCDEm3 (ORCPT ); Wed, 3 Mar 2021 23:42:29 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244fYKo052726; Wed, 3 Mar 2021 22:41:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832894; bh=HHTvmMjtTJRPNFpN3zkcx0PIiGXY1RMP1eK0a1ouBO4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Q+sF68pnb33I4wcR61zZ5mYu/WLg39P07W8zX0Yr1c6t9R9yPkJ3grgvX5MmuCZ3r JOsLBFUk2iBjCO33hkqPatG1XYBNdHpLkbiBJkV36z0kl4pchSrqY9h3Q9JIQKZ2vo nyjgnz3mpktfy7O8sTP/p/5J3z0gSBmOunWVyYVY= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244fY9e087940 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:34 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:34 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:34 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfi042911; Wed, 3 Mar 2021 22:41:31 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla , Subject: [PATCH v4 01/13] phy: cadence: Sierra: Fix PHY power_on sequence Date: Thu, 4 Mar 2021 10:11:10 +0530 Message-ID: <20210304044122.15166-2-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Commit 44d30d622821d ("phy: cadence: Add driver for Sierra PHY") de-asserts PHY_RESET even before the configurations are loaded in phy_init(). However PHY_RESET should be de-asserted only after all the configurations has been initialized, instead of de-asserting in probe. Fix it here. Fixes: 44d30d622821d ("phy: cadence: Add driver for Sierra PHY") Signed-off-by: Kishon Vijay Abraham I Cc: # v5.4+ --- drivers/phy/cadence/phy-cadence-sierra.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Philipp Zabel diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 26a0badabe38..19f32ae877b9 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -319,6 +319,12 @@ static int cdns_sierra_phy_on(struct phy *gphy) u32 val; int ret; + ret = reset_control_deassert(sp->phy_rst); + if (ret) { + dev_err(dev, "Failed to take the PHY out of reset\n"); + return ret; + } + /* Take the PHY lane group out of reset */ ret = reset_control_deassert(ins->lnk_rst); if (ret) { @@ -616,7 +622,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) pm_runtime_enable(dev); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); - reset_control_deassert(sp->phy_rst); return PTR_ERR_OR_ZERO(phy_provider); put_child: From patchwork Thu Mar 4 04:41:11 2021 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: 392938 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23CD5C4332B for ; Thu, 4 Mar 2021 04:44:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B61B64E28 for ; Thu, 4 Mar 2021 04:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233729AbhCDEna (ORCPT ); Wed, 3 Mar 2021 23:43:30 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47112 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233699AbhCDEnS (ORCPT ); Wed, 3 Mar 2021 23:43:18 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244fclP052737; Wed, 3 Mar 2021 22:41:38 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832898; bh=2gdcGvIiei2/gTTob5OagdVE47Jl6d4UbQfoaMc8G3o=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Tvntns1O9mFwr8M97BUwCpT6H8JQS6F8qX1mYCeFaoRcVBHqH4X415QeogWucA6Xz JT3Pva19t+sXEUYeXg5yvKr2c3rvl+GPP1D5fyXIUGgkycRacMfr6m1Hl+uwUKm0AU XyJZvnr44s38fq5RFW+ml8WA/oJDAif5cbYpirts= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244fcLC087978 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:38 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:38 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:38 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfj042911; Wed, 3 Mar 2021 22:41:34 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla , Subject: [PATCH v4 02/13] phy: ti: j721e-wiz: Invoke wiz_init() before of_platform_device_create() Date: Thu, 4 Mar 2021 10:11:11 +0530 Message-ID: <20210304044122.15166-3-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Invoke wiz_init() before configuring anything else in Sierra/Torrent (invoked as part of of_platform_device_create()). wiz_init() resets the SERDES device and any configuration done in the probe() of Sierra/Torrent will be lost. In order to prevent SERDES configuration from getting reset, invoke wiz_init() immediately before invoking of_platform_device_create(). Fixes: 091876cc355d ("phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC") Signed-off-by: Kishon Vijay Abraham I Cc: # v5.10 --- drivers/phy/ti/phy-j721e-wiz.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 995c7dbec77b..1bb73822f44a 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -1262,27 +1262,24 @@ static int wiz_probe(struct platform_device *pdev) goto err_get_sync; } + ret = wiz_init(wiz); + if (ret) { + dev_err(dev, "WIZ initialization failed\n"); + goto err_wiz_init; + } + serdes_pdev = of_platform_device_create(child_node, NULL, dev); if (!serdes_pdev) { dev_WARN(dev, "Unable to create SERDES platform device\n"); ret = -ENOMEM; - goto err_pdev_create; - } - wiz->serdes_pdev = serdes_pdev; - - ret = wiz_init(wiz); - if (ret) { - dev_err(dev, "WIZ initialization failed\n"); goto err_wiz_init; } + wiz->serdes_pdev = serdes_pdev; of_node_put(child_node); return 0; err_wiz_init: - of_platform_device_destroy(&serdes_pdev->dev, NULL); - -err_pdev_create: wiz_clock_cleanup(wiz, node); err_get_sync: From patchwork Thu Mar 4 04:41:12 2021 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: 392728 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348667jai; Thu, 4 Mar 2021 14:16:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAa9ZclpAUnnQGASvAfg+jBcjJWf527QSfs8YGU4y2McqFQ4XeOx4TUKQ6ltFUVBSpNuiR X-Received: by 2002:a17:906:644f:: with SMTP id l15mr6666994ejn.229.1614896189977; Thu, 04 Mar 2021 14:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896189; cv=none; d=google.com; s=arc-20160816; b=GZ2PYyYJU22XWcXzv0C8DfYO7/1V50G0aUP7DfFtwFhJ87RL247NStyP+qldWUU4ch ZhIY3oeRxzHf73xPqQXw7FA7OZgKdCEmIu/UYz2sjAtCuFqJwCJscWrXQZraFFqlrD4D fDPJ3feFFsm0oAhoTfTCELHIU8W3U+1mRksBAazvyOf6lkD8zWUaZ7KFS3ZXJ3pi4pGW +WFMPqCRMGPkZs1vpvGHmV0bCp7uyLgKsYOAsOlqTpKHbvMSASeHnz6qJ1rM5KgR9FoL yTpqrT4MlSSOcTWwy5ECdXArnJkdNgzY5TmoRT4fiwXWA7shZBTtiheojR+NlS/37bDq Un2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VxF8kGigCKqkh77tBFluIHDcpsujh9oOUvSPK2P6qiw=; b=M16XR1xT7x7gi6gQtjRYseUZDEmVc3tp64D2nhqKtznH71zF0n/JMnn40DSwXtcHOm rdBGqbSYCbaKIl0vH5pL7LoQivgut7XGSSnfSGaf84wUjUCPHRCXPk3URceuzU3YHMJJ pgfvavxxiv/KrKO/Q0Qh8S2xRXHoDdVD0pPfKuMXfwbFFYclOKHbR6ixAJLjelC+MFQp thHqMIoL2A76jiT54qGLMV6ANF6aZejSk65Kwn6XGikdaHkSmLExnoFmRO+Ke830i/Q+ KI1tPsQ0LDjcw5R/RUOI3K5kS6lqLW/eMML7ugToG87tuiMA9BjudIp/v99tnOJ+bvvP ajGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rlf1E0fZ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.29; Thu, 04 Mar 2021 14:16:29 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rlf1E0fZ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233731AbhCDEnb (ORCPT + 6 others); Wed, 3 Mar 2021 23:43:31 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36616 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233701AbhCDEnV (ORCPT ); Wed, 3 Mar 2021 23:43:21 -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 1244fgx6101834; Wed, 3 Mar 2021 22:41:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832902; bh=VxF8kGigCKqkh77tBFluIHDcpsujh9oOUvSPK2P6qiw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rlf1E0fZqmeXQwa9UR7DvXiwvjVG+ryV5D25YtAFdXGOJkE9qzMgqP/cTwVE/HS3S YP/SzeqDwbnr70dslZ4q+T7/nJ2rWzmu27MZeqHVs+olBKS0T+rmrJAXCRR1rLWtox 8tnRxK+95W6ypjZ1PUsl5+G2S163+LbOAp8tXDxw= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244fgrr088048 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:42 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:41 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:41 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfk042911; Wed, 3 Mar 2021 22:41:38 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 03/13] phy: cadence: cadence-sierra: Create PHY only for "phy" or "link" sub-nodes Date: Thu, 4 Mar 2021 10:11:12 +0530 Message-ID: <20210304044122.15166-4-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Cadence Sierra PHY driver registers PHY using devm_phy_create() for all sub-nodes of Sierra device tree node. However Sierra device tree node can have sub-nodes for the various clocks in addtion to the PHY. Use devm_phy_create() only for nodes with name "phy" (or "link" for old device tree) which represent the actual PHY. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 19f32ae877b9..f7ba0ed416bc 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -577,6 +577,10 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) for_each_available_child_of_node(dn, child) { struct phy *gphy; + if (!(of_node_name_eq(child, "phy") || + of_node_name_eq(child, "link"))) + continue; + sp->phys[node].lnk_rst = of_reset_control_array_get_exclusive(child); From patchwork Thu Mar 4 04:41:13 2021 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: 392729 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348675jai; Thu, 4 Mar 2021 14:16:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyG7um+YjLrC6ap55VpFLiy9jzGPT3hVPIBr5+pMtk8aRafh2GObOVdcf/4P35SIEut+sv4 X-Received: by 2002:a17:906:801:: with SMTP id e1mr6296977ejd.465.1614896190396; Thu, 04 Mar 2021 14:16:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896190; cv=none; d=google.com; s=arc-20160816; b=0E4etzh9SpQnbn02OM3DLlj//MNG987K90RaBiCbm43YHZzd+DU3Sx2X32XxBv4All GszsLXnQCR7++11KaeYP9ZAqBZLeNOh3b1Xu/kKFpEVW0+ghxsU/ezXGi+mKnpGcABMk JHappgFEy2++SS7+Z77JfWLHWpRG/tlh3x9EIhVFjSe75INo0duhUai4O+mScShvHda1 2cKWC8JakU6rxo1r26H4LW/2LpPAmWR+TjHmuAGGH3c5mFdXqJzhC+4Ixi6Ib+K4Mup5 o5yV0X+gif9J/jGQFEURFVECXDtntADS7ZcWEFh+JlRZpAOrtbKy126ygbx8i/k7gFu6 TEVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OsKa0EDwQKMOxN4rn2UsJ4wTaESxeSKXJwtpa+eVAPs=; b=aqAQpRJ6Mr1kcIb7TMGKHhsyWKY/J6EMy2Ihhptr5G+3qqeBt+hv0FLIyAXHb032W4 +MRzouXZJDL1xJuy2RsmDBf7gLmkyivHMS8QrWwxS20t8dNemmWcCXksHgoabZT32kBM BU9xAck21+CMnaRSLyQPKEnHEccKVJMM/6ttleHCM1lWgeA8QK+gs/x8e13CDRYObQDl /5M0peRl3x/K3QvlUHA0uhOSh1kTOJZ2+B+chVl8Xl7K9sRGzQeC4+d/yFpCXUd9o7jK B0Cl32StNtHK9fC6kK+ZMOg41g1nOboT2gJXbtq6El8xA0NgByzrITQ21eKMuaa9R6re 5mRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=a4SKKcwJ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.30; Thu, 04 Mar 2021 14:16:30 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=a4SKKcwJ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233736AbhCDEnb (ORCPT + 6 others); Wed, 3 Mar 2021 23:43:31 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36630 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233705AbhCDEnZ (ORCPT ); Wed, 3 Mar 2021 23:43:25 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244fjH0101853; Wed, 3 Mar 2021 22:41:45 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832905; bh=OsKa0EDwQKMOxN4rn2UsJ4wTaESxeSKXJwtpa+eVAPs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=a4SKKcwJSResOHBGbaSY/2zNQUKv55yQcMGxCPxxS9hc+VCrD043CixSsr7TiRtAK wwfv3r4PswvdS2CcmS/8c3RCe5IoNt6M4A+tirxuc09KWxbllx8CM9V69777od1Tjg oTCeX5OfJKvbuB4pHgbVCXja+JgOVi/Ugqs1gqMM= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244fj7j055880 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:45 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:45 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:45 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfl042911; Wed, 3 Mar 2021 22:41:42 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 04/13] phy: ti: j721e-wiz: Get PHY properties only for "phy" or "link" subnode Date: Thu, 4 Mar 2021 10:11:13 +0530 Message-ID: <20210304044122.15166-5-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org "serdes" node (child node of WIZ) can have sub-nodes for representing links or it can have sub-nodes for representing the various clocks within the serdes. Instead of trying to read "reg" from every child node used for assigning "lane_phy_type", read only if the child node's name is "phy" or "link" subnode. Ideally all PHY dt nodes should have node name as "phy", however existing devicetree used "link" as subnode. So in order to maintain old DT compatibility get PHY properties for "phy" or "link" subnode. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/ti/phy-j721e-wiz.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 1bb73822f44a..659597645201 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -1102,6 +1102,10 @@ static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz) u32 reg, num_lanes = 1, phy_type = PHY_NONE; int ret, i; + if (!(of_node_name_eq(subnode, "phy") || + of_node_name_eq(subnode, "link"))) + continue; + ret = of_property_read_u32(subnode, "reg", ®); if (ret) { dev_err(dev, From patchwork Thu Mar 4 04:41:14 2021 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: 392722 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348596jai; Thu, 4 Mar 2021 14:16:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsrgr8yoE4z+cLMPclxY9DzpCoZNFJ2mPIgBFlCVJUmlBQFpH5MsPIHiFAlTGMxtJ7onwy X-Received: by 2002:a17:906:5012:: with SMTP id s18mr5570319ejj.100.1614896183495; Thu, 04 Mar 2021 14:16:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896183; cv=none; d=google.com; s=arc-20160816; b=T50n36UsNSg0g5+h+895B/y9XYnJOm+/hmBzKWTAQhIbjIGg7mx+++7Va6mEfg5oCU puO7O1ELqMDe4ZRj3yWjjbV2bHoMe8TwYbqF8IxbxJ5UA6NcgC3s1THMKluCPSIq4rDU Xj8w4BW9sASPfYFXOFnYja+9WeD7BHEB+iTeCACrfbg47erMlP9MOOHVJ9JSEWqL8QNH Wd15Ae+KV8sxdcJrGmZhBjmuA96KLX2/cRt9i7K90TWNhFxXdRKPLkQbVzvRksEMOYzc NFYRBwHpAiY9kRov3Bq9QUqZPKU7safNLERFwA6SGYvKuDMobxYGnCs9G152y31qDZoY aqxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1m1jaw1QKhWt1my5TiZgSyHmcvod41lJIai7xVZR3M8=; b=LACefk12IeQIyVrFzcNHwDb+yU48JRWTvxXmSWDFAg9V2LBkAdnrvWdEK38JohppVO 1zt8YfCJZ6rqDiEzAH/shcj83YKdtl6/cvcYjhjUfYlegj2P4eOyufq4nEZjlM6mJBlE rbUpR2Ag8lImpNpzz3WCx0lj+QU3jJPPB+R6wllrAEcrYwh1CCy/IMbd7gr27cNcYZoi 6qjapE/PrryL+jlHNGHRFyiRdf6h6Xq4iVBGOx4ILISuaNs/W7RGQqev4sKiISwcUR01 b2UzciJO422FrxBKp1rp97oswvNVYDdojqmNerw6ebU2VCCp29OOTvZFAOcTqpkovYTR hM5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zEXyKPDs; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.23; Thu, 04 Mar 2021 14:16:23 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zEXyKPDs; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233514AbhCDEm7 (ORCPT + 6 others); Wed, 3 Mar 2021 23:42:59 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36642 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233561AbhCDEmn (ORCPT ); Wed, 3 Mar 2021 23:42:43 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244fmes101863; Wed, 3 Mar 2021 22:41:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832908; bh=1m1jaw1QKhWt1my5TiZgSyHmcvod41lJIai7xVZR3M8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=zEXyKPDsiQvLiS8WD9NbOSMlZZlGKyKm+Oq5la433CSvis/TNSVGvQ0G5kXX9dO5k yqtHxO+A4VKIBZn/k5CAwPOIPw1JgIomgFT34KujcDTPprqJb36fQ/tqpUtt9hoJ/Z TcZW7IXT/Ww26TALOEyDI1JJrRDrjHlJ1Pi6zSPo= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244fmI2016024 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:48 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:48 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:48 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfm042911; Wed, 3 Mar 2021 22:41:45 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 05/13] phy: cadence: cadence-sierra: Move all clk_get_*() to a separate function Date: Thu, 4 Mar 2021 10:11:14 +0530 Message-ID: <20210304044122.15166-6-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org No functional change. Group all devm_clk_get_optional() to a separate function. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 57 +++++++++++++++--------- 1 file changed, 35 insertions(+), 22 deletions(-) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index f7ba0ed416bc..7bf1b4c7774a 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -477,6 +477,38 @@ static int cdns_regmap_init_blocks(struct cdns_sierra_phy *sp, return 0; } +static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, + struct device *dev) +{ + struct clk *clk; + int ret; + + clk = devm_clk_get_optional(dev, "phy_clk"); + if (IS_ERR(clk)) { + dev_err(dev, "failed to get clock phy_clk\n"); + return PTR_ERR(clk); + } + sp->clk = clk; + + 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; + + return 0; +} + static int cdns_sierra_phy_probe(struct platform_device *pdev) { struct cdns_sierra_phy *sp; @@ -487,7 +519,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) unsigned int id_value; 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) @@ -524,11 +555,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sp); - sp->clk = devm_clk_get_optional(dev, "phy_clk"); - if (IS_ERR(sp->clk)) { - dev_err(dev, "failed to get clock phy_clk\n"); - return PTR_ERR(sp->clk); - } + ret = cdns_sierra_phy_get_clocks(sp, dev); + if (ret) + return ret; sp->phy_rst = devm_reset_control_get(dev, "sierra_reset"); if (IS_ERR(sp->phy_rst)) { @@ -542,22 +571,6 @@ 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; From patchwork Thu Mar 4 04:41:15 2021 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: 392721 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348589jai; Thu, 4 Mar 2021 14:16:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJztfDxh+jvLcOvDHrAkMGA21OWatI2dN6mYFTiTwsuDvLfaMjK1bZPGw0yUk/LrpTGDRE5Q X-Received: by 2002:a17:906:40c7:: with SMTP id a7mr6547007ejk.109.1614896183086; Thu, 04 Mar 2021 14:16:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896183; cv=none; d=google.com; s=arc-20160816; b=UqTw2VGZQBlNrkx3XT8tb9lcFjirfZjjnEVRRjnIr+toN5m6PRVmO59ZkDyNaPqroX 2XYB2N3w27hxq6Fae6ifDBq94JzFvKDzGUxLbqPdfxMQHWwk2an88NR8cxG9L3JsCq/t HJlDqHtKxIJrRd5gdA/vLPyNLIMxQE3iP/iwNNviP8O+lG+mJebyHxVDjhVQPyYkP3Re pZ/CWlRaS9V19uaZ4dEc06e7N0aw8Ohljx2k1zYu6QQ7JCRImX4ADuV+lzbDQQKrOK3L Ygke/B1UEg6hFK5LDdhvhmPbcwSl/Mext9QO6hSj05O225BkCcoowIuSacawDoD3p2PE 1JeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+nl8LicT//augqm13+dqzPO4Zt/8O9Pq6Zxz1AFAlx0=; b=gAQw2in1ho5ZEpDKNvswiwnNYLwZWbHtx7bOamf6RLkY3ydUWKYk6GijvC4JUvuS0L p68svYmBYoCpiBA9ZwhWCIBLZ2n/IDioYEiXZO1beCa3BuFpGajr2L6IVBuGVZ0Agosc xB3Pt1B0VbAsJqzhxhKVHlh3EWIFAQ4abySrftKIu6aGZ7q/h3WdAH2lJpwTusjnDgRw FTu1bLYcWk0CYkPZss5V6MtY3G9xBTucnGDg3owaXzO87VHLIQwf4R/rNLc7NRfjkyqT CNmIop2cW/0+8+LGN6Rv3RbNkMMWkXZpjzKxLp2pW6GUd/lCkg9CFcD44be9xwtl08hb h6mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=jG1byoob; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.22; Thu, 04 Mar 2021 14:16:23 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=jG1byoob; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233525AbhCDEm7 (ORCPT + 6 others); Wed, 3 Mar 2021 23:42:59 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36658 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233562AbhCDEmq (ORCPT ); Wed, 3 Mar 2021 23:42:46 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244fqBt101871; Wed, 3 Mar 2021 22:41:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832912; bh=+nl8LicT//augqm13+dqzPO4Zt/8O9Pq6Zxz1AFAlx0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jG1byoob+iIiwwXsI1shApgzPLhNsefhBe2hy/sBO5CEUFke3eMjw/fmMYLlAxRSB HrFYQJZ3BwSq3QWBeWQvvaZm7H7735IDwhKmc+3oSMNCBqkN9bo0e395hcf512L8dB 5k7afYeYp+vkCrV3XudNhS9IYZMSkIs9kID0nFIQ= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244fqMS056042 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:52 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:52 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:51 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfn042911; Wed, 3 Mar 2021 22:41:48 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 06/13] phy: cadence: cadence-sierra: Move all reset_control_get*() to a separate function Date: Thu, 4 Mar 2021 10:11:15 +0530 Message-ID: <20210304044122.15166-7-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org No functional change. Group devm_reset_control_get() and devm_reset_control_get_optional() to a separate function. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 36 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) -- 2.17.1 Reviewed-by: Philipp Zabel diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 7bf1b4c7774a..935f165404e4 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -509,6 +509,28 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, return 0; } +static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, + struct device *dev) +{ + struct reset_control *rst; + + rst = devm_reset_control_get(dev, "sierra_reset"); + if (IS_ERR(rst)) { + dev_err(dev, "failed to get reset\n"); + return PTR_ERR(rst); + } + sp->phy_rst = rst; + + rst = devm_reset_control_get_optional(dev, "sierra_apb"); + if (IS_ERR(rst)) { + dev_err(dev, "failed to get apb reset\n"); + return PTR_ERR(rst); + } + sp->apb_rst = rst; + + return 0; +} + static int cdns_sierra_phy_probe(struct platform_device *pdev) { struct cdns_sierra_phy *sp; @@ -559,17 +581,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) return ret; - sp->phy_rst = devm_reset_control_get(dev, "sierra_reset"); - if (IS_ERR(sp->phy_rst)) { - dev_err(dev, "failed to get reset\n"); - return PTR_ERR(sp->phy_rst); - } - - sp->apb_rst = devm_reset_control_get_optional(dev, "sierra_apb"); - if (IS_ERR(sp->apb_rst)) { - dev_err(dev, "failed to get apb reset\n"); - return PTR_ERR(sp->apb_rst); - } + ret = cdns_sierra_phy_get_resets(sp, dev); + if (ret) + return ret; ret = clk_prepare_enable(sp->clk); if (ret) From patchwork Thu Mar 4 04:41:16 2021 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: 392731 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348711jai; Thu, 4 Mar 2021 14:16:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWTUWlR124d+NAfTOAZZRyXK/xwRCr520b9OBREEXBhnXdMDuvTpnWqLc2WcOuTVzUqxtH X-Received: by 2002:a17:906:2344:: with SMTP id m4mr6394110eja.327.1614896193594; Thu, 04 Mar 2021 14:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896193; cv=none; d=google.com; s=arc-20160816; b=XWpltnwVNCIgSMaSbA7t2Sb9POYjXuafuglbQEAOm3mRbyhvJqB2scLj2OGkuCA+nD nxoS7INUVrLR+M+5Ra88cEpeeirfT1E6JWZh5Prf6XRg6O1NNkLbh3FH/r0OhKqjTVKF 1jmYpq3qTPlt78PUz0dHlYXl2VIyXryo03z42ZOSYi3NgpkS/nc1ER78hhomWYB7dwO9 1ekt4i1rGCLlE8dsEkLRoM+yTGNTXrDa2bVPaT8dGAWE6hCys0WiEK56t59i8Kl9Q1Vc uBk+h48zK6WMgyYeOHCaDg+KXNkSvNsX19YS91jUyT008bRLfXl6d8iCzw2wIfKo4BIi 12BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=X8lkmYvm2LZftzAI7MPmXYXTlNDPCOiWt9wiFwCLMFg=; b=lMUfpvAg9lVLDPHCvq3pshqd++4aPaRswtyH74HpIf6bTC0fAS5FzEwwaTqX4wWDUL IzkgdIiCpA24WU67NzU/BK9CZTdN/FjUVKTEyYhSY3lff1awFa6Hm1z6HVqNErPx8vxu aYn1H/C474tETi0c0VyoWRKYK+C71Ari9GuO5+0WszQ7neD/QPTFW6mXQikxvAb4kVJv UigP25xmbtTKwFScqrWmm3u/LKRVHYar6t11UxmdnzcF2Pes3VkyRQurxCipnjx4jGU+ pt74cL50bFtR2p+A6aFW3DwXMrygDyd5ePzsa50dXEb4qktjLY254SM94eG7wVHkaAmN Tglg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pRdjO5KP; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.33; Thu, 04 Mar 2021 14:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pRdjO5KP; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S234077AbhCDEoI (ORCPT + 6 others); Wed, 3 Mar 2021 23:44:08 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36674 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233757AbhCDEne (ORCPT ); Wed, 3 Mar 2021 23:43:34 -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 1244ft6u101885; Wed, 3 Mar 2021 22:41:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832915; bh=X8lkmYvm2LZftzAI7MPmXYXTlNDPCOiWt9wiFwCLMFg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pRdjO5KPEHF8ppV53opfdqEHibqTcObpnt6+5WO46MHzwJeRSregGvBnaMelnCF6M 8rOE3r5Dl1kE4I53XRgCDlfZtsBUqkLfOyQKJk6Zf5kZzMZFMI3rAznbumsZRrdHS4 F6Bh1pyEwq4RWeZMfm88ad/AG1V7EvUT11TwoRhU= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244ftvE088301 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:55 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:55 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:55 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfo042911; Wed, 3 Mar 2021 22:41:52 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 07/13] phy: cadence: cadence-sierra: Explicitly request exclusive reset control Date: Thu, 4 Mar 2021 10:11:16 +0530 Message-ID: <20210304044122.15166-8-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org No functional change. Since the reset controls obtained in Sierra is exclusively used by the Sierra device, use exclusive reset control request API calls. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Philipp Zabel diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 935f165404e4..44c52a0842dc 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -514,14 +514,14 @@ static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, { struct reset_control *rst; - rst = devm_reset_control_get(dev, "sierra_reset"); + rst = devm_reset_control_get_exclusive(dev, "sierra_reset"); if (IS_ERR(rst)) { dev_err(dev, "failed to get reset\n"); return PTR_ERR(rst); } sp->phy_rst = rst; - rst = devm_reset_control_get_optional(dev, "sierra_apb"); + rst = devm_reset_control_get_optional_exclusive(dev, "sierra_apb"); if (IS_ERR(rst)) { dev_err(dev, "failed to get apb reset\n"); return PTR_ERR(rst); From patchwork Thu Mar 4 04:41:17 2021 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: 392723 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348601jai; Thu, 4 Mar 2021 14:16:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2Lyc4yS0LV6eI6KbKzSu8LlI/g8a4F7RCiMxhi1dJCv3imic2P+RjxzPRtrTDlU5t8Nlm X-Received: by 2002:a17:906:4e57:: with SMTP id g23mr6504764ejw.47.1614896183915; Thu, 04 Mar 2021 14:16:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896183; cv=none; d=google.com; s=arc-20160816; b=x6C0oE+XaFrWVIhlMZvR+62cMU1rkejLklOeZV3WJRbcqVelUChmEY3qWvQj/0mPvf QMfyesYsh8mjewJMSMG5xwtfAUaGHo0JvbcaYB1Y5n/nu74O2yDQz+9gpAO95n38F32c F7pZBKpuLpCpXJLSTMSDZl+hpVWXgteVYiDjQSG8T3dxuESpxFqLi+XilQC8zkYUp3tI dgtgFqn+GK1+5YtcnOfL6wdb0VmG95XAYuXpGq7fuR5bCw/3JQWXuw1sIoWD5/b9r2Ka ANe4vUWfVonxEGnyKfEe4TUhqyopq84ppbG8bkxLkpXCO0rc2fQwW/P6cl4YXgd8j7K/ vTiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=vXveexZupiC6EB7Igu2AVCKG9vCvz2WWeVni7gjU5aA=; b=PyKudda7+TzwUgcbqerxrFEwWBbFVljY+ZxPHhaxxHHlrT/MFyPwJibLjoT1jPXtTY W12fTHhEJft6dwKvVNSa8jVxbftt6mZLj8W9eRLUgedbZ6ecyBk4vi2MIoPYJYOwtVPJ v3QnjEWO7wyeSPVeBxEd4M/APqWqspLfn96wduIDNLeNQV6dsnTVe8N3cb6ULcSiDBPa npfCY1YAbgHtTnH6arhbenKGwEhxZAl8ISlibwG8knack0ctffG8f9ggvUOHSZSnwlSD rfIo6jy2p5AaS7iE59wgdJ47cLedHPqK3LLg+MA1AUEUokUJjSK/Tw4RwLUe/QPhWQrb NV6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ROsHI0pb; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.23; Thu, 04 Mar 2021 14:16:23 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ROsHI0pb; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233632AbhCDEm7 (ORCPT + 6 others); Wed, 3 Mar 2021 23:42:59 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47148 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233573AbhCDEmx (ORCPT ); Wed, 3 Mar 2021 23:42:53 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244fxFd052790; Wed, 3 Mar 2021 22:41:59 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832919; bh=vXveexZupiC6EB7Igu2AVCKG9vCvz2WWeVni7gjU5aA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ROsHI0pb0Qo3GryQ+ACuMExOkKthfA5BOANMc/gblPSBSeYP2n4CfatXoIcPJV9G1 b5vBeNyoesqE7VTZPp6sb7gAemHS1A7FprMNZCMcxQXZzP88c6SxzhhyVqH6sSz93j 5yGSOObQa9yD/ZrRpU35KPo7jY6CkxJ6ajn9fUaU= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244fxWK016118 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:41:59 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:41:58 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:41:58 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfp042911; Wed, 3 Mar 2021 22:41:55 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 08/13] phy: cadence-torrent: Use a common header file for Cadence SERDES Date: Thu, 4 Mar 2021 10:11:17 +0530 Message-ID: <20210304044122.15166-9-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org No functional change. In order to have a single header file for all Cadence SERDES move phy-cadence-torrent.h to phy-cadence.h. This is in preparation for adding Cadence Sierra SERDES specific macros. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-torrent.c | 2 +- .../phy/{phy-cadence-torrent.h => phy-cadence.h} | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) rename include/dt-bindings/phy/{phy-cadence-torrent.h => phy-cadence.h} (51%) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index b371795e66a2..56083fd0c69f 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -7,7 +7,7 @@ */ #include -#include +#include #include #include #include diff --git a/include/dt-bindings/phy/phy-cadence-torrent.h b/include/dt-bindings/phy/phy-cadence.h similarity index 51% rename from include/dt-bindings/phy/phy-cadence-torrent.h rename to include/dt-bindings/phy/phy-cadence.h index 3c92c6192493..4a5ea52a856f 100644 --- a/include/dt-bindings/phy/phy-cadence-torrent.h +++ b/include/dt-bindings/phy/phy-cadence.h @@ -1,15 +1,16 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * This header provides constants for Cadence Torrent SERDES. + * This header provides constants for Cadence SERDES. */ -#ifndef _DT_BINDINGS_TORRENT_SERDES_H -#define _DT_BINDINGS_TORRENT_SERDES_H +#ifndef _DT_BINDINGS_CADENCE_SERDES_H +#define _DT_BINDINGS_CADENCE_SERDES_H +/* Torrent */ #define TORRENT_SERDES_NO_SSC 0 #define TORRENT_SERDES_EXTERNAL_SSC 1 #define TORRENT_SERDES_INTERNAL_SSC 2 #define CDNS_TORRENT_REFCLK_DRIVER 0 -#endif /* _DT_BINDINGS_TORRENT_SERDES_H */ +#endif /* _DT_BINDINGS_CADENCE_SERDES_H */ From patchwork Thu Mar 4 04:41:18 2021 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: 392730 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348706jai; Thu, 4 Mar 2021 14:16:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTm/QU7X3uPEnZpPUFwnHtw5fgpEwdpBKnIWctLd0oZNfRL6VVv0PH84cieF8L6hxiXvHp X-Received: by 2002:a17:906:228d:: with SMTP id p13mr6587588eja.412.1614896193129; Thu, 04 Mar 2021 14:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896193; cv=none; d=google.com; s=arc-20160816; b=0UjJB8RrkkWCvQ/gTt/AR4IK6ruEuAX9jCPcAZzj05pZE8zzJbLAGg78pa1pfclU+7 v4KUxNRiPr5/x7RByRlVejalDC22c+IWxkiUeAKmSkMGg8RQElvGOsuh0Jaq0gzNltvP PKFt5XbTkk/cO/y2uCygKpOFbx+kc9BozssHHx0d7jSE0rlE8m0/ZmfKfZ0jqlEIbk0K wh/be1DnBeTeCjqoMcfm4DNyMmV3gVNF2PzihNftCnYbvzqw2ZJRxk2udUZgalG2kJru jzRw/kBPCEQiw6S06I7inKEXw33u5ghL76LTR3NeGAc8gpU73jqZwv7l2aqp2GSk0Q+B NgZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fTTzBtUNI6wOHn23Acadhw+lAANu22wL/U385vCODoY=; b=v6qvNmkrT6SadZhvgF+dqCOnMBD828Tq/fpmd+vQVdQO6QNZc2oEGf+BP+DrHhmim3 lKDtWweKXIX4k4rvXPeGzVdoky1ViQ+ly3jviY/Fv7Qo/PfCi233Drt0puGQOXqD4+8/ ep5tP4mW/va84xm4oaWRhQOG5KL0WyCm5hU9Q3WDBH6KBsMn3sEqBhOfjMSOXSfYPEMt 5lbBYpQ83ESCWarKbh2hV6nGioB7W1GVPuL0BwQN1jB4ieE+BnChfUXWL88OzIq8KVfx hTvKJv5g3tC/7O7fcBU3BrFMIFhRGjkpOhl0wLGI5tVN5lI/1QDiypkV65RpRzTlMAp+ 7tng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=BPRcouaw; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.32; Thu, 04 Mar 2021 14:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=BPRcouaw; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233533AbhCDEoI (ORCPT + 6 others); Wed, 3 Mar 2021 23:44:08 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47166 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233818AbhCDEnn (ORCPT ); Wed, 3 Mar 2021 23:43:43 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244g3RH052822; Wed, 3 Mar 2021 22:42:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832923; bh=fTTzBtUNI6wOHn23Acadhw+lAANu22wL/U385vCODoY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BPRcouawPEu36ib6WQy00n2RUecemNJILrhPfP0qsZ11Vz8BYIYAo4Hbu5VgRJ2kd QjEm3Ek3JVUsznJD9MLX9k6G2AXWeAoKy6OLNrv/ucMGkJPT47kQhNFbLbp8KxWqnK O/guZRohspVGLyKtcKw0Fdj3ICAuriy4zOdAB+RA= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244g2Mv088488 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:42:03 -0600 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:42:02 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:42:02 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfq042911; Wed, 3 Mar 2021 22:41:59 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 09/13] phy: cadence: cadence-sierra: Add array of input clocks in "struct cdns_sierra_phy" Date: Thu, 4 Mar 2021 10:11:18 +0530 Message-ID: <20210304044122.15166-10-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Instead of having separate structure members for each input clock, add an array for the input clocks within "struct cdns_sierra_phy". This is in preparation for adding more input clocks required for supporting additional clock combination. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 44c52a0842dc..a45278c30948 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -144,6 +144,13 @@ #define SIERRA_MAX_LANES 16 #define PLL_LOCK_TIME 100000 +#define CDNS_SIERRA_INPUT_CLOCKS 3 +enum cdns_sierra_clock_input { + PHY_CLK, + CMN_REFCLK_DIG_DIV, + CMN_REFCLK1_DIG_DIV, +}; + static const struct reg_field macro_id_type = REG_FIELD(SIERRA_MACRO_ID_REG, 0, 15); static const struct reg_field phy_pll_cfg_1 = @@ -197,9 +204,7 @@ struct cdns_sierra_phy { struct regmap_field *macro_id_type; 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; + struct clk *input_clks[CDNS_SIERRA_INPUT_CLOCKS]; int nsubnodes; u32 num_lanes; bool autoconf; @@ -281,8 +286,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); + clk_set_rate(phy->input_clks[CMN_REFCLK_DIG_DIV], 25000000); + clk_set_rate(phy->input_clks[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; @@ -488,7 +493,7 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, dev_err(dev, "failed to get clock phy_clk\n"); return PTR_ERR(clk); } - sp->clk = clk; + sp->input_clks[PHY_CLK] = clk; clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); if (IS_ERR(clk)) { @@ -496,7 +501,7 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, ret = PTR_ERR(clk); return ret; } - sp->cmn_refclk_dig_div = clk; + sp->input_clks[CMN_REFCLK_DIG_DIV] = clk; clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); if (IS_ERR(clk)) { @@ -504,7 +509,7 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, ret = PTR_ERR(clk); return ret; } - sp->cmn_refclk1_dig_div = clk; + sp->input_clks[CMN_REFCLK1_DIG_DIV] = clk; return 0; } @@ -585,7 +590,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) return ret; - ret = clk_prepare_enable(sp->clk); + ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); if (ret) return ret; @@ -662,7 +667,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) reset_control_put(sp->phys[i].lnk_rst); of_node_put(child); clk_disable: - clk_disable_unprepare(sp->clk); + clk_disable_unprepare(sp->input_clks[PHY_CLK]); reset_control_assert(sp->apb_rst); return ret; } From patchwork Thu Mar 4 04:41:19 2021 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: 392724 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348632jai; Thu, 4 Mar 2021 14:16:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/Wf9LFPJZppvE/qcStsQCYc1wsSGMYCITrx/xRZ5o3JBTu/bwmkIk2Bt/3BmC9CQeO//+ X-Received: by 2002:a17:907:10ce:: with SMTP id rv14mr6709799ejb.56.1614896187185; Thu, 04 Mar 2021 14:16:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896187; cv=none; d=google.com; s=arc-20160816; b=ObauB5bMfWgFyUclrstuYYzBr8CV7Zb2djzbScPrZJKKrSATdPBTllQ+oV9f7uh2Is zlZ38t/82ZR4sk6CQrDJ7gHznr15TjPjc0VPXI1WH3hZVv21NiIpGs+uRE+pqcoOX5iR lMJNi+szsT2dN7Z119HzuEW4EBQ819N+3oW9Gh8EDo8pSPg9atTKDFnLqUiMGbep2ERP /HmdTH56b+2S9q7sUr7ifi2uVQYbHzGOM0nuOLPSgDptniov9r77BZ+BXWKxppQOu8bq D6qyvAFr1gW0Rj2n5v2gqtTC8mr1xRC2fFcOl3jeRoEIadSk3FuWVZ5oa4/Tymj9Rgte GhWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Fr9ZyGLW31JmJAp0IyWK9eWBsQt1ma4OyJ8An42gTxI=; b=Eod0YvLq9Cu3FGwSCughuPPwqDmLuyW/fGhLsUQ2fmyEwwCB6BZBHJsH/G8Z/qqO4y InGPRdewCN8DWkF45YyQIrK35kHn89SF05ExOxG54PlQxlsWRoOln8EnGNF+f2rd9UwV jKLimy89hKLUSc2+oRDRLA084u1nsbHEXS35/8l8TzYvpE+Rr9qh8hoI8/Qm0jj+UKlm KsZxnrKrRpqEu4fppJZ636PB64xIja6XuHtVC9STA6984z4jlXgsK2ovWUIwTxfSCwCv hRqEPh0Iexen4hJwFKZwbuKWasIn303C4SrbF2ztN1K/biSqbkb4TpbX+8gFMiTiHaVs U73g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=esapfHlQ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.26; Thu, 04 Mar 2021 14:16:27 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=esapfHlQ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233708AbhCDEn2 (ORCPT + 6 others); Wed, 3 Mar 2021 23:43:28 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36700 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233635AbhCDEnA (ORCPT ); Wed, 3 Mar 2021 23:43:00 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244g5Xq101933; Wed, 3 Mar 2021 22:42:05 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832925; bh=Fr9ZyGLW31JmJAp0IyWK9eWBsQt1ma4OyJ8An42gTxI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=esapfHlQBfFqGr+e/OZGX5imYLaE/2OdK4paWDCwmPQ8VlFrQx7Q6mB7xIo7SnwvF nO5UR/UVlwWF7DkRWm/I1sFwV4sBxtrLbm0Ne1lQPFVhv5Zt8bTqLxd3ih831lApw8 lSD27o05COqAYvoW5/7rqxptIrZUIlHhYGzawHIM= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244g5Eo016590 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:42:05 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:42:05 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:42:05 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfr042911; Wed, 3 Mar 2021 22:42:02 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 10/13] phy: cadence: cadence-sierra: Add missing clk_disable_unprepare() in .remove callback Date: Thu, 4 Mar 2021 10:11:19 +0530 Message-ID: <20210304044122.15166-11-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org commit 44d30d622821 ("phy: cadence: Add driver for Sierra PHY") enabled the clock in probe and failed to disable in remove callback. Add missing clk_disable_unprepare() in cdns_sierra_phy_remove(). Fixes: 44d30d622821 ("phy: cadence: Add driver for Sierra PHY") Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index a45278c30948..ac32b7b0289f 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -689,6 +689,9 @@ static int cdns_sierra_phy_remove(struct platform_device *pdev) reset_control_assert(phy->phys[i].lnk_rst); reset_control_put(phy->phys[i].lnk_rst); } + + clk_disable_unprepare(phy->input_clks[PHY_CLK]); + return 0; } From patchwork Thu Mar 4 04:41:20 2021 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: 392732 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348717jai; Thu, 4 Mar 2021 14:16:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0/oPr7+bwPVE6SIJ+DIUk3E2jsdDeiFMoXxcyroV9Ogxf6sGYSgBZ9N0+55HdAm1jbe3M X-Received: by 2002:a05:6402:11c6:: with SMTP id j6mr6898666edw.138.1614896193967; Thu, 04 Mar 2021 14:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896193; cv=none; d=google.com; s=arc-20160816; b=HBOkELw7sL1WRQwNrqD9DfzjHiEWFIEZTEYlMsiSo+X+jB0nRH8XGNfhIF5OYmDJZa y8KBqp+vctHetP7H31AMY9XfpTHVCatRFFB3P4diGULSOPv3ot0+LI4vRC8/3si2rciL HmQT3/Oc2UzBNZ/rZwATLhK2qbacZbXngv/hnqaMHyLcs6D0rA8JnbOuQkwkltRxJYAO V97jllnPlkbmO3DflVXko3eA+9YHwyBABTWwDyX12uiooZmS23AzDa170I3T5f2GiZnp bppV/YTebu11p90W79kvz6v/9IW7Ki+D4UvsB9DXVQDFvAM1TM7GnrbG81zdZ/7O2Btr OWXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7JT1cqvwkft7bIfWWqmj+KOSHCAdRh24MWWOwaCY3/Y=; b=WBPsq3H9cHO9kryWSEYtIUdJTrYTSqbu6K7nxqRX2L30KAcGVx+B23jCXd9smVZ5Z+ 9OhpJqKr5lA/vkaWr5Vr4lK46B3OgjYw1L+lzQlwBkN1LWVAKrds1shT4EhRJ0cBxozW tZGAdz1cHh0cCXGTKSAJHE3e0w6spngn9ToyjLWDhUj+xDyHUIzacueit5qp433YUZV1 /2y9/r6CHikeK5eOBspMcgDViYb12yWRzOLT9hAIZvIQlwvsIxHmRJ1bYx61yCW/cjHl bktqP8xzhNn5yHTA+3VuvCT+XmTySwDRIwpf1+SymyZh5PSkiKjA6nc9o8rhuAVxJA5w BuoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Xg8G4OeN; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.33; Thu, 04 Mar 2021 14:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Xg8G4OeN; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233538AbhCDEoK (ORCPT + 6 others); Wed, 3 Mar 2021 23:44:10 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36714 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233827AbhCDEns (ORCPT ); Wed, 3 Mar 2021 23:43:48 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244g9Ro101939; Wed, 3 Mar 2021 22:42:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832929; bh=7JT1cqvwkft7bIfWWqmj+KOSHCAdRh24MWWOwaCY3/Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Xg8G4OeNymc1Xitl3vn6IbQqhoiAL0avDePoH3i3YU7V8SCLaB0zNq4lobH7HkYRv /BT3lFqnDGOknGpAW2fGm/yLHFt4voOSKlQ5JV06v2OhVCYSDeE4HoxbrN7bGsT2HR piFYAKBucUI07yOo/xblKPnQeZpRFNCgSPAAyfgU= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244g9gA068777 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:42:09 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:42:08 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:42:08 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfs042911; Wed, 3 Mar 2021 22:42:05 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 11/13] dt-bindings: phy: phy-cadence-sierra: Add binding to model Sierra as clock provider Date: Thu, 4 Mar 2021 10:11:20 +0530 Message-ID: <20210304044122.15166-12-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add #clock-cells binding to model Sierra as clock provider and include clock IDs for PLL_CMNLC and PLL_CMNLC1. Signed-off-by: Kishon Vijay Abraham I --- .../bindings/phy/phy-cadence-sierra.yaml | 17 ++++++++++++++++- include/dt-bindings/phy/phy-cadence.h | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/Documentation/devicetree/bindings/phy/phy-cadence-sierra.yaml b/Documentation/devicetree/bindings/phy/phy-cadence-sierra.yaml index d210843863df..84383e2e0b34 100644 --- a/Documentation/devicetree/bindings/phy/phy-cadence-sierra.yaml +++ b/Documentation/devicetree/bindings/phy/phy-cadence-sierra.yaml @@ -26,6 +26,9 @@ properties: '#size-cells': const: 0 + '#clock-cells': + const: 1 + resets: minItems: 1 maxItems: 2 @@ -49,12 +52,24 @@ properties: const: serdes clocks: - maxItems: 2 + minItems: 2 + maxItems: 4 clock-names: + minItems: 2 items: - const: cmn_refclk_dig_div - const: cmn_refclk1_dig_div + - const: pll0_refclk + - const: pll1_refclk + + assigned-clocks: + minItems: 1 + maxItems: 2 + + assigned-clock-parents: + minItems: 1 + maxItems: 2 cdns,autoconf: type: boolean diff --git a/include/dt-bindings/phy/phy-cadence.h b/include/dt-bindings/phy/phy-cadence.h index 4a5ea52a856f..4652bcb86265 100644 --- a/include/dt-bindings/phy/phy-cadence.h +++ b/include/dt-bindings/phy/phy-cadence.h @@ -13,4 +13,8 @@ #define CDNS_TORRENT_REFCLK_DRIVER 0 +/* Sierra */ +#define CDNS_SIERRA_PLL_CMNLC 0 +#define CDNS_SIERRA_PLL_CMNLC1 1 + #endif /* _DT_BINDINGS_CADENCE_SERDES_H */ From patchwork Thu Mar 4 04:41:21 2021 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: 392733 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348724jai; Thu, 4 Mar 2021 14:16:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSh6BlUFUltMmyr9FkHyrccEUhHCT9hrIpmOjwbwZbeZCws9SkySLBUY88PoeBljR1ylBA X-Received: by 2002:a17:906:dfce:: with SMTP id jt14mr6641378ejc.83.1614896194383; Thu, 04 Mar 2021 14:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896194; cv=none; d=google.com; s=arc-20160816; b=X6DtXySU/xBuOReK+0XGleL6dnH6XYY3yEZc6g+sM2Nv1nNr9oy+onaKNRQFboE9er 3jUJg+qk3/J/6KiN9lWVsmFMy+koieD6U6d/tSHiuYBU9QCVEszOpppVO+1lxfICdXiE EskKleeGKN6yJyunXijHIJiz0Tpj+T+vNtOyqekcIX/TRiJDe/ftHT7fJ6rXYZlx0Eyb J0szjomVb751ZTJgJMg8f6OtgSWIra1ApQSrvFcXndkXmrKDuzji058oCUIuiI1AHgiy v7gDJDNeQGjG5UsO1mKD0J2TAEMfFCPyKjLUfceQBAG/H3GO4wsOe6k2mqk/rCOEg+IR 1Eew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/JbYJECI/90WDffMD7tmY9iaZb+/tJj4qlEoX0af3zI=; b=XE5bvlve4pzgcjsRvHE5TBCDVupfd0gcLz/Rml8PRYHt7La0/Ok7H65ulpLevNmEpN 24Fm9EQmW7UpX0sjK5fNsujIOck52l8wBL56cw3m2MIhZiDCT+6cotdPMKCuGP5K7hhV VYIGgHpVGmJt+S3IgkI1XZvK62MTooEA/5hXG3/WFgMK16WOIX0rl+3vdm0YOWmIh1uy fLQPZ0Q6WRdxl6S7dSax6bgJ6/67++QMFGa8G01+m/1LEBCucNEpx0JMbWIcTFZaq0Lw ec55Va7QhZWSyC/lJPMNY3EZa6B4v7iI48Uq7Q7gL2eskwCDl8jUpbeROYsWdRW7hNK/ JIJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=IQ9a5rCL; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.34; Thu, 04 Mar 2021 14:16:34 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=IQ9a5rCL; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233541AbhCDEoL (ORCPT + 6 others); Wed, 3 Mar 2021 23:44:11 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36726 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233862AbhCDEnw (ORCPT ); Wed, 3 Mar 2021 23:43:52 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244gCXn101962; Wed, 3 Mar 2021 22:42:12 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832932; bh=/JbYJECI/90WDffMD7tmY9iaZb+/tJj4qlEoX0af3zI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IQ9a5rCLiIjR+jG2pVrVVl2AHFANgsskTjlM5MXpO3WjzNTQQkGOHDE+FT8A43e7d Mz96WO144zZtMRev+OqaiPoTR3qcWR1kS+QTLwUE6dMXlvnLhsQx/t085tgcZHTwIu GZC+bE6tWJ13WeCNgPSoxN9dO1+yvNklvoPd9fQs= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244gCN3016840 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:42:12 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:42:12 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:42:12 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQft042911; Wed, 3 Mar 2021 22:42:09 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 12/13] phy: cadence: phy-cadence-sierra: Model PLL_CMNLC and PLL_CMNLC1 as clocks (mux clocks) Date: Thu, 4 Mar 2021 10:11:21 +0530 Message-ID: <20210304044122.15166-13-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Sierra has two PLLs, PLL_CMNLC and PLL_CMNLC1 and each of these PLLs has two inputs, plllc_refclk (input from pll0_refclk) and refrcv (input from pll1_refclk). Model PLL_CMNLC and PLL_CMNLC1 as clocks so that it's possible to select one of these two inputs from device tree. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/Kconfig | 1 + drivers/phy/cadence/phy-cadence-sierra.c | 267 ++++++++++++++++++++++- 2 files changed, 265 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/phy/cadence/Kconfig b/drivers/phy/cadence/Kconfig index 432832bdbd16..23d5382c34ed 100644 --- a/drivers/phy/cadence/Kconfig +++ b/drivers/phy/cadence/Kconfig @@ -24,6 +24,7 @@ config PHY_CADENCE_DPHY config PHY_CADENCE_SIERRA tristate "Cadence Sierra PHY Driver" depends on OF && HAS_IOMEM && RESET_CONTROLLER + depends on COMMON_CLK select GENERIC_PHY help Enable this to support the Cadence Sierra PHY driver diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index ac32b7b0289f..be2c91be4205 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -7,6 +7,7 @@ * */ #include +#include #include #include #include @@ -20,10 +21,12 @@ #include #include #include +#include /* PHY register offsets */ #define SIERRA_COMMON_CDB_OFFSET 0x0 #define SIERRA_MACRO_ID_REG 0x0 +#define SIERRA_CMN_PLLLC_GEN_PREG 0x42 #define SIERRA_CMN_PLLLC_MODE_PREG 0x48 #define SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG 0x49 #define SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG 0x4A @@ -31,6 +34,9 @@ #define SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG 0x4F #define SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG 0x50 #define SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG 0x62 +#define SIERRA_CMN_REFRCV_PREG 0x98 +#define SIERRA_CMN_REFRCV1_PREG 0xB8 +#define SIERRA_CMN_PLLLC1_GEN_PREG 0xC2 #define SIERRA_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ ((0x4000 << (block_offset)) + \ @@ -144,13 +150,19 @@ #define SIERRA_MAX_LANES 16 #define PLL_LOCK_TIME 100000 -#define CDNS_SIERRA_INPUT_CLOCKS 3 +#define CDNS_SIERRA_OUTPUT_CLOCKS 2 +#define CDNS_SIERRA_INPUT_CLOCKS 5 enum cdns_sierra_clock_input { PHY_CLK, CMN_REFCLK_DIG_DIV, CMN_REFCLK1_DIG_DIV, + PLL0_REFCLK, + PLL1_REFCLK, }; +#define SIERRA_NUM_CMN_PLLC 2 +#define SIERRA_NUM_CMN_PLLC_PARENTS 2 + static const struct reg_field macro_id_type = REG_FIELD(SIERRA_MACRO_ID_REG, 0, 15); static const struct reg_field phy_pll_cfg_1 = @@ -158,6 +170,53 @@ static const struct reg_field phy_pll_cfg_1 = static const struct reg_field pllctrl_lock = REG_FIELD(SIERRA_PLLCTRL_STATUS_PREG, 0, 0); +static const char * const clk_names[] = { + [CDNS_SIERRA_PLL_CMNLC] = "pll_cmnlc", + [CDNS_SIERRA_PLL_CMNLC1] = "pll_cmnlc1", +}; + +enum cdns_sierra_cmn_plllc { + CMN_PLLLC, + CMN_PLLLC1, +}; + +struct cdns_sierra_pll_mux_reg_fields { + struct reg_field pfdclk_sel_preg; + struct reg_field plllc1en_field; + struct reg_field termen_field; +}; + +static const struct cdns_sierra_pll_mux_reg_fields cmn_plllc_pfdclk1_sel_preg[] = { + [CMN_PLLLC] = { + .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC_GEN_PREG, 1, 1), + .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 8, 8), + .termen_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 0, 0), + }, + [CMN_PLLLC1] = { + .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC1_GEN_PREG, 1, 1), + .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 8, 8), + .termen_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 0, 0), + }, +}; + +struct cdns_sierra_pll_mux { + struct clk_hw hw; + struct regmap_field *pfdclk_sel_preg; + struct regmap_field *plllc1en_field; + struct regmap_field *termen_field; + struct clk_init_data clk_data; +}; + +#define to_cdns_sierra_pll_mux(_hw) \ + container_of(_hw, struct cdns_sierra_pll_mux, hw) + +static const int pll_mux_parent_index[][SIERRA_NUM_CMN_PLLC_PARENTS] = { + [CMN_PLLLC] = { PLL0_REFCLK, PLL1_REFCLK }, + [CMN_PLLLC1] = { PLL1_REFCLK, PLL0_REFCLK }, +}; + +static u32 cdns_sierra_pll_mux_table[] = { 0, 1 }; + struct cdns_sierra_inst { struct phy *phy; u32 phy_type; @@ -204,10 +263,15 @@ struct cdns_sierra_phy { struct regmap_field *macro_id_type; struct regmap_field *phy_pll_cfg_1; struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES]; + struct regmap_field *cmn_refrcv_refclk_plllc1en_preg[SIERRA_NUM_CMN_PLLC]; + struct regmap_field *cmn_refrcv_refclk_termen_preg[SIERRA_NUM_CMN_PLLC]; + struct regmap_field *cmn_plllc_pfdclk1_sel_preg[SIERRA_NUM_CMN_PLLC]; struct clk *input_clks[CDNS_SIERRA_INPUT_CLOCKS]; int nsubnodes; u32 num_lanes; bool autoconf; + struct clk_onecell_data clk_data; + struct clk *output_clks[CDNS_SIERRA_OUTPUT_CLOCKS]; }; static int cdns_regmap_write(void *context, unsigned int reg, unsigned int val) @@ -369,6 +433,153 @@ static const struct phy_ops ops = { .owner = THIS_MODULE, }; +static u8 cdns_sierra_pll_mux_get_parent(struct clk_hw *hw) +{ + struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw); + struct regmap_field *field = mux->pfdclk_sel_preg; + unsigned int val; + + regmap_field_read(field, &val); + return clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table, 0, val); +} + +static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) +{ + struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw); + struct regmap_field *plllc1en_field = mux->plllc1en_field; + struct regmap_field *termen_field = mux->termen_field; + struct regmap_field *field = mux->pfdclk_sel_preg; + int val, ret; + + ret = regmap_field_write(plllc1en_field, 0); + ret |= regmap_field_write(termen_field, 0); + if (index == 1) { + ret |= regmap_field_write(plllc1en_field, 1); + ret |= regmap_field_write(termen_field, 1); + } + + val = cdns_sierra_pll_mux_table[index]; + ret |= regmap_field_write(field, val); + + return ret; +} + +static const struct clk_ops cdns_sierra_pll_mux_ops = { + .set_parent = cdns_sierra_pll_mux_set_parent, + .get_parent = cdns_sierra_pll_mux_get_parent, +}; + +static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp, + struct regmap_field *pfdclk1_sel_field, + struct regmap_field *plllc1en_field, + struct regmap_field *termen_field, + int clk_index) +{ + struct cdns_sierra_pll_mux *mux; + struct device *dev = sp->dev; + struct clk_init_data *init; + const char **parent_names; + unsigned int num_parents; + char clk_name[100]; + struct clk *clk; + int i; + + mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + if (!mux) + return -ENOMEM; + + num_parents = SIERRA_NUM_CMN_PLLC_PARENTS; + parent_names = devm_kzalloc(dev, (sizeof(char *) * num_parents), GFP_KERNEL); + if (!parent_names) + return -ENOMEM; + + for (i = 0; i < num_parents; i++) { + clk = sp->input_clks[pll_mux_parent_index[clk_index][i]]; + if (IS_ERR_OR_NULL(clk)) { + dev_err(dev, "No parent clock for derived_refclk\n"); + return PTR_ERR(clk); + } + parent_names[i] = __clk_get_name(clk); + } + + snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), clk_names[clk_index]); + + init = &mux->clk_data; + + init->ops = &cdns_sierra_pll_mux_ops; + init->flags = CLK_SET_RATE_NO_REPARENT; + init->parent_names = parent_names; + init->num_parents = num_parents; + init->name = clk_name; + + mux->pfdclk_sel_preg = pfdclk1_sel_field; + mux->plllc1en_field = plllc1en_field; + mux->termen_field = termen_field; + mux->hw.init = init; + + clk = devm_clk_register(dev, &mux->hw); + if (IS_ERR(clk)) + return PTR_ERR(clk); + + sp->output_clks[clk_index] = clk; + + return 0; +} + +static int cdns_sierra_phy_register_pll_mux(struct cdns_sierra_phy *sp) +{ + struct regmap_field *pfdclk1_sel_field; + struct regmap_field *plllc1en_field; + struct regmap_field *termen_field; + struct device *dev = sp->dev; + int ret = 0, i, clk_index; + + clk_index = CDNS_SIERRA_PLL_CMNLC; + for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++, clk_index++) { + pfdclk1_sel_field = sp->cmn_plllc_pfdclk1_sel_preg[i]; + plllc1en_field = sp->cmn_refrcv_refclk_plllc1en_preg[i]; + termen_field = sp->cmn_refrcv_refclk_termen_preg[i]; + + ret = cdns_sierra_pll_mux_register(sp, pfdclk1_sel_field, plllc1en_field, + termen_field, clk_index); + if (ret) { + dev_err(dev, "Fail to register cmn plllc mux\n"); + return ret; + } + } + + return 0; +} + +static void cdns_sierra_clk_unregister(struct cdns_sierra_phy *sp) +{ + struct device *dev = sp->dev; + struct device_node *node = dev->of_node; + + of_clk_del_provider(node); +} + +static int cdns_sierra_clk_register(struct cdns_sierra_phy *sp) +{ + struct device *dev = sp->dev; + struct device_node *node = dev->of_node; + int ret; + + ret = cdns_sierra_phy_register_pll_mux(sp); + if (ret) { + dev_err(dev, "Failed to pll mux clocks\n"); + return ret; + } + + sp->clk_data.clks = sp->output_clks; + sp->clk_data.clk_num = CDNS_SIERRA_OUTPUT_CLOCKS; + ret = of_clk_add_provider(node, of_clk_src_onecell_get, &sp->clk_data); + if (ret) + dev_err(dev, "Failed to add clock provider: %s\n", node->name); + + return ret; +} + static int cdns_sierra_get_optional(struct cdns_sierra_inst *inst, struct device_node *child) { @@ -407,6 +618,7 @@ static int cdns_regfield_init(struct cdns_sierra_phy *sp) { struct device *dev = sp->dev; struct regmap_field *field; + struct reg_field reg_field; struct regmap *regmap; int i; @@ -418,6 +630,32 @@ static int cdns_regfield_init(struct cdns_sierra_phy *sp) } sp->macro_id_type = field; + for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++) { + reg_field = cmn_plllc_pfdclk1_sel_preg[i].pfdclk_sel_preg; + field = devm_regmap_field_alloc(dev, regmap, reg_field); + if (IS_ERR(field)) { + dev_err(dev, "PLLLC%d_PFDCLK1_SEL failed\n", i); + return PTR_ERR(field); + } + sp->cmn_plllc_pfdclk1_sel_preg[i] = field; + + reg_field = cmn_plllc_pfdclk1_sel_preg[i].plllc1en_field; + field = devm_regmap_field_alloc(dev, regmap, reg_field); + if (IS_ERR(field)) { + dev_err(dev, "REFRCV%d_REFCLK_PLLLC1EN failed\n", i); + return PTR_ERR(field); + } + sp->cmn_refrcv_refclk_plllc1en_preg[i] = field; + + reg_field = cmn_plllc_pfdclk1_sel_preg[i].termen_field; + field = devm_regmap_field_alloc(dev, regmap, reg_field); + if (IS_ERR(field)) { + dev_err(dev, "REFRCV%d_REFCLK_TERMEN failed\n", i); + return PTR_ERR(field); + } + sp->cmn_refrcv_refclk_termen_preg[i] = field; + } + regmap = sp->regmap_phy_config_ctrl; field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg_1); if (IS_ERR(field)) { @@ -511,6 +749,22 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, } sp->input_clks[CMN_REFCLK1_DIG_DIV] = clk; + clk = devm_clk_get_optional(dev, "pll0_refclk"); + if (IS_ERR(clk)) { + dev_err(dev, "pll0_refclk clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->input_clks[PLL0_REFCLK] = clk; + + clk = devm_clk_get_optional(dev, "pll1_refclk"); + if (IS_ERR(clk)) { + dev_err(dev, "pll1_refclk clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->input_clks[PLL1_REFCLK] = clk; + return 0; } @@ -586,13 +840,17 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) return ret; - ret = cdns_sierra_phy_get_resets(sp, dev); + ret = cdns_sierra_clk_register(sp); if (ret) return ret; + ret = cdns_sierra_phy_get_resets(sp, dev); + if (ret) + goto unregister_clk; + ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); if (ret) - return ret; + goto unregister_clk; /* Enable APB */ reset_control_deassert(sp->apb_rst); @@ -669,6 +927,8 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) clk_disable: clk_disable_unprepare(sp->input_clks[PHY_CLK]); reset_control_assert(sp->apb_rst); +unregister_clk: + cdns_sierra_clk_register(sp); return ret; } @@ -691,6 +951,7 @@ static int cdns_sierra_phy_remove(struct platform_device *pdev) } clk_disable_unprepare(phy->input_clks[PHY_CLK]); + cdns_sierra_clk_unregister(phy); return 0; } From patchwork Thu Mar 4 04:41:22 2021 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: 392726 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp348650jai; Thu, 4 Mar 2021 14:16:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgbu0F2T8K31yEKWecDiLW+jM0kVh/HjCK5ZaHtwxKBKvPprZMIvjUYrkkS0vecOEHeJpu X-Received: by 2002:a05:6402:3550:: with SMTP id f16mr6616502edd.134.1614896188450; Thu, 04 Mar 2021 14:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896188; cv=none; d=google.com; s=arc-20160816; b=Oa0YbD40HznvywTuqanux3+rdEO/uYCMXCluQQpPt8zAfbY2Fmy8f21X2bbvNaLrGo oGYqwz8IAkrkDITxqIuAbSrGmINHsvltJ7ssAGDn5rF1TSd+FvL4f3zBuLtIUWNaWedm RwTF8TgdYEcz4OxPJ/dsZJ8Zjr+zf8B2BLrLmZmYhEW+yn2x6fzq+Jk7e29h168yWBf3 KDGh6SlJEtRJNM+U2IIckABOzM30PDMdtM+hMSP0XFE3Es941i4c2bM9T84qnmQLCpIF voIhR+FmYvfbPLAEM+Gv4TOR5PL3ekNwijJux4v6uFaSBfNQR73yDJQW7341O0vo5KIB njKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=87e0WVkV56dpTXvqg1zPNJEnEHXGvFYDyxgC5z4r/uQ=; b=np/+O+i/UpcS+RUpGBiA0L38qnbMt5w16JZzmvPGWLrI3T8C7UhjDgnoRyusQH4op1 Bnvrc7Pq567xgjuftajEDzrqcTUxGrpaKc0KHxqT98do+Q0KsIi4L1u3VK6pDbX8HDc+ P/rwZDtWwBYGSRY/9ldDMtCs2SrFhFxmrSoiO/XLhqQJEJHY0BpmJKbN111bELZpIaF5 THs6VpZWMh9Y9VGAOZHxVR4M5NGSGFdMcCDNNRT1mWO5ZarZh+tleO6zIn4KIYWcOjS0 FLypMlfEK9d1mdIU0S6RPkN4A1y5Lk+D0WZKOA5PGkvAlgGX3YkecYJGRCfltPWh679l SClA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=bi6UkkIY; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.16.28; Thu, 04 Mar 2021 14:16:28 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=bi6UkkIY; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S233718AbhCDEn3 (ORCPT + 6 others); Wed, 3 Mar 2021 23:43:29 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36742 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233573AbhCDEnK (ORCPT ); Wed, 3 Mar 2021 23:43:10 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1244gFEZ101969; Wed, 3 Mar 2021 22:42:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614832935; bh=87e0WVkV56dpTXvqg1zPNJEnEHXGvFYDyxgC5z4r/uQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bi6UkkIYux8SYYf9jyHoOxjLkC2zYgdxiR5fat7Prm/KFC6mMGOOLn0WdlVvj0+wU otwDIVBUUy1N14OLk7ZME6DgnHOyslvOtUThPRMkMUoK2y7qknAv0iRcX1GhIxEz6O zak5/wRymiPmsJcT3MvTwak/0B7wWayTQrSfBTDk= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1244gFsU056749 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Mar 2021 22:42:15 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 3 Mar 2021 22:42:15 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 3 Mar 2021 22:42:15 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1244fQfu042911; Wed, 3 Mar 2021 22:42:12 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla Subject: [PATCH v4 13/13] phy: cadence: phy-cadence-sierra: Enable pll_cmnlc and pll_cmnlc1 clocks Date: Thu, 4 Mar 2021 10:11:22 +0530 Message-ID: <20210304044122.15166-14-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304044122.15166-1-kishon@ti.com> References: <20210304044122.15166-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Get pll_cmnlc and pll_cmnlc1 optional clocks and enable them. This will enable REFRCV/1 in case the pll_cmnlc/1 takes input from REFRCV/1 respectively. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 40 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index be2c91be4205..68d81f953f4f 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -768,6 +768,40 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, return 0; } +static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp) +{ + int ret; + + ret = clk_prepare_enable(sp->input_clks[PLL0_REFCLK]); + if (ret) + return ret; + + ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); + if (ret) + goto err_pll_cmnlc; + + ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); + if (ret) + goto err_pll_cmnlc1; + + return 0; + +err_pll_cmnlc: + clk_disable_unprepare(sp->input_clks[PHY_CLK]); + +err_pll_cmnlc1: + clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); + + return 0; +} + +static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp) +{ + clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]); + clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]); + clk_disable_unprepare(sp->input_clks[PHY_CLK]); +} + static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, struct device *dev) { @@ -848,7 +882,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) goto unregister_clk; - ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); + ret = cdns_sierra_phy_enable_clocks(sp); if (ret) goto unregister_clk; @@ -925,7 +959,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) reset_control_put(sp->phys[i].lnk_rst); of_node_put(child); clk_disable: - clk_disable_unprepare(sp->input_clks[PHY_CLK]); + cdns_sierra_phy_disable_clocks(sp); reset_control_assert(sp->apb_rst); unregister_clk: cdns_sierra_clk_register(sp); @@ -941,6 +975,7 @@ static int cdns_sierra_phy_remove(struct platform_device *pdev) reset_control_assert(phy->apb_rst); pm_runtime_disable(&pdev->dev); + cdns_sierra_phy_disable_clocks(phy); /* * The device level resets will be put automatically. * Need to put the subnode resets here though. @@ -950,7 +985,6 @@ static int cdns_sierra_phy_remove(struct platform_device *pdev) reset_control_put(phy->phys[i].lnk_rst); } - clk_disable_unprepare(phy->input_clks[PHY_CLK]); cdns_sierra_clk_unregister(phy); return 0;