Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4280654pxf; Tue, 30 Mar 2021 04:03:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCnBPRv2js0RJTnL5r+X/yvlSNGwSkiGKfGFY1RFIEZIGi2aWwKrLJ09L9PwVyQE3ey4VK X-Received: by 2002:a17:906:368c:: with SMTP id a12mr19955191ejc.389.1617102231005; Tue, 30 Mar 2021 04:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617102230; cv=none; d=google.com; s=arc-20160816; b=Jfb7nb+SqT4auuBvkF3y3YIXPQdsLB1Gya4DHBSd3IuAF2SzzzX6/JLlnGihA8Xj+/ DQFfQGpPIRvywTH6e2Hjvy3p2ySoNaDr7QuW7dgeazfTmiNMVyMpJACXCmMZvrvK7hQ5 Wa0F5O7diUcQvcBZK8b0I4ObAq7XE8ySTrzPntFZd0PjLR0p7Cy5NSXVzT+wW/NET+Lm 7qMbMstUS2keOOBIpExisuEuzknClbJRqXEV1ij2jCXF0Gx8ZgEk/fB81aNU7Hbd9Kwl y+H/R1L0VVXPpBOGKI3KqmiZD+xGbLMCLUP2bD0z7E2czkulu1+0eJeeMTeg1j+u+Lkw UEqw== 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=FhOFW8djk/cX9R/jpMPFdUcWiw9h8mkNRCT97qJ/aw2C2nDG+ljcavfvEUFIWpySKO Ho2t6zmvKqUfrNcb8klM3tNbdbvXyAmoB5G7ifY28Lg5Cd7lCkBGd/P6bmQQM9c1IgOP SfxMNybkXxJUsBjDMbAtCMBId7gWfSJdxVu87IBLIIA2KLxV154MZ1FNGeJeo4KC184x FcVWsVSjgIeia82K22MmAPUBH62RFKIEVIfw0qzFnhDTnd6gXIhaioVDdBGJICTSAU8a 7S3X1rLbHZ6J9VnzUw+ze5acrwi5KE0Uw+jYkDhtumEpIBaercNQjLu1lx+v5jQgqkRz 4Xrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=IZ1FeIkd; 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 w2si15437458edc.92.2021.03.30.04.03.27; Tue, 30 Mar 2021 04:03:50 -0700 (PDT) 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=IZ1FeIkd; 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 S231749AbhC3LCe (ORCPT + 99 others); Tue, 30 Mar 2021 07:02:34 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:52282 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231767AbhC3LCD (ORCPT ); Tue, 30 Mar 2021 07:02:03 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 12UB1kSq118758; Tue, 30 Mar 2021 06:01:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1617102106; bh=DWDQ/I1EftwxzOF/aY9rBU7dyDN4w0Pjm02jY9b0Yg0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IZ1FeIkdvspK2OWO4xBvNKymvZGnjuzZirDrB6OM0yAgAIbIF8Nj+sbDYQ0jAmcgm eObL3NwrwseIvvd37fPbnf/ZuObgzJJIjE76SHqRUJvF6W9nP9Ysc7i91kJVR07ePc aieVEXXI+qzUGD0IGTX45etlT/Mklu79J05raBFQ= 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 12UB1k9j022781 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Mar 2021 06:01:46 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) 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.2176.2; Tue, 30 Mar 2021 06:01:46 -0500 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.2176.2 via Frontend Transport; Tue, 30 Mar 2021 06:01:46 -0500 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 12UB1dcj094447; Tue, 30 Mar 2021 06:01:43 -0500 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Philipp Zabel CC: Swapnil Jakhade , , , Lokesh Vutla Subject: [PATCH v2 1/5] phy: ti: j721e-wiz: Do not configure wiz if its already configured Date: Tue, 30 Mar 2021 16:31:34 +0530 Message-ID: <20210330110138.24356-2-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210330110138.24356-1-kishon@ti.com> References: <20210330110138.24356-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 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(-) 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); -- 2.17.1