lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 26 May 2020 16:35:03 +0200
From:   Yuti Amonkar <yamonkar@...ence.com>
To:     <linux-kernel@...r.kernel.org>, <kishon@...com>,
        <robh+dt@...nel.org>, <mark.rutland@....com>, <maxime@...no.tech>
CC:     <nsekhar@...com>, <jsarha@...com>, <tomi.valkeinen@...com>,
        <praneeth@...com>, <mparab@...ence.com>, <sjakhade@...ence.com>,
        <yamonkar@...ence.com>
Subject: [PATCH v2 1/2] phy: Add max_link_rate as a PHY attribute and APIs to get/set phy_attrs

The patch adds a pair of APIs that allows generic PHY subsystem
to get/set PHY attributes supported by the PHY. The PHY provider
driver may use phy_set_attrs() to set phy attributes that the PHY
supports. The controller driver may then use phy_get_attrs()
to fetch the PHY attributes to properly configure the controller.

Signed-off-by: Yuti Amonkar <yamonkar@...ence.com>
---
 include/linux/phy/phy.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index bcee8eba62b3..48693321ae36 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -119,6 +119,7 @@ struct phy_ops {
  */
 struct phy_attrs {
 	u32			bus_width;
+	u32			max_link_rate;
 	enum phy_mode		mode;
 };
 
@@ -231,6 +232,20 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
 {
 	phy->attrs.bus_width = bus_width;
 }
+
+static inline void phy_get_attrs(struct phy *phy, struct phy_attrs *attrs)
+{
+	attrs->bus_width = phy->attrs.bus_width;
+	attrs->max_link_rate = phy->attrs.max_link_rate;
+	attrs->mode = phy->attrs.mode;
+}
+
+static inline void phy_set_attrs(struct phy *phy, struct phy_attrs attrs)
+{
+	phy->attrs.bus_width = attrs.bus_width;
+	phy->attrs.max_link_rate = attrs.max_link_rate;
+	phy->attrs.mode = attrs.mode;
+}
 struct phy *phy_get(struct device *dev, const char *string);
 struct phy *phy_optional_get(struct device *dev, const char *string);
 struct phy *devm_phy_get(struct device *dev, const char *string);
@@ -389,6 +404,16 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
 	return;
 }
 
+static inline void phy_get_attrs(struct phy *phy, struct phy_attrs *attrs)
+{
+	return;
+}
+
+static inline void phy_set_attrs(struct phy *phy, struct phy_attrs attrs)
+{
+	return;
+}
+
 static inline struct phy *phy_get(struct device *dev, const char *string)
 {
 	return ERR_PTR(-ENOSYS);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ