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);