From patchwork Wed Oct 16 11:31:09 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: 176469 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp7234496ill; Wed, 16 Oct 2019 04:32:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuCx5YbfsWWd7fmS4H3+N9BVrCRZdgu7lFw6GrFzKO/dUzMTDHNOzjRsMyJJ3cTTyTvhLu X-Received: by 2002:a17:906:fca8:: with SMTP id qw8mr40288772ejb.188.1571225560321; Wed, 16 Oct 2019 04:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571225560; cv=none; d=google.com; s=arc-20160816; b=vxoZw9QPt7PhbAhTIf1UgPWLvazs0PMROxResWR4GFf4kMd0TDOpODyQLn+Vq+urNS QqsqiEohJumKE3JuYE/F/a+Pvp0L80lvUjqLNLEMSZiLSmAoJw7v2M1j0BRW2uJTled2 GDjwEz+BW+4cBUe/nEhh4QxqEX8HiE+lMuCNA19csY1aLoWHfYUwzu8nag8ls5Nrp8IF 9uPzaMCiKcLFATpaIoZRZmTiwGBDvJZqzZ+PhfcrFTRyn7YMVRToG/1rKQd3/yGBbTuG fYwcPtcfsgFUN7alR/Qeo+KLJ/+WmmpaQTfsHpgAKxZGox+PM/OagC9J5og1RKGeT5Fv IK9g== 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=hv+R3uvW2LsejsraX4U8M8EcHSO9sthhFITpxkqSU+3NWvAEi1FCN3K2AdqNguVpxc nEM6ky10AQbGn/hP0qik2ccw4+YZtDAp50TMbWFdUvtTDcrYIw5+Yqt189K6r/f+kvpW fj6FifkEBH+QhszowcSe9fqyScgPAsWC/px9oNnREw9HXM/XTgEAuuVZxSLyZjDypqxp a84IrgS9Q6tPPFnS99qoPXHifvWmb2ForAU4MznbDCTL51it3l5o3Mh6z/XaAlZBZIOs w0qwhmMs8YZ+yPm2rDqVlznyflUL0RgZHVWMsy09mkpR5TDCsaRkjscX9R1V3CDOqqiB RLPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aiH2bDkZ; 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 d1si15575971eds.148.2019.10.16.04.32.39; Wed, 16 Oct 2019 04:32:40 -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=aiH2bDkZ; 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 S2405128AbfJPLcg (ORCPT + 26 others); Wed, 16 Oct 2019 07:32:36 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:43572 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405015AbfJPLcD (ORCPT ); Wed, 16 Oct 2019 07:32: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 x9GBW0c3104070; Wed, 16 Oct 2019 06:32:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571225521; bh=FYnyDkp8O13hgdHJFePiQ3GXV91GcizfC8VXOBovgOI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aiH2bDkZvm0M9NKL0SNcRGN/ppi7gtvIBZQ4REoFOEKZ4rx1LnI3bRvq5DItXDnHr Ktt8/kV6wLtBBrshoP650loZVfWXmO3wYbr/Lcn6L+UqhWYSsRZfPsi8Z5wwAJ9ocE u785tMD6YXvoGMJNosccAAN+75ibWIvtldGaspRQ= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9GBW0AR113772 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 Oct 2019 06:32:00 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 16 Oct 2019 06:31:53 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) 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.1713.5 via Frontend Transport; Wed, 16 Oct 2019 06:31:53 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9GBVkm9097485; Wed, 16 Oct 2019 06:31:58 -0500 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Roger Quadros , Jyri Sarha CC: Anil Varughese , , Subject: [PATCH 05/13] phy: cadence: Sierra: Make cdns_sierra_phy_init() as phy_ops Date: Wed, 16 Oct 2019 17:01:09 +0530 Message-ID: <20191016113117.12370-6-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191016113117.12370-1-kishon@ti.com> References: <20191016113117.12370-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;