From patchwork Wed Oct 23 12:57:26 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: 177286 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp688578ill; Wed, 23 Oct 2019 05:58:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJeLNOsESemCf33SpWs1VSGxNGdI3KqEsxQiTJek2e4/DjlIGvcJFsUNNHMPTcu0S5ZAgq X-Received: by 2002:aa7:d8c6:: with SMTP id k6mr37357531eds.87.1571835539613; Wed, 23 Oct 2019 05:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571835539; cv=none; d=google.com; s=arc-20160816; b=K0k/LC7H/6av+8h9QleiugVIraWaWytBT5lan8gvTRsRJIdOJtU+v89I1uqS2Azd1T lqP+EAEsEcoCLlCsNnZ5SJmf1mEJsDVCUXNfhn7sJL1rj+kKKrwuiBRvaVmTarKcchiZ AWpSXud9KD8QB9v6abFreMnXnuYKRkUaZQhk3vxwGwzv7JZjOnqE24fGuOfyndL7SKUc Hu9m2cPyUDjv7Ecs7JHRDB0ZRbeUc6R8cnRfgZWWKSOaEirMtrJY3lM7c65Gy4hNNPbg +RFeoC9+TV4Vv79EYw2nvqT7mSg7d8UO0vtoFyJc5u+apWc6Ah2AnJq5gdb8WT5xl3KA OvZw== 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 z16si4338111edi.241.2019.10.23.05.58.59; Wed, 23 Oct 2019 05:58:59 -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 S2405448AbfJWM6h (ORCPT + 26 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 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 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;