Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp793516ybl; Fri, 13 Dec 2019 04:48:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwZebN7LzYzE0HBTt9RFUd+Ok6/r6bBvtrNCiqRRm4E2g58B50KYV/wfRaYEEPx/5g6soyu X-Received: by 2002:a9d:7342:: with SMTP id l2mr14436917otk.98.1576241333732; Fri, 13 Dec 2019 04:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576241333; cv=none; d=google.com; s=arc-20160816; b=x072An2snjegQoNisf4aoYZ/Uocbg79cloS5kxdsKUXXWO4KL0g7vjoMzIRb22sEcB sPKUW90beKh2h1X4lKjdq2vsaVNj6ft+L4l2PnyOCMsTymacByC/yTN7sGaw5RrmnMvP 5fJE/nQjXw4in3NaognGlcbHPiKaJaQXv86Q8lp1tLvOYfWkCfCh1dB+CAUt7cbGW1DI cqNk21K+ArdAwWZn4TEhWk7sK/guWvAOM+FSoEuERo82Auuv+fNB+3lD0ANRBYorYCQz 0RTnusxfZCc5vo4maaPaoH7p/QGvBpn1+1TsB+0P1qJUxYXgfujx80Q9AEsgFQ6J5bLC Qkng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=dF+joeRXr35w+KD/l41FVim/VsNsTXNOaCTaNQOGVFQ=; b=rZZ7gc/jvARWJf6isJP7dTxvY4g3Djx1qSUhH73OcTZbA62oQnNS3d9A350M06oU7K 7gJaRRwWS4iaVKlUgErMOIBgOfOgA8ozFnHoln2bQjyHRo3Wjof6JW93RX/ScU/N2fcD IR+6v6DGxAktxil164lnftH3K1pS7nPrFlmlTvDnz0fvgjJbkMRn9GdOTquMllGjifF4 fl7TPS0aHF2RrB9YNZM311nrhs88E+1lAuwJenzgXeKpvgf4BKm8yJRrfFf6i7rOit39 oLM3EgtvZdLcQe31bWxtCpl4m6GAqhkv3vHIdRctaGCSD7eho28tqu0OxJ8+n7//FhOB NAtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=akI56QVW; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f65si5068527oib.0.2019.12.13.04.48.42; Fri, 13 Dec 2019 04:48:53 -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=@samsung.com header.s=mail20170921 header.b=akI56QVW; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727220AbfLMMsB (ORCPT + 99 others); Fri, 13 Dec 2019 07:48:01 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:60463 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727110AbfLMMsB (ORCPT ); Fri, 13 Dec 2019 07:48:01 -0500 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20191213124759epoutp02858226226f2d8d8757ae562b6dd31445~f7xeMJTyy1107011070epoutp02u for ; Fri, 13 Dec 2019 12:47:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20191213124759epoutp02858226226f2d8d8757ae562b6dd31445~f7xeMJTyy1107011070epoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1576241279; bh=dF+joeRXr35w+KD/l41FVim/VsNsTXNOaCTaNQOGVFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=akI56QVWu6ta9fk/XapZnx4fk5JSYdCDcc4bdMZsAL6gLr7PIEuRMq5MQ7QMbIL2x XVzWg4CC3Di97pfICctKDXq2Z94uwePy4zYDC0UYkjq7K7eByoaKQZWqWBZ0LbQNvd t3HB1UoUudVQm6l2YHb+Gmj0EDMgJxaJLUSpexUc= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20191213124758epcas5p325b8c0b96bc9adf40f3586d711c941b6~f7xdvrJmU1050310503epcas5p35; Fri, 13 Dec 2019 12:47:58 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 77.17.19629.E7883FD5; Fri, 13 Dec 2019 21:47:58 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20191213124758epcas5p1dd57ce8a5940b81ec6988228e0db8cb9~f7xdeQjES3254632546epcas5p1i; Fri, 13 Dec 2019 12:47:58 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20191213124758epsmtrp2d5dd8aee37da48ad51454feb3e40e19b~f7xddmP-p2430824308epsmtrp2I; Fri, 13 Dec 2019 12:47:58 +0000 (GMT) X-AuditID: b6c32a4b-32dff70000014cad-17-5df3887ee951 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 0D.BC.10238.E7883FD5; Fri, 13 Dec 2019 21:47:58 +0900 (KST) Received: from ubuntu.sa.corp.samsungelectronics.net (unknown [107.108.83.125]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191213124756epsmtip2826c13f340ef5e2ddc8639a257fef612~f7xbtC3rk0678306783epsmtip27; Fri, 13 Dec 2019 12:47:56 +0000 (GMT) From: Anvesh Salveru To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: kishon@ti.com, jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, lorenzo.pieralisi@arm.com, andrew.murray@arm.com, bhelgaas@google.com, pankaj.dubey@samsung.com, mark.rutland@arm.com, robh+dt@kernel.org, Anvesh Salveru Subject: [PATCH v5 1/2] phy: core: add phy_property_present method Date: Fri, 13 Dec 2019 18:17:42 +0530 Message-Id: <1576241263-23817-2-git-send-email-anvesh.s@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1576241263-23817-1-git-send-email-anvesh.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSbUhTYRTHeXa3e6/D5dMUOhkZjkJUnIkJFxSNMLhQ9PItSqmbXpykc2xq ahFmqVdJKR3idJiagi1fcJkvs5H40uqDpmmY0Kgo6QUTdcMwy+p2J337/f/nnOd/ODw0oRYU wXSmPpc36rksDamU94+FR0RdEzypB18KIcyN3wMKZtLRomDaSnSMwy1QTIfXQjHTi7dIZtZh JZnJJhfJLG1+ppj2+RkZ0/rISzGlznHqsD/b2dSJ2KEGN8U22/NYu62CZKv7bIjte+JBrOv1 gIz12ENO0WeVCel8VmY+b4xOvKDUmb+rDUJggXdZW4zeBFQiPxrwIZh9aCErkZJW42EE5vUa mSTWEDTP2X1iHUHvSAfaHvnS0oKkghPBnQnBJ27KoLV2TiZ2kTgSNiaclMhBOB7GyvtIkQm8 heCDtUDkQHwEnj5e/evTtBwfgHrLSdFW4WSwvbP6wkJgYaqCENkPH4XxHz0KMQvwPAmDL2oV UlMy/OoWfBwIX119lMTB4Fl2khLnQJW73edfBbNb8AUkwcicVS7uQOBw6HFES2vugKrNjzLR BqwCoUwtoQbKLFekQYB7dxcIiVl4vjxDSFeoRzD2wEPeRnsb/j/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df9qcz2JIlZV11eWGXF+hOm9fv2KLEUZyQaajEXFScCAIcs jidaAgAA X-CMS-MailID: 20191213124758epcas5p1dd57ce8a5940b81ec6988228e0db8cb9 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P X-CMS-RootMailID: 20191213124758epcas5p1dd57ce8a5940b81ec6988228e0db8cb9 References: <1576241263-23817-1-git-send-email-anvesh.s@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes w.r.t v4: - Addressed review comments from Andrew Murray drivers/phy/phy-core.c | 17 +++++++++++++++++ include/linux/phy/phy.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index b04f4fe..f3ec28f 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -420,6 +420,23 @@ 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) +{ + 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 56d3a10..9d8240d 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -218,6 +218,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; @@ -355,6 +356,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