From patchwork Thu Nov 28 10:46:39 2019 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: 180393 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7346593ilf; Thu, 28 Nov 2019 02:47:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwaBBa7ZKnbMrq+FXcF1tb0yxhKYRwdeHMmXbxZXfvBwbTV1avqK8kLQaoYMD2AmqLRPqPv X-Received: by 2002:aa7:d8c4:: with SMTP id k4mr905406eds.299.1574938077852; Thu, 28 Nov 2019 02:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574938077; cv=none; d=google.com; s=arc-20160816; b=zGP6p4IThl1jaStoiCzDjoh8Ir/HTQ2Ra89qTkv5rZfHdP3Pl20aho/Qw5994ZALRi NSjtzurb01+75V76yn4z66geoenr6QjXzRvlLwygkT00GOsrU8JCjUabWUn+ptK4dkFo F9/ywAEnueiegM+3JjrTnjFoMcDcyVmAWxB6ilBjm2cDzDcerptdM0WOe1zmPIyN2PAI Y9dj8yTeTYHRiCr8yF5uMLEUN1RFc466XCJ3F4TuvCTRpwcfdzVR+YLETdAjwbn2AnN6 F4Lo7VmT2BNkxdqRUN0FDOJBzeoA4qcveTjqfBVzH2kne8FRsIf9d+67L60FqKZnwxdp G22g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=KgCdmhuOnIHUcH9TRzqb5Eaq1xWjKMdqrGjEhzQdvbA=; b=WB4v44P1VDBQs85nfmVYGJS7wHNGN2I5Mn9nRJh9aRySVpcxexNBDsMczkSg4DkEHw b2aRRnhWgo7bOumfs9AurtUQGc0rulUZPtwigtHPU7fqTaojcG5ObTFW5y2nRq12iRg+ Kt2ZFnOY1P6SOxYsmPxsDXrtDQU07bEFffd0R19SjbMok4Bb48ScYtqCK3GndIiGiFKZ cRnrmLt+O0RmmtVo4up0zWN8FV3LyajbsbQrJP5MeqxeRaVwdUZB9LKL5HGC8jOdjmFW yfAHU5+BQMB1dWGotbA3d4M4ntktJPh5S7IkodhdH6307ikF5cR8Ry4s8MWvA7kvIaq3 nPkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aYTpBBll; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id k20si10800630ejj.21.2019.11.28.02.47.57; Thu, 28 Nov 2019 02:47:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aYTpBBll; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727139AbfK1Kr4 (ORCPT + 26 others); Thu, 28 Nov 2019 05:47:56 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:58040 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727091AbfK1Krx (ORCPT ); Thu, 28 Nov 2019 05:47:53 -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 xASAloJN096691; Thu, 28 Nov 2019 04:47:50 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574938070; bh=KgCdmhuOnIHUcH9TRzqb5Eaq1xWjKMdqrGjEhzQdvbA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aYTpBBllxSotKLUS+3aoeu31JUJNmHMGX1d6IHWfltmRBfws9iWrTeRUXljYo1SXt R2jejvIr6vx1FrTi1wGnJAGTixTXhsQw2Si7nlkNPPaGvchV8BSNWlQ1sVohXV4X0Z Lip9z23+0APbFNPUbFTt0YZZjvMY43x2lz9NUtZ8= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xASAlo7A118143; Thu, 28 Nov 2019 04:47:50 -0600 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 28 Nov 2019 04:47:49 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 28 Nov 2019 04:47:49 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xASAlX42098163; Thu, 28 Nov 2019 04:47:47 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Rob Herring , Anil Varughese , Roger Quadros , Jyri Sarha CC: , Subject: [PATCH v3 05/14] phy: cadence: Sierra: Make cdns_sierra_phy_init() as phy_ops Date: Thu, 28 Nov 2019 16:16:39 +0530 Message-ID: <20191128104648.21894-6-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191128104648.21894-1-kishon@ti.com> References: <20191128104648.21894-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of invoking cdns_sierra_phy_init() from probe, add it in phy_ops so that it's initialized when the PHY consumer invokes phy_init() Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index d3b0dac2db77..bc2ae260359c 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -176,7 +176,7 @@ static struct regmap_config cdns_sierra_phy_config_ctrl_config = { .reg_read = cdns_regmap_read, }; -static void cdns_sierra_phy_init(struct phy *gphy) +static int cdns_sierra_phy_init(struct phy *gphy) { struct cdns_sierra_inst *ins = phy_get_drvdata(gphy); struct cdns_sierra_phy *phy = dev_get_drvdata(gphy->dev.parent); @@ -185,6 +185,10 @@ static void cdns_sierra_phy_init(struct phy *gphy) struct cdns_reg_pairs *vals; u32 num_regs; + /* Initialise the PHY registers, unless auto configured */ + if (phy->autoconf) + return 0; + if (ins->phy_type == PHY_TYPE_PCIE) { num_regs = phy->init_data->pcie_regs; vals = phy->init_data->pcie_vals; @@ -192,7 +196,7 @@ static void cdns_sierra_phy_init(struct phy *gphy) num_regs = phy->init_data->usb_regs; vals = phy->init_data->usb_vals; } else { - return; + return -EINVAL; } for (i = 0; i < ins->num_lanes; i++) { for (j = 0; j < num_regs ; j++) { @@ -200,6 +204,8 @@ static void cdns_sierra_phy_init(struct phy *gphy) regmap_write(regmap, vals[j].off, vals[j].val); } } + + return 0; } static int cdns_sierra_phy_on(struct phy *gphy) @@ -218,6 +224,7 @@ static int cdns_sierra_phy_off(struct phy *gphy) } static const struct phy_ops ops = { + .init = cdns_sierra_phy_init, .power_on = cdns_sierra_phy_on, .power_off = cdns_sierra_phy_off, .owner = THIS_MODULE, @@ -438,10 +445,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) sp->phys[node].phy = gphy; phy_set_drvdata(gphy, &sp->phys[node]); - /* Initialise the PHY registers, unless auto configured */ - if (!sp->autoconf) - cdns_sierra_phy_init(gphy); - node++; } sp->nsubnodes = node;