Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp367332pxf; Wed, 10 Mar 2021 07:58:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbfjkylWWTwvBqiT2elqGUodudZIucoIAT8qiAXisFRrbeSRqCQ3HQUV7+Ty/enyecJKyJ X-Received: by 2002:a17:906:1ecc:: with SMTP id m12mr4389340ejj.4.1615391908909; Wed, 10 Mar 2021 07:58:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615391908; cv=none; d=google.com; s=arc-20160816; b=EL0ou3UCBWrLSF1Z6UajddqSdhGo/HcnZNWygN4ekgX6otwXhc0U9oOUO40yshvNVw 7DtiDwhfnf2R6sWT5ABKSR/hElKIm4ijkJxuXaDRLMsb7zSPt/cY+26+70t3g7RaqmVN STWgxNLZlcsEt3BQlOsaaFGVETvrG3rntkevr8wfBKw5hUidBc2hpzqgFFO4eOf2Y1yK ndvlHbfMII4G95smS5bKxPYVuoZ6JkSApYAEVxY5hkwU0o+02aSulP1QCgYqD9FpFACC sYvJZ0Tc/dkdW0f0L+fZv21c/mayv+GLmczmtpdCnsjw7E+sSAX5RNlrUXn6uchqCVNo XnUQ== 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=J2qWef0WUfP/Vl5TQ9acXH6M0zbocwoIq+ewinLGc58=; b=wl4/CzhdLmVEt+6tiCsEK2Dsm7aGEPeGhrsuRBnJGdftOG8K+CKbOebq4OAaElqHZ3 PpyA3Yc/7H6lzUIG65XLDNflYv823pE7AY+njfgg3fZjbhCqt4OcJxkTxpfccYkd3Q0E X87b2t1EqNvfwVsNM9PIkIganeNb7F6Ep+xnWGoaEjVb7qfkmeFnTmfkcBzKe0I4GHls jN9ncLljH9v7b7Kwn31GgxgYgYwD/f7fpf4fJ0bNEX+vUSFOvbAt0NemncsxSH12K9X/ 7fAYTvJtGTyXKC4+TDrRhQa5hsgTE4WUOwPNZ9DIUV+3xmzSHNQoeGihF2WIv/YVUREL K3WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RiKkWHv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si13465964edj.219.2021.03.10.07.58.06; Wed, 10 Mar 2021 07:58:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=RiKkWHv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231519AbhCJPzu (ORCPT + 99 others); Wed, 10 Mar 2021 10:55:50 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50380 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233181AbhCJPzW (ORCPT ); Wed, 10 Mar 2021 10:55:22 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 12AFtDr5071336; Wed, 10 Mar 2021 09:55:13 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615391713; bh=J2qWef0WUfP/Vl5TQ9acXH6M0zbocwoIq+ewinLGc58=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RiKkWHv23agR/QWl5DElBDLyl4uuD5B+9ZgotP74tr209mY61SQfNNWCDzN5qYnox VHLFUpoIqz7MUp3iIyCGHDQGzQu4mjaDqNp+eYb0nwl6gDLOwfSD9U9EEjVTe598dq Vyq6OFWrfIdYu6WtuR/J8KoIoIYu4XKhL1hTN8Zc= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12AFtDqm029819 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Mar 2021 09:55:13 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) 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.2176.2; Wed, 10 Mar 2021 09:55:07 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Wed, 10 Mar 2021 09:55:06 -0600 Received: from a0393678-ssd.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 12AFsq5k082613; Wed, 10 Mar 2021 09:55:04 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla , Subject: [PATCH 3/4] phy: cadence-torrent: Do not configure SERDES if it's already configured Date: Wed, 10 Mar 2021 21:24:44 +0530 Message-ID: <20210310155445.534-4-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210310155445.534-1-kishon@ti.com> References: <20210310155445.534-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not configure torrent SERDES if it's already configured. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-torrent.c | 32 ++++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index ab51c4bf7b30..5ee1657f5a1c 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -371,6 +371,10 @@ static const struct phy_ops cdns_torrent_phy_ops = { .owner = THIS_MODULE, }; +static const struct phy_ops noop_ops = { + .owner = THIS_MODULE, +}; + struct cdns_reg_pairs { u32 val; u32 off; @@ -2306,6 +2310,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) struct device_node *child; int ret, subnodes, node = 0, i; u32 total_num_lanes = 0; + int already_configured; u8 init_dp_regmap = 0; u32 phy_type; @@ -2344,16 +2349,20 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) if (ret) return ret; - ret = cdns_torrent_reset(cdns_phy); - if (ret) - goto clk_cleanup; + regmap_field_read(cdns_phy->phy_pma_cmn_ctrl_1, &already_configured); - ret = cdns_torrent_clk(cdns_phy); - if (ret) - goto clk_cleanup; + if (!already_configured) { + ret = cdns_torrent_reset(cdns_phy); + if (ret) + goto clk_cleanup; + + ret = cdns_torrent_clk(cdns_phy); + if (ret) + goto clk_cleanup; - /* Enable APB */ - reset_control_deassert(cdns_phy->apb_rst); + /* Enable APB */ + reset_control_deassert(cdns_phy->apb_rst); + } for_each_available_child_of_node(dev->of_node, child) { struct phy *gphy; @@ -2423,7 +2432,10 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) of_property_read_u32(child, "cdns,ssc-mode", &cdns_phy->phys[node].ssc_mode); - gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops); + if (!already_configured) + gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops); + else + gphy = devm_phy_create(dev, child, &noop_ops); if (IS_ERR(gphy)) { ret = PTR_ERR(gphy); goto put_child; @@ -2507,7 +2519,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) goto put_lnk_rst; } - if (cdns_phy->nsubnodes > 1) { + if (cdns_phy->nsubnodes > 1 && !already_configured) { ret = cdns_torrent_phy_configure_multilink(cdns_phy); if (ret) goto put_lnk_rst; -- 2.17.1