From patchwork Wed Mar 10 15:54:44 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: 396746 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp489240jai; Wed, 10 Mar 2021 07:56:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+X4cMF9tM2Z13LBdE/AWwMykWbQY8snYoyiuKiMHOKFkxEH/lCDu6k6HQJ9fdBmT49X9/ X-Received: by 2002:a05:6402:1a4f:: with SMTP id bf15mr4088268edb.304.1615391782107; Wed, 10 Mar 2021 07:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615391782; cv=none; d=google.com; s=arc-20160816; b=CrqrMlDVBLuyDWGG9ZDcY71l0BAuDF3Tf4kUt+ZgqezQit2+5HmVXtq1NUY15gwmLH dsfAtjY8X5npiv3Negj0g+0ouK6q5wJZ6EynLeiXniQUKAE5htPHftgu2EuNoMVEo93h KD7xwjtaavEnMECATZiE6DOXkQ8jzV+NKhinVKX1o5KH/NNV7TtZckcOEyssZhVOl4Sp z5YPdGuNVh/gQkAiAxH2CVPRiLFNhbwGxtsDouThIaiEJqIl9XRrpaZo1eH9w/TNIeKV vozNtyU9uVkJCiIslAXuLbyruF2pOz/B+e89ZO7uD03v88LXzE4LUXyR3KnBkxg8za4p /dlQ== 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=QwocfFZKs1+2H7yG/EDYmmhhWoWxRqiRdFQf6XFW0F5GPXKlsuiWu5xrNkqEkqqJQn WK2/f8pYfS6I/eGiF4qo3//32lQMfBaEvq4l4CHShIHdQ4O7XbmILykvJJ8lDchq3pzi JqnRCmXsTRoC6gL8eym2FQaNOQaiusZSOL0YTDtSHsK904gNxMq4omtW2zB+2+W57AJe 6vyZeD0APzZsER/dEAFzcru2ECGtBBvhdDimRZvKYwCFgP4cQ22NcglWI7x1FDMz7xpS IrUmUG+cWetDpeYkupQ+OchRaG6niA+C03YeUILLbZYXRmI9pjCb5IeoEdDz2EnKKNcp c2kA== 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 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 v12si12063192ejb.425.2021.03.10.07.56.21; Wed, 10 Mar 2021 07:56: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=RiKkWHv2; 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 S233258AbhCJPzt (ORCPT + 6 others); Wed, 10 Mar 2021 10:55:49 -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 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@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(-) -- 2.17.1 Reviewed-by: Swapnil Jakhade 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;