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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 12 Feb 2021 12:23:27 +0100
From:   Steen Hegelund <steen.hegelund@...rochip.com>
To:     David Miller <davem@...emloft.net>
CC:     <kishon@...com>, <vkoul@...nel.org>,
        <alexandre.belloni@...tlin.com>, <lars.povlsen@...rochip.com>,
        <bjarni.jonasson@...rochip.com>, <UNGLinuxDriver@...rochip.com>,
        <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <andrew@...n.ch>
Subject: Re: [PATCH v14 2/4] phy: Add media type and speed serdes
 configuration interfaces

Hi David,

On Wed, 2021-02-10 at 15:32 -0800, David Miller wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> From: Steen Hegelund <steen.hegelund@...rochip.com>
> Date: Wed, 10 Feb 2021 09:52:53 +0100
> 
> > Provide new phy configuration interfaces for media type and speed
> > that
> > allows allows e.g. PHYs used for ethernet to be configured with
> > this
> > information.
> > 
> > Signed-off-by: Lars Povlsen <lars.povlsen@...rochip.com>
> > Signed-off-by: Steen Hegelund <steen.hegelund@...rochip.com>
> > Reviewed-by: Andrew Lunn <andrew@...n.ch>
> > Reviewed-by: Alexandre Belloni <alexandre.belloni@...tlin.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..e4fd69a1faa7 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 -ENOSYS;
> > +}
> 
> Maybe ENODEV instead?

Sure.  I will update that.

-- 
BR
Steen

-=-=-=-=-=-=-=-=-=-=-=-=-=-=
steen.hegelund@...rochip.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ