From patchwork Wed Mar 10 15:54:42 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: 396742 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp488857jai; Wed, 10 Mar 2021 07:55:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQmhl0zkS0lq5J6/z7bMgbJOMIJm728EtobZ1TKhsL2oeycRO/QuA3Pt8a4uGYTkbZigvu X-Received: by 2002:aa7:cd8c:: with SMTP id x12mr4170520edv.355.1615391749691; Wed, 10 Mar 2021 07:55:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615391749; cv=none; d=google.com; s=arc-20160816; b=XyR0dyIqFVxxjgtiSFzsvW+WCZDEZaouceUU3oP6jo/rrNLVnqVKv/Rzm0mvGwJ//R 8534SaKItuZflCtPVpoN1l22/5aATcDVOXEmKwyrdak01oe/yGQA9jvCG1WIUUibcWkp 9BhPOhvHmA1C6LrqMjIUtEzEZq1iINHDbKPq41MJeCZngQ1wHbs/SXdyYMRL+oj1guDb 7JRM/J9dyugPanZc1/89V+CWrq2UTEDITLk8Esu6ENFT4Xzw7B8eloWZrIULGmJ1K7gg SRndSuiWXlsfhcAdXRK1vs2U3Db1/RxYSDMp0kpFLDJx+6i7M4jUKwOSLnfGyORornUT hh6g== 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=DWDQ/I1EftwxzOF/aY9rBU7dyDN4w0Pjm02jY9b0Yg0=; b=cOi4oKDakqZXqjUjqasLiWu06Gw7QX80d0exUu36ur+2P7lBufGDZfvOQDQzLv6Pi2 jZsquQeIPYMB4nAL9K+/n1ioQUu5PaOdiIcEHK/ly4/nqyRMoJ6YmbrJ3pSzVd9eVrmz 8PJXcNvVLJI6MyvrzSquCUc2pVaK+NK4a179abB7lzuDDLzPX3hu/FD3AjulyB2Awngk j1tLMvYgIvNC7nj3hdUQbGnuIdRjD3NgE0LxyjrXQc+a/gKPt3PwZ9OWqDN9U4+rImYl dXQpb+QHhSstluT3c6U9aPJ/8Jx9OUcXwcw8tzza29TThqTx6+qngHI8212i3FyzbGF3 UFFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=OXw1OQ73; 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.55.49; Wed, 10 Mar 2021 07:55:49 -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=OXw1OQ73; 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 S232978AbhCJPzS (ORCPT + 6 others); Wed, 10 Mar 2021 10:55:18 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50284 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbhCJPzJ (ORCPT ); Wed, 10 Mar 2021 10:55:09 -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 12AFt0Xp071249; Wed, 10 Mar 2021 09:55:00 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615391700; bh=DWDQ/I1EftwxzOF/aY9rBU7dyDN4w0Pjm02jY9b0Yg0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OXw1OQ73UTv5dwQEcrpg9YLgzAnvsDVp5n9VSboWVt+Oq6HoJ4q4yd0lptXNhl9SD 0eEEOqRFjW4HHWuGlnbgRY0ZCXR5FITtkG7WplX+omlgRM3x8JT7YVCkqSQPIWY+82 q9kmff3YzMFXScl5qA4iEo8IA1WCTDW6VPY2ycpI= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12AFt0EC029184 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Mar 2021 09:55:00 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE101.ent.ti.com (157.170.170.31) 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:00 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) 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.2176.2 via Frontend Transport; Wed, 10 Mar 2021 09:55:00 -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 12AFsq5i082613; Wed, 10 Mar 2021 09:54:57 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla , , Faiz Abbas Subject: [PATCH 1/4] phy: ti: j721e-wiz: Do not configure wiz if its already configured Date: Wed, 10 Mar 2021 21:24:42 +0530 Message-ID: <20210310155445.534-2-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 From: Faiz Abbas Serdes lanes might be shared between multiple cores in some usecases and its not possible to lock PLLs for both the lanes independently by the two cores. This requires a bootloader to configure both the lanes at early boot time. To handle this case, skip all configuration if any of the lanes has already been enabled. Signed-off-by: Faiz Abbas Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/ti/phy-j721e-wiz.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 659597645201..95905e5c4f3d 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -1132,13 +1132,14 @@ static int wiz_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; struct platform_device *serdes_pdev; + bool already_configured = false; struct device_node *child_node; struct regmap *regmap; struct resource res; void __iomem *base; struct wiz *wiz; + int ret, val, i; u32 num_lanes; - int ret; wiz = devm_kzalloc(dev, sizeof(*wiz), GFP_KERNEL); if (!wiz) @@ -1266,10 +1267,20 @@ 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; + for (i = 0; i < wiz->num_lanes; i++) { + regmap_field_read(wiz->p_enable[i], &val); + if (val & (P_ENABLE | P_ENABLE_FORCE)) { + already_configured = true; + break; + } + } + + if (!already_configured) { + 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); From patchwork Wed Mar 10 15:54:43 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: 396745 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp488884jai; Wed, 10 Mar 2021 07:55:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkNpao9Fi1Mcg92Tl6Hf+gOBA6kD4k5QHo5+tWO708MzVd24NpgNugfwC1V2NcM9679Lmx X-Received: by 2002:a17:906:3ac3:: with SMTP id z3mr4483653ejd.106.1615391752026; Wed, 10 Mar 2021 07:55:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615391752; cv=none; d=google.com; s=arc-20160816; b=mVORGJ58oKZew/9yXgFYaX5a+xphH84vMy63zch1uzKqKk2HYgG5AOo/cMx6G4Rdkl BXD5fVcbdRuyyu9uvk8+WkAFldUqrNT+w/kxUnYw4rBa2lfXY0U14seODHbCk4dXDQay VX2NgY1anfsDxTTC0PDPcMq4tfbJQDBgQ5seYk4FoKhRXlio/2MJJLS7ID9uxIR14mGS A51ZL5byu9GM1ZlN4vHZrY+UPsoSRycAgJl+0YZaCSFFw0OF1Sn7aZ1XhLbStOzLoEPf 5uKDxa6tzXWDufdy5Rm8W6qka+N32f1LuyCxxLJYREDgEUb/oQkZpZwy7nPtCo8aAU1l a8EQ== 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=B9dcLgfgPBxJ7pb6dQlC6AW+mXL0xEIjcJDhqHZ1Jbw=; b=dH99aChDcS1AaL6P/OjBU0uRwW96+83dyez9+zTiGfAczxRnpDqmcalRmKXhssJ7dC Vx1PHSvyDeHYDRgszlVYKYS1abo1AieDP/wgNPrtOzdRQ7oUzYoexG2/g8wXz0V6jmOV K2a9/Zdl5dBW2cyvq0yLQcmhylR+4awciGMVfY+xd50j9Em2U8EEp2Z/4qeM9h2i47Hp WCrXdOMxNplkU+CKfgKXDMsJDPEXe1jA06CMItlT5HYxGvCQiF7K3RRsTTRtzyD2beXH QtjZBhI0KekQ9unIXkuAb+evgQXS1PDlcNP1r/0EA852yEcsjQx5wuG7xMwctj3oVP5N ut4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="wprIz/o8"; 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.55.51; Wed, 10 Mar 2021 07:55:52 -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="wprIz/o8"; 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 S232422AbhCJPzU (ORCPT + 6 others); Wed, 10 Mar 2021 10:55:20 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50308 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232925AbhCJPzN (ORCPT ); Wed, 10 Mar 2021 10:55:13 -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 12AFt4f3071300; Wed, 10 Mar 2021 09:55:05 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615391705; bh=B9dcLgfgPBxJ7pb6dQlC6AW+mXL0xEIjcJDhqHZ1Jbw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=wprIz/o8kh7d4RmbMYpPMfXvYWptCKBW4xVgR3CHvJUCW5hSIvvheY1acXtGtbYMc Dbt3EIkMPFoK6zny+BqXCmiv4pf0T5kw2PlrUUIIemZSnA2B8mc/Ix+siKuNjTmym3 9p+RGDKWE0bLjmYYeAf2xBY4RsapNGqOdiq8qGZA= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12AFt4rM046409 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Mar 2021 09:55:04 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) 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; Wed, 10 Mar 2021 09:55:03 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) 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.2176.2 via Frontend Transport; Wed, 10 Mar 2021 09:55:03 -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 12AFsq5j082613; Wed, 10 Mar 2021 09:55:00 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla , Subject: [PATCH 2/4] phy: cadence-torrent: Group reset APIs and clock APIs Date: Wed, 10 Mar 2021 21:24:43 +0530 Message-ID: <20210310155445.534-3-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 No functional change intended. Group reset APIs and clock APIs in preparation for adding support to skip configuration if the SERDES is already configured by bootloader. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-torrent.c | 84 ++++++++++++++--------- 1 file changed, 53 insertions(+), 31 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 3fdab0d288c4..ab51c4bf7b30 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -2249,6 +2249,54 @@ static int cdns_torrent_clk_register(struct cdns_torrent_phy *cdns_phy) return 0; } +static int cdns_torrent_reset(struct cdns_torrent_phy *cdns_phy) +{ + struct device *dev = cdns_phy->dev; + + cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0); + if (IS_ERR(cdns_phy->phy_rst)) { + dev_err(dev, "%s: failed to get reset\n", + dev->of_node->full_name); + return PTR_ERR(cdns_phy->phy_rst); + } + + cdns_phy->apb_rst = devm_reset_control_get_optional(dev, "torrent_apb"); + if (IS_ERR(cdns_phy->apb_rst)) { + dev_err(dev, "%s: failed to get apb reset\n", + dev->of_node->full_name); + return PTR_ERR(cdns_phy->apb_rst); + } + + return 0; +} + +static int cdns_torrent_clk(struct cdns_torrent_phy *cdns_phy) +{ + struct device *dev = cdns_phy->dev; + int ret; + + cdns_phy->clk = devm_clk_get(dev, "refclk"); + if (IS_ERR(cdns_phy->clk)) { + dev_err(dev, "phy ref clock not found\n"); + return PTR_ERR(cdns_phy->clk); + } + + ret = clk_prepare_enable(cdns_phy->clk); + if (ret) { + dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); + return ret; + } + + cdns_phy->ref_clk_rate = clk_get_rate(cdns_phy->clk); + if (!(cdns_phy->ref_clk_rate)) { + dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); + clk_disable_unprepare(cdns_phy->clk); + return -EINVAL; + } + + return 0; +} + static int cdns_torrent_phy_probe(struct platform_device *pdev) { struct cdns_torrent_phy *cdns_phy; @@ -2274,26 +2322,6 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) cdns_phy->dev = dev; cdns_phy->init_data = data; - cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0); - if (IS_ERR(cdns_phy->phy_rst)) { - dev_err(dev, "%s: failed to get reset\n", - dev->of_node->full_name); - return PTR_ERR(cdns_phy->phy_rst); - } - - cdns_phy->apb_rst = devm_reset_control_get_optional(dev, "torrent_apb"); - if (IS_ERR(cdns_phy->apb_rst)) { - dev_err(dev, "%s: failed to get apb reset\n", - dev->of_node->full_name); - return PTR_ERR(cdns_phy->apb_rst); - } - - cdns_phy->clk = devm_clk_get(dev, "refclk"); - if (IS_ERR(cdns_phy->clk)) { - dev_err(dev, "phy ref clock not found\n"); - return PTR_ERR(cdns_phy->clk); - } - cdns_phy->sd_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(cdns_phy->sd_base)) return PTR_ERR(cdns_phy->sd_base); @@ -2316,18 +2344,13 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) if (ret) return ret; - ret = clk_prepare_enable(cdns_phy->clk); - if (ret) { - dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); + ret = cdns_torrent_reset(cdns_phy); + if (ret) goto clk_cleanup; - } - cdns_phy->ref_clk_rate = clk_get_rate(cdns_phy->clk); - if (!(cdns_phy->ref_clk_rate)) { - dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); - ret = -EINVAL; - goto clk_disable; - } + ret = cdns_torrent_clk(cdns_phy); + if (ret) + goto clk_cleanup; /* Enable APB */ reset_control_deassert(cdns_phy->apb_rst); @@ -2505,7 +2528,6 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) reset_control_put(cdns_phy->phys[i].lnk_rst); of_node_put(child); reset_control_assert(cdns_phy->apb_rst); -clk_disable: clk_disable_unprepare(cdns_phy->clk); clk_cleanup: cdns_torrent_clk_cleanup(cdns_phy); 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; From patchwork Wed Mar 10 15:54:45 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: 396744 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp488871jai; Wed, 10 Mar 2021 07:55:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6ZGohZdlpgokvYV9BGayeWTjYro6q8p16/4/Z/dJnyBsVdnw/x6KPKEoOkxdUKezwAyTE X-Received: by 2002:a05:6402:c0f:: with SMTP id co15mr4015031edb.373.1615391750587; Wed, 10 Mar 2021 07:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615391750; cv=none; d=google.com; s=arc-20160816; b=gMYrQYKRWWTBrIEQv9hBJtUvI/nWPGUcGomPhpF79R4IoSj7NIJd9+5zNYNz/QY2Bj mDR6s339gdWqDy7ftgvoE8TPNVgMz6N0VEHC2/wFFeNk/n1RSJV9Q1aWCg1DCQrXEOAD LFm9iWXFNam1rzpGcV3+7u4lXE8RbXfuoIyIQpmP33RpeZzAW3lGwcPrJVHmMtFT1U0L J1NwdifWre7j0fjC3LvqVuwVCCuIARka3xBWRZcU9Cak09vY7bOypkw4AxBhRWqB3O6s mXlopfG+KbzyUfClr+Gl2U6t/vxo+L8xZGCCahf6hXEJN437VwRd60gvoUpv45dExECa QEtQ== 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=dm+U4X4EOZxEx+9CgGj+1LJA+tv3/55FfGG9lW8Ffdk=; b=SbTxlcuIotgbKzneYfTCSdHOJp9e5eBpIQ1n9gBDsHsWXAQkQiTRnQtI4sDnLWFs21 VLGACq7v6/ayatSPm30LCn83ShpxKlWuE6m9aftabjRMGIOJW1fWPEaTXyExY6ilLfCF ltua2OAKsMTd2rgF5xZlKrpKE7WmTyb9estUdZ7wG3SD2dcyd2mGkg0sqyngl4bWgq94 hA9fzcKhW6+iEZO2J4JAHEzrg9r0iRhLM69rzpBpY5f+EDKE2A05debSso5Ze3QbTGSW 0E6XZM4Ea6OO9MHyQgMsSr3/F8p+ulmK29vLuzXeF/qLhwpdTynVLNgzD2A6uIy6PB6L 3pNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Zhb8WPS2; 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.55.50; Wed, 10 Mar 2021 07:55:50 -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=Zhb8WPS2; 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 S233125AbhCJPzU (ORCPT + 6 others); Wed, 10 Mar 2021 10:55:20 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50368 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbhCJPzS (ORCPT ); Wed, 10 Mar 2021 10:55:18 -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 12AFtANJ071321; Wed, 10 Mar 2021 09:55:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615391710; bh=dm+U4X4EOZxEx+9CgGj+1LJA+tv3/55FfGG9lW8Ffdk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Zhb8WPS2KOTvRel1/RxPtFnx0IhqUkyODogfUFTVgvui80jLTCyKbqo6iHIP3PgC9 cSBElsGYwd1/5Hg6Gw+vdLjCFVoFfuD2xU1UncrCXtIlnZeu6yql+sQQixx3r+8tWb Yn02EpzLR1aQIYR/48q6fjA+LR6QjZyVJKNWfIk4= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12AFtAYH029708 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Mar 2021 09:55:10 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) 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.2176.2; Wed, 10 Mar 2021 09:55:10 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) 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.2176.2 via Frontend Transport; Wed, 10 Mar 2021 09:55:10 -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 12AFsq5l082613; Wed, 10 Mar 2021 09:55:07 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Philipp Zabel , Swapnil Jakhade CC: , , Lokesh Vutla , Subject: [PATCH 4/4] phy: cadence-torrent: Explicitly request exclusive reset control Date: Wed, 10 Mar 2021 21:24:45 +0530 Message-ID: <20210310155445.534-5-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 No functional change. Since the reset controls obtained in Torrent is exclusively used by the Torrent device, use exclusive reset control request API calls. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-torrent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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 5ee1657f5a1c..ff8bb4b724c0 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -2264,7 +2264,7 @@ static int cdns_torrent_reset(struct cdns_torrent_phy *cdns_phy) return PTR_ERR(cdns_phy->phy_rst); } - cdns_phy->apb_rst = devm_reset_control_get_optional(dev, "torrent_apb"); + cdns_phy->apb_rst = devm_reset_control_get_optional_exclusive(dev, "torrent_apb"); if (IS_ERR(cdns_phy->apb_rst)) { dev_err(dev, "%s: failed to get apb reset\n", dev->of_node->full_name);