public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] drivers/net/phy: introduce phy_set_supported()
Date: Mon, 11 Jan 2016 10:09:40 +0000	[thread overview]
Message-ID: <1452506979.3277.8.camel@synopsys.com> (raw)
In-Reply-To: <1450889139-21838-1-git-send-email-abrodkin@synopsys.com>

Hi Joe,

On Wed, 2015-12-23 at 19:45 +0300, Alexey Brodkin wrote:
> This new function will allow MAC drivers to override supported
> capabilities of the phy. It is required when MAC cannot handle all
> speeds supported by phy.
> 
> For example phy supports up-to 1Gb connections while MAC may only work
> in modes up to 100 or even 10 Mbit/sec.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> ---
>  drivers/net/phy/phy.c | 24 ++++++++++++++++++++++++
>  include/phy.h         |  1 +
>  2 files changed, 25 insertions(+)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index ec9be6b..4ad4e78 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -526,6 +526,30 @@ int phy_register(struct phy_driver *drv)
>  	return 0;
>  }
>  
> +int phy_set_supported(struct phy_device *phydev, u32 max_speed)
> +{
> +	/* The default values for phydev->supported are provided by the PHY
> +	 * driver "features" member, we want to reset to sane defaults first
> +	 * before supporting higher speeds.
> +	 */
> +	phydev->supported &= PHY_DEFAULT_FEATURES;
> +
> +	switch (max_speed) {
> +	default:
> +		return -ENOTSUPP;
> +	case SPEED_1000:
> +		phydev->supported |= PHY_1000BT_FEATURES;
> +		/* fall through */
> +	case SPEED_100:
> +		phydev->supported |= PHY_100BT_FEATURES;
> +		/* fall through */
> +	case SPEED_10:
> +		phydev->supported |= PHY_10BT_FEATURES;
> +	}
> +
> +	return 0;
> +}
> +
>  static int phy_probe(struct phy_device *phydev)
>  {
>  	int err = 0;
> diff --git a/include/phy.h b/include/phy.h
> index b793e90..e030c9f 100644
> --- a/include/phy.h
> +++ b/include/phy.h
> @@ -234,6 +234,7 @@ int phy_startup(struct phy_device *phydev);
>  int phy_config(struct phy_device *phydev);
>  int phy_shutdown(struct phy_device *phydev);
>  int phy_register(struct phy_driver *drv);
> +int phy_set_supported(struct phy_device *phydev, u32 max_speed);
>  int genphy_config_aneg(struct phy_device *phydev);
>  int genphy_restart_aneg(struct phy_device *phydev);
>  int genphy_update_link(struct phy_device *phydev);

Any chance for this one to be applied?

-Alexey

      reply	other threads:[~2016-01-11 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23 16:45 [U-Boot] [PATCH] drivers/net/phy: introduce phy_set_supported() Alexey Brodkin
2016-01-11 10:09 ` Alexey Brodkin [this message]

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=1452506979.3277.8.camel@synopsys.com \
    --to=alexey.brodkin@synopsys.com \
    --cc=u-boot@lists.denx.de \
    /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