All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shradha Todi <shradha.t@samsung.com>
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 <anvesh.salveru@gmail.com>,
	Shradha Todi <shradha.t@samsung.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>
Subject: [PATCH v7 1/5] phy: core: add phy_property_present method
Date: Thu,  7 Jan 2021 20:58:39 +0530	[thread overview]
Message-ID: <1610033323-10560-2-git-send-email-shradha.t@samsung.com> (raw)
In-Reply-To: <1610033323-10560-1-git-send-email-shradha.t@samsung.com>

From: Pankaj Dubey <pankaj.dubey@samsung.com>

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 <anvesh.salveru@gmail.com>
Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Signed-off-by: Shradha Todi <shradha.t@samsung.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Vinod Koul <vkoul@kernel.org>
---
 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


  parent reply	other threads:[~2021-01-07 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210107152945epcas5p158e88c757a44e98f4e9a898d3ff5f87c@epcas5p1.samsung.com>
2021-01-07 15:28 ` [PATCH v7 0/5] Add support to handle ZRX-DC Compliant PHYs Shradha Todi
     [not found]   ` <CGME20210107153013epcas5p27700f30e341d7f1fb457035a690490c6@epcas5p2.samsung.com>
2021-01-07 15:28     ` Shradha Todi [this message]
     [not found]   ` <CGME20210107153030epcas5p14b0967c4d8d9804a2d084981af445c58@epcas5p1.samsung.com>
2021-01-07 15:28     ` [PATCH v7 2/5] PCI: dwc: add " Shradha Todi
2021-01-07 18:44       ` Bjorn Helgaas
2021-01-12  1:52         ` Pankaj Dubey
     [not found]   ` <CGME20210107153051epcas5p4f54210f89f8b8d2e18be016521657be0@epcas5p4.samsung.com>
2021-01-07 15:28     ` [PATCH v7 3/5] dt-bindings: PHY: P2U: Add binding for ZRX-DC PHY property Shradha Todi
     [not found]   ` <CGME20210107153105epcas5p49ca103794f62faa48c5bedcfc8b4a287@epcas5p4.samsung.com>
2021-01-07 15:28     ` [PATCH v7 4/5] PCI: tegra: Remove platform driver support for ZRX-DC compliant PHY Shradha Todi
2021-01-07 18:46       ` kernel test robot
2021-01-07 18:46         ` kernel test robot
     [not found]   ` <CGME20210107153116epcas5p3510286e503e690537d5b2eb7486fa7ab@epcas5p3.samsung.com>
2021-01-07 15:28     ` [PATCH v7 5/5] arm64: tegra: Add support for ZRX DC PHY property Shradha Todi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1610033323-10560-2-git-send-email-shradha.t@samsung.com \
    --to=shradha.t@samsung.com \
    --cc=anvesh.salveru@gmail.com \
    --cc=hari.tv@samsung.com \
    --cc=kishon@ti.com \
    --cc=l.mehra@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=niyas.ahmed@samsung.com \
    --cc=p.rajanbabu@samsung.com \
    --cc=pankaj.dubey@samsung.com \
    --cc=sriram.dash@samsung.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.