Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp418911pxu; Thu, 7 Jan 2021 08:13:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJweiFUGCC+qCnNirUFxAs4312FLCynL/5vdOcdCU4nEmQ+FzjXcOOemDtp7citMhWpLfLMO X-Received: by 2002:a17:906:a015:: with SMTP id p21mr7216019ejy.49.1610035992770; Thu, 07 Jan 2021 08:13:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610035992; cv=none; d=google.com; s=arc-20160816; b=KitV/pJqSNZK75AxL1465Q9PpXTASkUhLcLXQLMODKbV6z/2wOQujymOpxdpekYsIJ PhoeGm0xbgJOm8cLu7wlK0sjDpaHIeYQKjYC2Ls4+hqjGoCcQBliPvAIbrLqGZ5ZN/nK TvMTvrwECB6X3cQJNMLO66HQ4F/Yrm9deZFbxo13WzIUOmgS+JSBxCFa+ZncSt+fsviu vFsIWstlxuYCISNpFwJdlnfSZBIFKMVihHD57HBZl695SSP+GY0pn49We2JBcvWHApGg j341ABysLKQnFdjg4nOWgLRxZJkHWG8Ldt7a6F+e5TEtcWT1GZvJo05I72eye5AE2TiN y2PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=GHrxWzjNq+WBPx404+TbgCs2tA0hCKSMho/LiimfpuA=; b=0EOzb0NN6aRukr104IQnWXIQEHcA4Z0B0R0iBbN8Q6m1+r0i2p2ErS3s7WaHOmePAt V855yxQ9MMxOAF4gcfrLTIHMNCbbUv9HNDuNN49+DNTZrt+WNujRuwO8PoRaMQsBdnYN lDXQfBeSnTDm0jXTfkicMnAn7M/guwWtDVy3RPAMx8AqHyyzODCA0MN+IM46KFQLbL7E 3pNTH5xA/xWrZ/eBlxvpK0db6HlpNHgf5jhResYlYecEzS1AmWbCXqW3J1k1Z+5owaOt XmNfE3syvMsrqvqJIXVhg315d76pBPFrVc52cJyDqkADvEqslM5eldvRcXQ5jl4d8Evu aiJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cCNHcsyA; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si2400053edh.496.2021.01.07.08.12.49; Thu, 07 Jan 2021 08:13:12 -0800 (PST) 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=@samsung.com header.s=mail20170921 header.b=cCNHcsyA; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728475AbhAGQLG (ORCPT + 99 others); Thu, 7 Jan 2021 11:11:06 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:18755 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728491AbhAGQLF (ORCPT ); Thu, 7 Jan 2021 11:11:05 -0500 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210107161022epoutp02b2b702c70b107893333a82c81f6c155d~X-wzMJD-W0999209992epoutp025 for ; Thu, 7 Jan 2021 16:10:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210107161022epoutp02b2b702c70b107893333a82c81f6c155d~X-wzMJD-W0999209992epoutp025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1610035822; bh=GHrxWzjNq+WBPx404+TbgCs2tA0hCKSMho/LiimfpuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cCNHcsyAyEss8LASwcTSiS5R5quq8nc9fg8m54XTaV/bsOcKTngef+UOlHQRFKpBJ 2TaF4F9RmVjEMakuyGXJb5uL2UnHS6y+1SjSbJkerKaMIduvvvskA5Qs/qfWjZDiEN CaKkYdAjAvGR7ECSXCMDZK14z098fQz+a3CKfoFs= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20210107161021epcas5p4e993bf605cb33b60c3ebac688cb19ac2~X-wyf_tzp1957119571epcas5p4Y; Thu, 7 Jan 2021 16:10:21 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 08.AE.15682.D6237FF5; Fri, 8 Jan 2021 01:10:21 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20210107153013epcas5p27700f30e341d7f1fb457035a690490c6~X-NvctQD92347223472epcas5p2r; Thu, 7 Jan 2021 15:30:13 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210107153013epsmtrp14014498c1239563402002bee1f1e6bed~X-NvbD-yG2999429994epsmtrp1E; Thu, 7 Jan 2021 15:30:13 +0000 (GMT) X-AuditID: b6c32a49-8bfff70000013d42-64-5ff7326d2e77 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id D6.F3.13470.40927FF5; Fri, 8 Jan 2021 00:30:12 +0900 (KST) Received: from ubuntu.sa.corp.samsungelectronics.net (unknown [107.108.83.125]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210107153011epsmtip2866ddeedca2aea915f7b2fa686e089c7~X-Ntk70bI2046620466epsmtip2R; Thu, 7 Jan 2021 15:30:10 +0000 (GMT) From: Shradha Todi To: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org Cc: pankaj.dubey@samsung.com, sriram.dash@samsung.com, niyas.ahmed@samsung.com, p.rajanbabu@samsung.com, l.mehra@samsung.com, hari.tv@samsung.com, Anvesh Salveru , Shradha Todi , Kishon Vijay Abraham I , Vinod Koul Subject: [PATCH v7 1/5] phy: core: add phy_property_present method Date: Thu, 7 Jan 2021 20:58:39 +0530 Message-Id: <1610033323-10560-2-git-send-email-shradha.t@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610033323-10560-1-git-send-email-shradha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe0hTYRjG+845247S6jSN3matWuat0rLbEbpK2iwrYYSggo06WEy3tXkp RbOb5rxCTtDETKV0paJZ07QyLZWsMNdlptYIo+yCpXOTzC7zJP33e573+Z4XXj4SF/wihORR RSyjVsiixVxH4la7p/vqGF9b5BrtWxd64loeTn8vqMLonvdZXHrggwnRxtvFXPpJSSeXzrAU cemh/Hcc+mGdlC67aeHR2e3JtKmWRzcNdOHb+ZKmokGepF6fwZXkNOiRpNNkwCRj9aIQTpjj 5sNM9NF4Ru2z9aDjkbqcEUJ1yfn4VJ8RT0VmSoscSKDWgzbrC0+LHEkB1Ywg+7QVsWIUwfkf +QQrrAiqM59xZ570VQ79S91BUDlWjbHiLAaTny3InuJSXnBqXIvb2ZkKg0LDOY49hFN1GHQM 9RL2gRPlD+kGG8fOBLUCOobP/GWS5FMBYEpXs9tE0Pc0Y7rHgQoEa0ENh/W/8qChScryTjC0 ZuIsO8GnzgYey0IYzk37x0rQ9bwn7PVAHYerWSmsvQ1anxdP2zjlCbW3fVh7Mege1WB2xqk5 kD05hLE+HxpLZng5WKZaCJYXQkmHkcO2S2DSupK9SCGC8mYdlodERf83lCKkRwsZ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9HDg9eGr5pK5sell+cceViAsOyX8nTrlR2V01Z94nF/iFD1B/dgst/f0+3tEvl dfrz72AtE4/8/VOno2R/Bs/KTLNbv29eYkvO50XTXs+wEOFo6LHMPnJLiM+sjscgxV58wf6k UHOXa4EMui8+bcpKfMotEbJ8UUHD4mO2p40zP5Xv9Xc/9Ksu66hT41vFui2nbyxy2m52ZN1H yeUr7s2aWf/y3ps9R7kEruhPneKgsfLL0wd+GxY+5C38XnFrr617s7I0S3hNDe+8859il771 CFhlIsR00mdLZbCaRWLhrZy86StXq/s8tog4b+PVapQ72/AG347L25RYijMSDbWYi4oTAb6G PmvDAgAA X-CMS-MailID: 20210107153013epcas5p27700f30e341d7f1fb457035a690490c6 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210107153013epcas5p27700f30e341d7f1fb457035a690490c6 References: <1610033323-10560-1-git-send-email-shradha.t@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pankaj Dubey In some platforms, we need information of phy properties in the controller drivers. This patch adds a new phy_property_present() method which can be used to check if some property exists in PHY or not. In case of DesignWare PCIe controller, we need to write into controller register to specify about ZRX-DC compliance property of the PHY, which reduces the power consumption during lower power states. Signed-off-by: Anvesh Salveru Signed-off-by: Pankaj Dubey Signed-off-by: Shradha Todi Cc: Kishon Vijay Abraham I Cc: Vinod Koul --- drivers/phy/phy-core.c | 20 ++++++++++++++++++++ include/linux/phy/phy.h | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 71cb108..e4ecd41 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -420,6 +420,26 @@ int phy_calibrate(struct phy *phy) EXPORT_SYMBOL_GPL(phy_calibrate); /** + * phy_property_present() - checks if the property is present in PHY + * @phy: the phy returned by phy_get() + * @property: name of the property to check + * + * Used to check if the given property is present in PHY. + * Searches for the given property in the phy device tree + * node. + * + * Returns: true if property exists, false otherwise + */ +bool phy_property_present(struct phy *phy, const char *property) +{ + if (!phy) + return false; + + return of_property_read_bool(phy->dev.of_node, property); +} +EXPORT_SYMBOL_GPL(phy_property_present); + +/** * phy_configure() - Changes the phy parameters * @phy: the phy returned by phy_get() * @opts: New configuration to apply diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index e435bdb..cdecb07 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -225,6 +225,7 @@ static inline enum phy_mode phy_get_mode(struct phy *phy) } int phy_reset(struct phy *phy); int phy_calibrate(struct phy *phy); +bool phy_property_present(struct phy *phy, const char *property); static inline int phy_get_bus_width(struct phy *phy) { return phy->attrs.bus_width; @@ -363,6 +364,11 @@ static inline int phy_calibrate(struct phy *phy) return -ENOSYS; } +static inline bool phy_property_present(struct phy *phy, const char *property) +{ + return false; +} + static inline int phy_configure(struct phy *phy, union phy_configure_opts *opts) { -- 2.7.4