Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1268361ybg; Wed, 23 Oct 2019 13:03:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIiqQa6lU4G7j2tamPlW9dWX5jumXI3ksl26yFMTEs7jxl2EP6DAEZOMsGKyFSh9wY7v2h X-Received: by 2002:a50:e606:: with SMTP id y6mr39362737edm.261.1571861000929; Wed, 23 Oct 2019 13:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571861000; cv=none; d=google.com; s=arc-20160816; b=VIL4hhljF6tTbXcPuX51Yq29i6HJgxKgJ+skoUhSOjc/QIWYnXAm9sRf8VAwCMMZJN zd01RHQ75pTDNcw2ASn0qKRqxS5BIYiaheYm/VKrXeoLmuo1Z1ac5rYmD7owKlK2dd+P 9JrTwKZNiM0BXX3hFtIMXRiCcmVNBLk0enJ7DGIsTCln4RC+aSfjwQLtwy/Ma20tMwPD qqNZSPfhK2RYCJZ7MgEuoMiDiEJjDLDShn0k6uf6d/PScT/kP3y9lWcLNTiRJWzuUq2U 5CZr2Q+h03l5DRImRUkUEUfeOq9YG30KdV1ZkDahH7x0kqs8IeeACef43W6WOCrNYwE+ Wt6Q== 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=FYnyDkp8O13hgdHJFePiQ3GXV91GcizfC8VXOBovgOI=; b=RUcRaD7kkF3/mJcyBA+oCrQxI1YG/PLu+ma/hDYad8llh3/LHbBLFTWOIF6Vqid4Kp FhAaADyxvSOZZVTexjdzCdvdakPewm6fQ8StyCvadxSueyho0Axy3liQCrDjKpQCIRiQ LxTVzNgfT+oNq/FW2XGTha/XCHjkzvvSNSxsN6+QyKDSccJ5FA9ax7UweM8eW+HDdQL8 QB/xCfm3+8yVOtt43QnZhSjboLOXkNtkEg+AHUlTIP0ixXyR6XuQtehdWPY5SRE3EaRW jv7wlbPaMnmDCMJXAryiCy2SMxkUTo1zUYnvsAdDcSKQdLDguqVbOR0yZFGFxUEc5rGL LWvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Tzn2NI+i; 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 i5si15449452edj.107.2019.10.23.13.02.52; Wed, 23 Oct 2019 13:03:20 -0700 (PDT) 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=Tzn2NI+i; 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 S2405443AbfJWM6h (ORCPT + 99 others); Wed, 23 Oct 2019 08:58:37 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50288 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405421AbfJWM6e (ORCPT ); Wed, 23 Oct 2019 08:58:34 -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 x9NCwKxH040803; Wed, 23 Oct 2019 07:58:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571835500; bh=FYnyDkp8O13hgdHJFePiQ3GXV91GcizfC8VXOBovgOI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Tzn2NI+ig2NSGbsj3yXw+3L1hMkMnusfWQBJT0WZpwD87D3R/NEGNNz7F2H2RT4oA d6lhETb4U2zhFg45SDmVke4vHRDztsV0uf+MRL+2Mx/q4EuWinqsq/X65JgkGlL3CX C7ZmneF2LfdyjajsWwm/NHbv1oSwdQ2G5B4cXavs= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9NCwKmW100596 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 23 Oct 2019 07:58:20 -0500 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.1713.5; Wed, 23 Oct 2019 07:58:20 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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.1713.5 via Frontend Transport; Wed, 23 Oct 2019 07:58:10 -0500 Received: from a0393678ub.india.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 x9NCw5o9061147; Wed, 23 Oct 2019 07:58:18 -0500 From: Kishon Vijay Abraham I To: Rob Herring , Kishon Vijay Abraham I , Roger Quadros , Jyri Sarha CC: Anil Varughese , , Subject: [PATCH v2 05/14] phy: cadence: Sierra: Make cdns_sierra_phy_init() as phy_ops Date: Wed, 23 Oct 2019 18:27:26 +0530 Message-ID: <20191023125735.4713-6-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023125735.4713-1-kishon@ti.com> References: <20191023125735.4713-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain 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(-) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 89a3b732c311..5c617248841f 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -174,7 +174,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); @@ -183,6 +183,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; @@ -190,7 +194,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++) { @@ -198,6 +202,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) @@ -216,6 +222,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, @@ -436,10 +443,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; -- 2.17.1