From: Kishon Vijay Abraham I <kishon@ti.com>
To: Steen Hegelund <steen.hegelund@microchip.com>,
Vinod Koul <vkoul@kernel.org>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Lars Povlsen <lars.povlsen@microchip.com>,
Bjarni Jonasson <bjarni.jonasson@microchip.com>,
Microchip UNG Driver List <UNGLinuxDriver@microchip.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH v15 2/4] phy: Add media type and speed serdes configuration interfaces
Date: Tue, 16 Mar 2021 18:44:13 +0530 [thread overview]
Message-ID: <694b0f66-64ab-626c-96fa-e703abea88c2@ti.com> (raw)
In-Reply-To: <20210218161451.3489955-3-steen.hegelund@microchip.com>
On 18/02/21 9:44 pm, Steen Hegelund wrote:
> Provide new phy configuration interfaces for media type and speed that
> allows e.g. PHYs used for ethernet to be configured with this
> information.
>
> Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
> Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-By: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> drivers/phy/phy-core.c | 30 ++++++++++++++++++++++++++++++
> include/linux/phy/phy.h | 26 ++++++++++++++++++++++++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 71cb10826326..ccb575b13777 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -373,6 +373,36 @@ int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode)
> }
> EXPORT_SYMBOL_GPL(phy_set_mode_ext);
>
> +int phy_set_media(struct phy *phy, enum phy_media media)
> +{
> + int ret;
> +
> + if (!phy || !phy->ops->set_media)
> + return 0;
> +
> + mutex_lock(&phy->mutex);
> + ret = phy->ops->set_media(phy, media);
> + mutex_unlock(&phy->mutex);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(phy_set_media);
> +
> +int phy_set_speed(struct phy *phy, int speed)
> +{
> + int ret;
> +
> + if (!phy || !phy->ops->set_speed)
> + return 0;
> +
> + mutex_lock(&phy->mutex);
> + ret = phy->ops->set_speed(phy, speed);
> + mutex_unlock(&phy->mutex);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(phy_set_speed);
> +
> int phy_reset(struct phy *phy)
> {
> int ret;
> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> index e435bdb0bab3..0ed434d02196 100644
> --- a/include/linux/phy/phy.h
> +++ b/include/linux/phy/phy.h
> @@ -44,6 +44,12 @@ enum phy_mode {
> PHY_MODE_DP
> };
>
> +enum phy_media {
> + PHY_MEDIA_DEFAULT,
> + PHY_MEDIA_SR,
> + PHY_MEDIA_DAC,
> +};
> +
> /**
> * union phy_configure_opts - Opaque generic phy configuration
> *
> @@ -64,6 +70,8 @@ union phy_configure_opts {
> * @power_on: powering on the phy
> * @power_off: powering off the phy
> * @set_mode: set the mode of the phy
> + * @set_media: set the media type of the phy (optional)
> + * @set_speed: set the speed of the phy (optional)
> * @reset: resetting the phy
> * @calibrate: calibrate the phy
> * @release: ops to be performed while the consumer relinquishes the PHY
> @@ -75,6 +83,8 @@ struct phy_ops {
> int (*power_on)(struct phy *phy);
> int (*power_off)(struct phy *phy);
> int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode);
> + int (*set_media)(struct phy *phy, enum phy_media media);
> + int (*set_speed)(struct phy *phy, int speed);
>
> /**
> * @configure:
> @@ -215,6 +225,8 @@ int phy_power_off(struct phy *phy);
> int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode);
> #define phy_set_mode(phy, mode) \
> phy_set_mode_ext(phy, mode, 0)
> +int phy_set_media(struct phy *phy, enum phy_media media);
> +int phy_set_speed(struct phy *phy, int speed);
> int phy_configure(struct phy *phy, union phy_configure_opts *opts);
> int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
> union phy_configure_opts *opts);
> @@ -344,6 +356,20 @@ static inline int phy_set_mode_ext(struct phy *phy, enum phy_mode mode,
> #define phy_set_mode(phy, mode) \
> phy_set_mode_ext(phy, mode, 0)
>
> +static inline int phy_set_media(struct phy *phy, enum phy_media media)
> +{
> + if (!phy)
> + return 0;
> + return -ENODEV;
> +}
> +
> +static inline int phy_set_speed(struct phy *phy, int speed)
> +{
> + if (!phy)
> + return 0;
> + return -ENODEV;
> +}
> +
> static inline enum phy_mode phy_get_mode(struct phy *phy)
> {
> return PHY_MODE_INVALID;
>
next prev parent reply other threads:[~2021-03-16 13:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 16:14 [PATCH v15 0/4] Adding the Sparx5 Serdes driver Steen Hegelund
2021-02-18 16:14 ` [PATCH v15 1/4] dt-bindings: phy: Add sparx5-serdes bindings Steen Hegelund
2021-02-18 16:14 ` [PATCH v15 2/4] phy: Add media type and speed serdes configuration interfaces Steen Hegelund
2021-02-21 5:59 ` Leon Romanovsky
2021-02-22 8:00 ` Steen Hegelund
2021-02-23 12:22 ` Kishon Vijay Abraham I
2021-02-23 13:53 ` Leon Romanovsky
2021-03-16 13:14 ` Kishon Vijay Abraham I [this message]
2021-02-18 16:14 ` [PATCH v15 3/4] phy: Add Sparx5 ethernet serdes PHY driver Steen Hegelund
2021-02-18 16:14 ` [PATCH v15 4/4] arm64: dts: sparx5: Add Sparx5 serdes driver node Steen Hegelund
2021-02-18 21:23 ` [PATCH v15 0/4] Adding the Sparx5 Serdes driver David Miller
2021-03-15 15:04 ` Steen Hegelund
2021-03-15 17:26 ` Jakub Kicinski
2021-03-16 8:04 ` Steen Hegelund
2021-03-16 4:53 ` Vinod Koul
2021-03-16 8:05 ` Steen Hegelund
2021-03-17 6:43 ` Vinod Koul
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=694b0f66-64ab-626c-96fa-e703abea88c2@ti.com \
--to=kishon@ti.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=bjarni.jonasson@microchip.com \
--cc=lars.povlsen@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=steen.hegelund@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).