mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] phy: Add max_link_rate as a PHY attribute along with get/set APIs
@ 2020-04-25  4:39 Yuti Amonkar
  2020-04-27 12:50 ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 2+ messages in thread
From: Yuti Amonkar @ 2020-04-25  4:39 UTC (permalink / raw)
  To: linux-kernel, kishon, mark.rutland, maxime
  Cc: jsarha, tomi.valkeinen, praneeth, mparab, sjakhade, yamonkar

The patch adds a pair of APIs that allow the generic PHY subsystem to
provide information on the maximum value of link rate supported by the
PHY. The PHY provider driver may use phy_set_max_link_rate() to set the
maximum link rate that the PHY supports. The controller driver may then
use phy_get_max_link_rate() to fetch the PHY link rate in order to
properly configure the controller.

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

diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index bcee8eba62b3..a8b7b4a2b8de 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,16 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
 {
 	phy->attrs.bus_width = bus_width;
 }
+
+static inline int phy_get_max_link_rate(struct phy *phy)
+{
+	return phy->attrs.max_link_rate;
+}
+
+static inline void phy_set_max_link_rate(struct phy *phy, int link_rate)
+{
+	phy->attrs.max_link_rate = link_rate;
+}
 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 +400,16 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
 	return;
 }
 
+static inline int phy_get_max_link_rate(struct phy *phy)
+{
+	return -ENOSYS;
+}
+
+static inline void phy_set_max_link_rate(struct phy *phy, int link_rate)
+{
+	return;
+}
+
 static inline struct phy *phy_get(struct device *dev, const char *string)
 {
 	return ERR_PTR(-ENOSYS);
-- 
2.26.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] phy: Add max_link_rate as a PHY attribute along with get/set APIs
  2020-04-25  4:39 [PATCH v1] phy: Add max_link_rate as a PHY attribute along with get/set APIs Yuti Amonkar
@ 2020-04-27 12:50 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 2+ messages in thread
From: Kishon Vijay Abraham I @ 2020-04-27 12:50 UTC (permalink / raw)
  To: Yuti Amonkar, linux-kernel, mark.rutland, maxime
  Cc: jsarha, tomi.valkeinen, praneeth, mparab, sjakhade

Hi Yuti,

On 4/25/2020 10:09 AM, Yuti Amonkar wrote:
> The patch adds a pair of APIs that allow the generic PHY subsystem to
> provide information on the maximum value of link rate supported by the
> PHY. The PHY provider driver may use phy_set_max_link_rate() to set the
> maximum link rate that the PHY supports. The controller driver may then
> use phy_get_max_link_rate() to fetch the PHY link rate in order to
> properly configure the controller.
> 
> Signed-off-by: Yuti Amonkar <yamonkar@cadence.com>

This patch should preferably be sent along with the patch that uses these
functions (unless you have some specific reason).

Thanks
Kishon

> ---
>  include/linux/phy/phy.h | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> index bcee8eba62b3..a8b7b4a2b8de 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,16 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
>  {
>  	phy->attrs.bus_width = bus_width;
>  }
> +
> +static inline int phy_get_max_link_rate(struct phy *phy)
> +{
> +	return phy->attrs.max_link_rate;
> +}
> +
> +static inline void phy_set_max_link_rate(struct phy *phy, int link_rate)
> +{
> +	phy->attrs.max_link_rate = link_rate;
> +}
>  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 +400,16 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
>  	return;
>  }
>  
> +static inline int phy_get_max_link_rate(struct phy *phy)
> +{
> +	return -ENOSYS;
> +}
> +
> +static inline void phy_set_max_link_rate(struct phy *phy, int link_rate)
> +{
> +	return;
> +}
> +
>  static inline struct phy *phy_get(struct device *dev, const char *string)
>  {
>  	return ERR_PTR(-ENOSYS);
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-27 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25  4:39 [PATCH v1] phy: Add max_link_rate as a PHY attribute along with get/set APIs Yuti Amonkar
2020-04-27 12:50 ` Kishon Vijay Abraham I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®